From 7c2c94c68e30c4fabefa502f5351da922e09426a Mon Sep 17 00:00:00 2001 From: Andrej Shadura <andrew.shadura@collabora.co.uk> Date: Mon, 12 Jun 2023 11:45:55 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Waiting=205=C3=9730=20is=20enough=20to=20te?= =?UTF-8?q?ll=20a=20restart=20is=20needed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk> --- tests/01-build-dash | 4 ++-- tests/scripts/wait-for-pkg | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/01-build-dash b/tests/01-build-dash index 32f4bba3de..139571659f 100755 --- a/tests/01-build-dash +++ b/tests/01-build-dash @@ -14,9 +14,9 @@ osc dput bullseye-derivative *.dsc cd "$OLDPWD" -if ! wait-for-pkg bullseye-derivative dash main +if ! wait-for-pkg bullseye-derivative dash main x86_64 5 then # DoD didn't wake up, restart the backend and try again docker-compose exec -T backend supervisorctl restart all - wait-for-pkg bullseye-derivative dash main + wait-for-pkg bullseye-derivative dash main x86_64 fi diff --git a/tests/scripts/wait-for-pkg b/tests/scripts/wait-for-pkg index 5105f6ab79..de06669c59 100755 --- a/tests/scripts/wait-for-pkg +++ b/tests/scripts/wait-for-pkg @@ -4,7 +4,7 @@ project=$1 pkg=$2 prj_repo=${3:-main} prj_arch=${4:-x86_64} -iterations=30 +iterations=${5:-30} wait=30 echo "Checking build result: $project $pkg $prj_repo $prj_arch" -- GitLab From a1a8a0d316e7aa411c09238babf97ece46a0ed9a Mon Sep 17 00:00:00 2001 From: Andrej Shadura <andrew.shadura@collabora.co.uk> Date: Mon, 12 Jun 2023 10:55:25 +0200 Subject: [PATCH 2/2] Test publishing multitarballs with signatures Verify that packages with multiple tarballs are handled correctly: their component tarballs should be published, as well as their signatures. For this, artificially extend the dash package with an empty component tarball called "vendor", with fake unverifiable signature files only containing the word "signature". Instead of editing the .dsc file to include those, unpack the source package and generate it again, allowing dpkg-buildpackage to pick up the new component tarball. Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk> --- .gitlab-ci.yml | 8 +++++++- tests/01-build-dash | 32 ++++++++++++++++++++++++++++++++ tests/scripts/wait-for-file | 23 +++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100755 tests/scripts/wait-for-file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 118f96ffc3..8212bf6877 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -96,6 +96,11 @@ worker: worker: image: $CI_REGISTRY_IMAGE/worker:$TAG_SHA volumes: + backend-storage: + driver_opts: + type: none + o: bind + device: './storage/backend' backend-logs: driver_opts: type: none @@ -114,6 +119,7 @@ worker: before_script: - apt update && apt install -y --no-install-recommends curl + debhelper docker-compose docker.io dpkg-dev @@ -123,7 +129,7 @@ worker: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" - docker info - echo "$COMPOSE_OVERLAY" > docker-compose.override.yml - - mkdir -p logs/backend logs/frontend logs/worker + - mkdir -p logs/backend logs/frontend logs/worker storage/backend - | cat << EOF > ~/.oscrc [general] diff --git a/tests/01-build-dash b/tests/01-build-dash index 139571659f..81045a781b 100755 --- a/tests/01-build-dash +++ b/tests/01-build-dash @@ -10,6 +10,26 @@ cd "$dir" apt-get source --download-only dash +tarball=$(echo dash_*.orig.tar.*) +# pretend the tarball is signed +echo signature > $tarball.asc + +pkgver=${tarball%.orig.tar.*} +ver=${pkgver#dash_} + +# create fake extra tarball +mkdir vendor +tar -zcf dash_$ver.orig-vendor.tar.gz vendor/ + +# pretend this is a valid signature +echo signature > dash_$ver.orig-vendor.tar.gz.asc + +( + dpkg-source -x *dsc + cd dash-$ver + dpkg-buildpackage -d -S +) + osc dput bullseye-derivative *.dsc cd "$OLDPWD" @@ -20,3 +40,15 @@ then docker-compose exec -T backend supervisorctl restart all wait-for-pkg bullseye-derivative dash main x86_64 fi + +wait-for-file -d storage/backend/repos/bullseye-derivative/main + +wait-for-file -f storage/backend/repos/bullseye-derivative/main/$tarball + +ls storage/backend/repos/bullseye-derivative/main -lR + +set -x + +test -f storage/backend/repos/bullseye-derivative/main/$tarball.asc +test -f storage/backend/repos/bullseye-derivative/main/dash_$ver.orig-vendor.tar.gz +test -f storage/backend/repos/bullseye-derivative/main/dash_$ver.orig-vendor.tar.gz.asc diff --git a/tests/scripts/wait-for-file b/tests/scripts/wait-for-file new file mode 100755 index 0000000000..228aa397cf --- /dev/null +++ b/tests/scripts/wait-for-file @@ -0,0 +1,23 @@ +#!/bin/sh + +iterations=30 +wait=30 + +echo "Checking for file presence: $@" + +for i in $(seq $iterations) +do + echo test "$@" + if test "$@" + then + echo "Condition reached." >&2 + break + fi + if [ $i -eq $iterations ] + then + echo "ERROR: file failed to appear within the time limit!" >&2 + exit 1 + fi + echo "Sleeping ${wait}s (iteration $i/$iterations)" + sleep $wait +done -- GitLab