Skip to content

Commit

Permalink
Switch to core24
Browse files Browse the repository at this point in the history
  • Loading branch information
valentindavid committed Oct 5, 2023
1 parent b3aad96 commit 55cecdb
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 29 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -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.
Expand All @@ -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:

Expand Down
6 changes: 3 additions & 3 deletions spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ backends:
# uc22 with less RAM
memory: 4G
systems:
- ubuntu-22.04-64:
- ubuntu-24.04-64:
username: ubuntu
password: ubuntu

lxd-nested:
type: lxd
container-profiles: coreinitrd
systems:
- ubuntu-22.04:
image: ucspread22
- ubuntu-24.04:
image: ucspread24

path: /home/core-initrd

Expand Down
2 changes: 1 addition & 1 deletion tests/lib/nested.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$*"
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/prepare-uc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions tests/lib/prepare-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,16 @@ 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
snap download pc --channel=22/${snap_branch} --basename=upstream-pc-gadget
snap download pc --channel=24/${snap_branch} --basename=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() {
Expand Down Expand Up @@ -339,10 +342,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 \
Expand Down
3 changes: 2 additions & 1 deletion tests/spread/build/build-initrd/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/spread/ci/build-lxd/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/spread/main/nested/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 55cecdb

Please sign in to comment.