From 6b1cf256c4a6ed016a07c82836be1a244b2d80cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Fri, 22 Dec 2023 09:28:40 +0000 Subject: [PATCH 1/3] buildmaster: entry.sh: fix errors by checking for dir existence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Get rid of following annyoing errors during testing: chown: cannot access '/config': No such file or directory chown: cannot access '/certs': No such file or directory chmod: cannot access '/config': No such file or directory chmod: cannot access '/certs': No such file or directory As those dirs doesn't exist in the container, they're being provided as volumes during deployment. Signed-off-by: Petr Štetiar --- docker/buildmaster/files/entry.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/buildmaster/files/entry.sh b/docker/buildmaster/files/entry.sh index 437ad41..2fc914c 100644 --- a/docker/buildmaster/files/entry.sh +++ b/docker/buildmaster/files/entry.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash -chown --recursive buildbot:buildbot /master /config /certs -chmod 0700 /master /config /certs +for dir in /master /config /certs; do + [ -d "$dir" ] || continue + + chown --recursive buildbot:buildbot "$dir" + chmod 0700 "$dir" +done /usr/sbin/gosu buildbot /start.sh "$@" From c539e001d459b3f50f34ea931b888aa1fb988e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Fri, 22 Dec 2023 09:46:01 +0000 Subject: [PATCH 2/3] ci: improve QA with cram based tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently we've broken master container but we're not aware about it as current tests are very lame, so lets improve it a bit with some more reliable, extensible solution. Signed-off-by: Petr Štetiar --- .github/workflows/build-push.yml | 4 ++-- .gitignore | 2 ++ requirements-dev.txt | 1 + tests/cram/master/01-logs.t | 7 +++++++ tests/cram/worker/01-logs.t | 10 ++++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tests/cram/master/01-logs.t create mode 100644 tests/cram/worker/01-logs.t diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 9a2eed4..f568ed6 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -83,8 +83,8 @@ jobs: run: | docker run --detach ${{ matrix.container_test_command }} --name test-${{ matrix.container_flavor }} local/${{ matrix.container_flavor }} sleep 5 - docker logs test-${{ matrix.container_flavor }} | tee ${{ matrix.container_flavor }}.log - grep "${{ matrix.container_verify_string }}" ${{ matrix.container_flavor }}.log + pip install cram + cram --verbose "tests/cram/${{ matrix.container_flavor }}" deploy: name: Push Container diff --git a/.gitignore b/.gitignore index a94d1d2..0d4e15f 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ phase[12]/twistd.* !.github/**/* !requirements-dev.txt !.ruff.toml +!tests +!tests/**/* diff --git a/requirements-dev.txt b/requirements-dev.txt index a14cc03..e1cb65f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,2 +1,3 @@ +cram==0.7 black==23.3.0 ruff==0.0.267 diff --git a/tests/cram/master/01-logs.t b/tests/cram/master/01-logs.t new file mode 100644 index 0000000..b6c5c81 --- /dev/null +++ b/tests/cram/master/01-logs.t @@ -0,0 +1,7 @@ +Check that logs have expected content after container startup: + + $ docker logs test-master + updating existing installation + creating /master/master.cfg.sample + creating database (sqlite:///state.sqlite) + buildmaster configured in /master diff --git a/tests/cram/worker/01-logs.t b/tests/cram/worker/01-logs.t new file mode 100644 index 0000000..7afdd4e --- /dev/null +++ b/tests/cram/worker/01-logs.t @@ -0,0 +1,10 @@ +Check that logs have expected content after container startup: + + $ docker logs test-worker + updating existing installation + mkdir /builder/info + Creating info/admin, you need to edit it appropriately. + Creating info/host, you need to edit it appropriately. + Not creating info/access_uri - add it if you wish + Please edit the files in /builder/info appropriately. + worker configured in /builder From c81331daf22debce70314b9b5ee39c9774df6d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Fri, 22 Dec 2023 10:35:23 +0000 Subject: [PATCH 3/3] buildmaster: fix Twisted dependency hell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Force twisted==22.10.0 which fixes following buildbot master startup issue: Unhandled error in Deferred: Traceback (most recent call last): File "/.../site-packages/buildbot/scripts/create_master.py", line 84, in createDB master = BuildMaster(config['basedir']) File "/.../site-packages/buildbot/master.py", line 102, in __init__ self._services_d = self.create_child_services() File "/.../site-packages/twisted/internet/defer.py", line 2245, in unwindGenerator return _cancellableInlineCallbacks(gen) File "/.../site-packages/twisted/internet/defer.py", line 2157, in _cancellableInlineCallbacks _inlineCallbacks(None, gen, status, _copy_context()) --- --- File "/.../site-packages/twisted/internet/defer.py", line 1997, in _inlineCallbacks result = context.run(gen.send, result) File "/.../site-packages/buildbot/master.py", line 188, in create_child_services self.www = wwwservice.WWWService() File "/.../site-packages/buildbot/www/service.py", line 196, in __init__ self.apps = get_plugins('www', None, load_now=True) File "/.../site-packages/buildbot/plugins/db.py", line 356, in get_plugins return _DB.add_namespace(namespace, interface, check_extras, load_now) File "/.../site-packages/buildbot/plugins/db.py", line 306, in add_namespace tempo.load() File "/.../site-packages/buildbot/plugins/db.py", line 242, in load self._tree.load() File "/.../site-packages/buildbot/plugins/db.py", line 112, in load child.load() File "/.../site-packages/buildbot/plugins/db.py", line 45, in load self._value = self._loader(self._entry) File "/.../site-packages/buildbot/plugins/db.py", line 214, in _load_entry raise PluginDBError('Requirements are not satisfied ' buildbot.errors.PluginDBError: Requirements are not satisfied for buildbot.www:base: The 'zope-interface>=5' distribution was not found and is required by Twisted References: https://github.com/buildbot/buildbot/commit/94e2d59c23472f3fe640437630309bea518c5b9e Signed-off-by: Petr Štetiar --- docker/buildmaster/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/buildmaster/Dockerfile b/docker/buildmaster/Dockerfile index 8d21245..7be345c 100644 --- a/docker/buildmaster/Dockerfile +++ b/docker/buildmaster/Dockerfile @@ -36,6 +36,7 @@ RUN \ "buildbot-console-view==$BUILDBOT_VERSION" \ "buildbot-grid-view==$BUILDBOT_VERSION" \ "buildbot-worker==$BUILDBOT_VERSION" \ + "twisted==22.10.0" \ pyOpenSSL \ service_identity RUN \