From 244d6cb3a99eed59990445a05610bf033e2b46b1 Mon Sep 17 00:00:00 2001 From: Paul Mars Date: Wed, 1 Jul 2026 16:41:44 +0200 Subject: [PATCH 1/3] ci: use openstack for spread --- .github/workflows/spread-test.yaml | 10 ++-- spread.yaml | 87 ++++++++++++++++++------------ tests/lib/spread/tools.sh | 17 ++++++ 3 files changed, 76 insertions(+), 38 deletions(-) create mode 100644 tests/lib/spread/tools.sh diff --git a/.github/workflows/spread-test.yaml b/.github/workflows/spread-test.yaml index af390b7f..422ebb65 100644 --- a/.github/workflows/spread-test.yaml +++ b/.github/workflows/spread-test.yaml @@ -159,13 +159,13 @@ jobs: # Register a problem matcher to highlight spread failures echo "::add-matcher::.github/spread-problem-matcher.json" - BACKEND=google + BACKEND=openstack SERIES=${{ matrix.series }} if [[ "${{ matrix.systems }}" =~ -arm- ]]; then - BACKEND=google-arm + BACKEND=openstack-arm elif [[ "${{ matrix.group }}" =~ -crossbuild ]]; then - BACKEND=google-crossbuild + BACKEND=openstack-crossbuild fi RUN_TESTS="" @@ -201,9 +201,9 @@ jobs: echo "Running spread log parser" ./tests/lib/external/snapd-testing-tools/utils/log-parser spread.log --output spread-results.json - BACKEND=google + BACKEND=openstack if [[ "${{ matrix.systems }}" =~ -arm- ]]; then - BACKEND=google-arm + BACKEND=openstack-arm fi echo "Determining which tests were executed" diff --git a/spread.yaml b/spread.yaml index 1027c3ac..33b12f9b 100644 --- a/spread.yaml +++ b/spread.yaml @@ -15,50 +15,69 @@ environment: backends: - google: - key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")' - location: snapd-spread/us-east1-b - plan: n2-standard-2 + openstack: + key: '$(HOST: echo "$OS_CREDENTIALS_AMD64_PS7")' + plan: shared.xsmall halt-timeout: 2h + wait-timeout: 10m + groups: [default] + proxy: ingress-haproxy.ps7.canonical.com + cidr-port-rel: [10.151.96.0/21:5000] + volume-auto-delete: true + environment: &openstack-env + SNAPD_USE_PROXY: 'true' + HTTP_PROXY: 'http://egress.ps7.internal:3128' + HTTPS_PROXY: 'http://egress.ps7.internal:3128' + http_proxy: 'http://egress.ps7.internal:3128' + https_proxy: 'http://egress.ps7.internal:3128' + no_proxy: '127.0.0.1,127.0.0.53,localhost' + NO_PROXY: '127.0.0.1,127.0.0.53,localhost' + NTP_SERVER: 'ntp.ps7.internal' systems: - ubuntu-20.04-64: - storage: 45G + image: snapd-spread/ubuntu-20.04-64 workers: 1 - ubuntu-22.04-64: - storage: 45G + image: snapd-spread/ubuntu-22.04-64 workers: 1 - ubuntu-24.04-64: - storage: 45G + image: snapd-spread/ubuntu-24.04-64 workers: 1 - google-crossbuild: - type: google - key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")' - location: snapd-spread/us-east1-b - plan: n2-standard-4 + openstack-crossbuild: + type: openstack + key: '$(HOST: echo "$OS_CREDENTIALS_AMD64_PS7")' + plan: shared.medium halt-timeout: 2h + wait-timeout: 10m + proxy: ingress-haproxy.ps7.canonical.com + cidr-port-rel: [10.151.96.0/21:5000] + volume-auto-delete: true + environment: *openstack-env systems: - ubuntu-24.04-64: - storage: 45G + image: snapd-spread/ubuntu-24.04-64 workers: 1 - google-arm: - type: google - key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")' - location: snapd-spread/us-central1-a - plan: t2a-standard-1 + openstack-arm: + type: openstack + key: '$(HOST: echo "$OS_CREDENTIALS_ARM64_PS7")' + plan: shared.xsmall.arm64 halt-timeout: 2h + wait-timeout: 10m + groups: [default] + proxy: ingress-haproxy.ps7.canonical.com + cidr-port-rel: [10.151.89.0/24:8000] + volume-auto-delete: true + environment: *openstack-env systems: - ubuntu-20.04-arm-64: - image: ubuntu-os-cloud/ubuntu-2004-lts-arm64 + image: snapd-spread/ubuntu-20.04-arm-64 workers: 1 - storage: 45G - ubuntu-22.04-arm-64: - image: ubuntu-os-cloud/ubuntu-2204-lts-arm64 + image: snapd-spread/ubuntu-22.04-arm-64 workers: 1 - storage: 45G - ubuntu-24.04-arm-64: - image: ubuntu-os-cloud/ubuntu-2404-lts-arm64 + image: snapd-spread/ubuntu-24.04-arm-64 workers: 1 - storage: 45G qemu: memory: 4G systems: @@ -75,6 +94,14 @@ backends: path: /home/ubuntu-image prepare: | + #shellcheck source=tests/lib/spread/tools.sh + . $SPREAD_PATH/tests/lib/spread/tools.sh + if [ -n "$HTTP_PROXY" ]; then + # The snapd daemon doesn't see the environment variables, so we must modify its config + # to use a proxy with it. Came from: + # https://github.com/canonical/snapd/blob/619cc925793591348db21bb45fa4af65288d2c42/tests/lib/prepare.sh#L90 + tools.setup_snapd_proxy + fi # Make sure there is a hostname file because it could be missing # We will need it to have debootstrap properly run if [ ! -f /etc/hostname ]; then @@ -107,12 +134,6 @@ prepare: | systemctl mask unattended-upgrades.service fi - # Make sure ssh service is restarted after it is killed by spread (pkill -o -HUP sshd) - # during the machine setup in google systems. For more details see lp:2011458 - if [ "$SPREAD_BACKEND" = "google" ] && [[ "$SPREAD_SYSTEM" == ubuntu-2* ]] && ! systemctl is-active ssh; then - systemctl restart ssh - fi - apt update apt install -y snapd libc6-dev git ubuntu-dev-tools if [[ ! "$SPREAD_BACKEND" == *-arm ]]; then @@ -146,18 +167,18 @@ suites: summary: Common integration tests for ubuntu-image tests/amd64/: summary: Integration tests for ubuntu-image on amd64 - backends: [google, qemu] + backends: [openstack, qemu] environment: IMG/ubuntu_server_pc_amd64: ubuntu-server-pc-amd64 tests/amd64-crossbuild/: summary: Integration tests for ubuntu-image on amd64 - backends: [google-crossbuild, qemu] + backends: [openstack-crossbuild, qemu] environment: IMG/ubuntu_server_riscv64: ubuntu-server-riscv64 IMG/ubuntu_server_pi_arm64: ubuntu-server-pi-arm64 tests/arm64/: summary: Integration tests for ubuntu-image on arm64 - backends: [google-arm] + backends: [openstack-arm] environment: IMG/ubuntu_server_pi_arm64: ubuntu-server-pi-arm64 IMG/ubuntu_server_pc_arm64: ubuntu-server-pc-arm64 diff --git a/tests/lib/spread/tools.sh b/tests/lib/spread/tools.sh new file mode 100644 index 00000000..1445f51d --- /dev/null +++ b/tests/lib/spread/tools.sh @@ -0,0 +1,17 @@ +tools.setup_snapd_proxy() { + if [ "${SNAPD_USE_PROXY:-}" != true ]; then + return + fi + + local SNAPD_CONFD="/etc/systemd/system/snapd.service.d" + mkdir -p "$SNAPD_CONFD" + + cat < ${SNAPD_CONFD}/proxy.conf +[Service] +Environment=HTTPS_PROXY="$HTTPS_PROXY" HTTP_PROXY="$HTTP_PROXY" https_proxy="$HTTPS_PROXY" http_proxy="$HTTP_PROXY" NO_PROXY="$NO_PROXY" no_proxy="$NO_PROXY" +EOF + + # Since the service config changed, restart + systemctl daemon-reload + systemctl restart snapd.service +} From dc5491cb6c1e8dc5521da302ae0e2117f0a8b56c Mon Sep 17 00:00:00 2001 From: Paul Mars Date: Wed, 1 Jul 2026 16:58:57 +0200 Subject: [PATCH 2/3] ci: fix reunner filter --- .github/workflows/spread-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spread-test.yaml b/.github/workflows/spread-test.yaml index 422ebb65..71e1eaa7 100644 --- a/.github/workflows/spread-test.yaml +++ b/.github/workflows/spread-test.yaml @@ -47,7 +47,7 @@ jobs: spread: name: Build a ${{ matrix.series }} image on ${{ matrix.group }} (${{ matrix.systems }}) - runs-on: [self-hosted, ubuntu-image] + runs-on: [self-hosted, spread-enabled] needs: [snap-build-amd64, snap-build-arm64] strategy: fail-fast: false From 63e236a0751c48b2f212ca4b4d7dfcf5bde0bb35 Mon Sep 17 00:00:00 2001 From: Paul Mars Date: Mon, 6 Jul 2026 11:41:38 +0200 Subject: [PATCH 3/3] fix: adapt to new base for lxd Signed-off-by: Paul Mars --- internal/statemachine/classic_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/statemachine/classic_test.go b/internal/statemachine/classic_test.go index 893c5b8a..1bc6faae 100644 --- a/internal/statemachine/classic_test.go +++ b/internal/statemachine/classic_test.go @@ -2151,6 +2151,9 @@ func TestPrepareClassicImage(t *testing.T) { SnapName: "lxd", Channel: "latest/stable", }, + { + SnapName: "core26", + }, { SnapName: "core24", }, @@ -2171,7 +2174,7 @@ func TestPrepareClassicImage(t *testing.T) { // check that the lxd and hello snaps, as well as lxd's base, core20 // were prepared in the correct location - snaps := map[string]string{"lxd": "stable", "hello": "candidate", "core20": "stable", "core22": "stable", "core24": "stable"} + snaps := map[string]string{"lxd": "stable", "hello": "candidate", "core20": "stable", "core22": "stable", "core24": "stable", "core26": "stable"} for snapName, snapChannel := range snaps { // reach out to the snap store to find the revision // of the snap for the specified channel @@ -5182,6 +5185,9 @@ func TestPreseedResetChroot(t *testing.T) { { SnapName: "core24", }, + { + SnapName: "core26", + }, }, }, }