From 1d41a36316b999af0ba3d5133b4bef3606794418 Mon Sep 17 00:00:00 2001 From: Valentin David Date: Fri, 14 Jul 2023 10:34:50 +0200 Subject: [PATCH] Switch to core24 --- .github/workflows/tests.yaml | 8 ++++---- HACKING.md | 16 ++++++++-------- spread.yaml | 6 +++--- tests/lib/nested.sh | 2 +- tests/lib/prepare-uc.sh | 4 ++-- tests/lib/prepare-utils.sh | 16 ++++++++++++---- tests/spread/build/build-initrd/task.yaml | 3 ++- tests/spread/ci/build-lxd/task.yaml | 8 ++++---- tests/spread/main/nested/task.yaml | 2 +- 9 files changed, 37 insertions(+), 28 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6684abf9..f85731d6 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -99,15 +99,15 @@ jobs: echo "************* DOWNLOADING SNAPS *************" download_core_initrd_snaps 'edge' - echo "************* PREPAREING CORE22 IMAGE *************" + echo "************* PREPAREING CORE24 IMAGE *************" rm -f "upstream-pc-kernel.snap" "upstream-pc-gadget.snap" mv "pc-kernel.artifact" "upstream-pc-kernel.snap" mv "pc-gadget.artifact" "upstream-pc-gadget.snap" - echo "************* BUILDING CORE22 IMAGE *************" - build_core22_image + echo "************* BUILDING CORE24 IMAGE *************" + build_core24_image - echo "************* STARTING CORE22 VM *************" + echo "************* STARTING CORE24 VM *************" start_snapd_core_vm '${{ github.workspace }}' cd snapd diff --git a/HACKING.md b/HACKING.md index 52b92fab..7d91725c 100644 --- a/HACKING.md +++ b/HACKING.md @@ -51,15 +51,15 @@ go install . ``` sudo apt update && sudo apt install -y qemu-kvm autopkgtest ``` -2. Create a suitable ubuntu test image (jammy) in the following directory where spread locates images. Note that the location is different when using spread installed through snap. +2. Create a suitable ubuntu test image (mantic) in the following directory where spread locates images. Note that the location is different when using spread installed through snap. ``` mkdir -p ~/.spread/qemu # This location is different if you installed spread from snap cd ~/.spread/qemu -autopkgtest-buildvm-ubuntu-cloud -r jammy +autopkgtest-buildvm-ubuntu-cloud -r mantic ``` 3. Rename the newly built image as the name will not match what spread is expecting ``` -mv autopkgtest-jammy-amd64.img ubuntu-22.04-64.img +mv autopkgtest-mantic-amd64.img ubuntu-24.04-64.img ``` 4. Now you are ready to run spread tests with the qemu backend ``` @@ -80,11 +80,11 @@ and yq (needed for yaml manipulation), download the newest image and import it i sudo snap install lxd sudo snap install yq curl -o lxd-initrd-img.tar.gz https://storage.googleapis.com/snapd-spread-core/lxd/lxd-spread-initrd22-img.tar.gz -lxc image import lxd-initrd-img.tar.gz --alias ucspread22 -lxc image show ucspread22 > temp.profile -yq e '.properties.aliases = "ucspread22,amd64"' -i ./temp.profile +lxc image import lxd-initrd-img.tar.gz --alias ucspread24 +lxc image show ucspread24 > temp.profile +yq e '.properties.aliases = "ucspread24,amd64"' -i ./temp.profile yq e '.properties.remote = "images"' -i ./temp.profile -cat ./temp.profile | lxc image edit ucspread22 +cat ./temp.profile | lxc image edit ucspread24 rm ./temp.profile ./lxd-initrd-img.tar.gz ``` 2. Import the LXD coreinitrd test profile. Make sure your working directory is the root of this repository. @@ -106,7 +106,7 @@ spread lxd-nested ## Getting a debug shell in initrd Getting a debug shell in initrd is very simple: -1. Boot your UC22 image on your RPi +1. Boot your UC24 image on your RPi 2. Access to it via SSH 3. Edit your kernel commandline: diff --git a/spread.yaml b/spread.yaml index 56d7ccc2..4705b5ba 100644 --- a/spread.yaml +++ b/spread.yaml @@ -29,7 +29,7 @@ backends: # uc22 with less RAM memory: 4G systems: - - ubuntu-22.04-64: + - ubuntu-24.04-64: username: ubuntu password: ubuntu @@ -37,8 +37,8 @@ backends: type: lxd container-profiles: coreinitrd systems: - - ubuntu-22.04: - image: ucspread22 + - ubuntu-24.04: + image: ucspread24 path: /home/core-initrd diff --git a/tests/lib/nested.sh b/tests/lib/nested.sh index 2259ab5e..a07daf6c 100644 --- a/tests/lib/nested.sh +++ b/tests/lib/nested.sh @@ -3,7 +3,7 @@ WORK_DIR="${WORK_DIR:-/tmp/work-dir}" SSH_PORT=${SSH_PORT:-8022} MON_PORT=${MON_PORT:-8888} -IMAGE_FILE="${WORK_DIR}/ubuntu-core-22.img" +IMAGE_FILE="${WORK_DIR}/ubuntu-core-24.img" execute_remote(){ sshpass -p ubuntu ssh -p "$SSH_PORT" -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@localhost "$*" diff --git a/tests/lib/prepare-uc.sh b/tests/lib/prepare-uc.sh index fa6df6c1..bc9d6b52 100755 --- a/tests/lib/prepare-uc.sh +++ b/tests/lib/prepare-uc.sh @@ -61,8 +61,8 @@ else mv "pc-gadget.artifact" "upstream-pc-gadget.snap" fi -# finally build the uc22 image -build_core22_image +# finally build the uc24 image +build_core24_image # setup some data we will inject into ubuntu-seed partition of the image above # that snapd.spread-tests-run-mode-tweaks.service will ingest diff --git a/tests/lib/prepare-utils.sh b/tests/lib/prepare-utils.sh index 6e6c45b2..f6ff8414 100644 --- a/tests/lib/prepare-utils.sh +++ b/tests/lib/prepare-utils.sh @@ -149,13 +149,21 @@ download_core_initrd_snaps() { local snap_branch="$1" # get the model - curl -o ubuntu-core-amd64-dangerous.model https://raw.githubusercontent.com/snapcore/models/master/ubuntu-core-22-amd64-dangerous.model + # FIXME: add the model there + #curl -o ubuntu-core-amd64-dangerous.model https://raw.githubusercontent.com/snapcore/models/master/ubuntu-core-24-amd64-dangerous.model + curl -o ubuntu-core-amd64-dangerous.model https://raw.githubusercontent.com/snapcore/core-base/main/ubuntu-core-24-amd64-dangerous.model # download neccessary images + # FIXME: switch to 24/ channel snap download pc-kernel --channel=22/${snap_branch} --basename=upstream-pc-kernel + # FIXME: switch to 24/ channel snap download pc --channel=22/${snap_branch} --basename=upstream-pc-gadget + unsquashfs -d upstream-pc-gadget upstream-pc-gadget.snap + rm upstream-pc-gadget.snap + sed -i "s/^base: core22$/base: core24/" upstream-pc-gadget/meta/snap.yaml + snap pack --filename=upstream-pc-gadget.snap upstream-pc-gadget snap download snapd --channel=${snap_branch} --basename=upstream-snapd - snap download core22 --channel=${snap_branch} --basename=upstream-core22 + snap download core24 --channel=${snap_branch} --basename=upstream-core24 } build_core_initrd() { @@ -339,10 +347,10 @@ EOF rm -r $snapddir } -build_core22_image() { +build_core24_image() { ubuntu-image snap \ -i 8G \ - --snap upstream-core22.snap \ + --snap upstream-core24.snap \ --snap upstream-snapd.snap \ --snap upstream-pc-kernel.snap \ --snap upstream-pc-gadget.snap \ diff --git a/tests/spread/build/build-initrd/task.yaml b/tests/spread/build/build-initrd/task.yaml index a4598be5..78a33833 100644 --- a/tests/spread/build/build-initrd/task.yaml +++ b/tests/spread/build/build-initrd/task.yaml @@ -12,8 +12,9 @@ prepare: | install_core_initrd_deps "$PROJECT_PATH" # download pc-kernel and pc gadget + # FIXME: switch to 24 channel when available snap download pc-kernel --channel=22/${SNAP_BRANCH} --basename=upstream-pc-kernel - snap download pc --channel=22/${SNAP_BRANCH} --basename=upstream-pc-gadget + snap download pc --channel=24/${SNAP_BRANCH} --basename=upstream-pc-gadget execute: | # for various utilities diff --git a/tests/spread/ci/build-lxd/task.yaml b/tests/spread/ci/build-lxd/task.yaml index 94d5ced0..81621bff 100644 --- a/tests/spread/ci/build-lxd/task.yaml +++ b/tests/spread/ci/build-lxd/task.yaml @@ -3,7 +3,7 @@ manual: true execute: | INSTANCE_NAME=spread-test - IMAGE_NAME=lxd-spread-initrd22-img + IMAGE_NAME=lxd-spread-initrd24-img # be in project folder cd $PROJECT_PATH @@ -17,7 +17,7 @@ execute: | gcloud auth activate-service-account --key-file="./sa.json" # launch the new lxc instance from an ubuntu 22.04 base - lxc launch images:ubuntu/jammy $INSTANCE_NAME + lxc launch images:ubuntu/mantic $INSTANCE_NAME # wait a few seconds before proceeding, otherwise we are going to have issues # with the container (systemd) not being ready yet, and then the rest of @@ -38,8 +38,8 @@ execute: | lxc stop $INSTANCE_NAME # make a tarball out of the container image and delete the container - lxc publish $INSTANCE_NAME --alias ucspread22 - lxc image export ucspread22 ./$IMAGE_NAME + lxc publish $INSTANCE_NAME --alias ucspread24 + lxc image export ucspread24 ./$IMAGE_NAME # upload the image file as https://storage.googleapis.com/snapd-spread-core/lxd/$IMAGE_NAME.tar.gz gsutil -o GSUtil:parallel_composite_upload_threshold=2000M cp "./$IMAGE_NAME.tar.gz" "gs://snapd-spread-core/lxd/$IMAGE_NAME.tar.gz" diff --git a/tests/spread/main/nested/task.yaml b/tests/spread/main/nested/task.yaml index 232b1321..2dc77587 100644 --- a/tests/spread/main/nested/task.yaml +++ b/tests/spread/main/nested/task.yaml @@ -4,7 +4,7 @@ prepare: | # for various utilities . "$TESTSLIB/nested.sh" - # Start the nested UC22 VM + # Start the nested UC24 VM start_nested_core_vm_unit # At this point we are able to SSH to the nested VM, so things probably worked