From ccd1d7b2df17a9b1b521954dfe9456385fd425c0 Mon Sep 17 00:00:00 2001 From: Valentin David Date: Wed, 23 Nov 2022 10:11:01 +0100 Subject: [PATCH 1/4] Now build core24 --- .github/workflows/tests.yaml | 23 ++++++++++--------- .travis.yml | 2 +- Makefile | 8 ++++--- README.md | 18 +++++++-------- hook-tests/600-no-debian.chroot | 4 ++-- hooks/000-provide-uids-gids.chroot | 6 ----- hooks/001-extra-packages.chroot | 17 ++++++++------ hooks/018-set-os-release.chroot | 6 ++--- hooks/024-configure-bootchart.chroot | 2 +- hooks/900-cleanup-etc-var.chroot | 4 ++-- hooks/901-cleanup-timesyncd.chroot | 2 +- snapcraft.yaml | 17 +++++++------- spread.yaml | 14 +++++------ tests/lib/prepare-uc.sh | 12 +++++----- tests/lib/prepare-utils.sh | 14 +++++------ tests/spread/build/build-snap/task.yaml | 8 +++---- tests/spread/ci/build-image/task.yaml | 7 +++--- .../{core22.lxdprofile => core24.lxdprofile} | 4 ++-- 18 files changed, 84 insertions(+), 84 deletions(-) rename tests/spread/{core22.lxdprofile => core24.lxdprofile} (98%) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 78878789..8b0443ed 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -29,7 +29,7 @@ jobs: - uses: actions/upload-artifact@v2 with: name: core-snap - path: "${{ github.workspace }}/core22.artifact" + path: "${{ github.workspace }}/core24.artifact" - name: Discard spread workers if: always() @@ -52,7 +52,7 @@ jobs: - uses: actions/download-artifact@v2 with: name: core-snap - path: "${{ github.workspace }}/core22.artifact" + path: "${{ github.workspace }}/core24.artifact" - name: Run tests run: | @@ -92,29 +92,30 @@ jobs: - name: Build image working-directory: '${{ github.workspace }}' run: | + PROJECT_PATH=core-base . "core-base/tests/lib/prepare-utils.sh" echo "************* INSTALLING DEPS *************" - install_core22_deps + install_base_deps echo "************* DOWNLOADING SNAPS *************" - download_core22_snaps 'edge' + download_core24_snaps 'edge' echo "************* WRITING CLOUD-INIT CONFIG *************" - prepare_core22_cloudinit + prepare_base_cloudinit - echo "************* BUILDING CORE22 IMAGE *************" + echo "************* BUILDING CORE24 IMAGE *************" uc_snap="$(get_core_snap_name)" - mv core22.artifact "$uc_snap" - build_core22_image + mv core24.artifact "$uc_snap" + build_base_image - echo "************* STARTING CORE22 VM *************" + echo "************* STARTING CORE24 VM *************" start_snapd_core_vm '${{ github.workspace }}' cd snapd - + # add any test suites that should be tested here - SPREAD_EXTERNAL_ADDRESS=localhost:8022 spread external:ubuntu-core-22-64:tests/smoke/ + SPREAD_EXTERNAL_ADDRESS=localhost:8022 spread external:ubuntu-core-24-64:tests/smoke/ - name: Discard spread workers if: always() diff --git a/.travis.yml b/.travis.yml index 947f8e33..b0c53830 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,5 +23,5 @@ install: script: - sg lxd 'snapcraft' - - sudo unsquashfs -d prime core22*.snap + - sudo unsquashfs -d prime core24*.snap - make test diff --git a/Makefile b/Makefile index 7664b56b..1df0b694 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ # dir that contans the filesystem that must be checked TESTDIR ?= "prime/" +SNAP_NAME=core24 +BUILDDIR=/build/$(SNAP_NAME) .PHONY: all all: check @@ -46,9 +48,9 @@ install: touch $(DESTDIR)/usr/lib/clock-epoch # only generate manifest and dpkg.yaml files for lp build - if [ -e /build/core22 ]; then \ - /bin/cp $(DESTDIR)/usr/share/snappy/dpkg.list /build/core22/core22-$$(date +%Y%m%d%H%M)_$(DPKG_ARCH).manifest; \ - /bin/cp $(DESTDIR)/usr/share/snappy/dpkg.yaml /build/core22/core22-$$(date +%Y%m%d%H%M)_$(DPKG_ARCH).dpkg.yaml; \ + if [ -e $(BUILDDIR) ]; then \ + /bin/cp $(DESTDIR)/usr/share/snappy/dpkg.list $(BUILDDIR)/$(SNAP_NAME)-$$(date +%Y%m%d%H%M)_$(DPKG_ARCH).manifest; \ + /bin/cp $(DESTDIR)/usr/share/snappy/dpkg.yaml $(BUILDDIR)/$(SNAP_NAME)-$$(date +%Y%m%d%H%M)_$(DPKG_ARCH).dpkg.yaml; \ fi; .PHONY: check diff --git a/README.md b/README.md index fcbfc91b..4237b438 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Core22 snap for snapd & Ubuntu Core +# Core24 snap for snapd & Ubuntu Core -This is a base snap for snapd & Ubuntu Core that is based on Ubuntu 22.04 +This is a base snap for snapd & Ubuntu Core that is based on Ubuntu 22.10 (will be base on 24.04) # Building locally @@ -58,7 +58,7 @@ mv autopkgtest-focal-amd64.img ubuntu-20.04-64.img ``` 4. Now you are ready to run spread tests with the qemu backend ``` -cd ~/core22 # or wherever you checked out this repository +cd ~/core24 # or wherever you checked out this repository spread qemu-nested ``` @@ -74,18 +74,18 @@ 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-core22-img.tar.gz https://storage.googleapis.com/snapd-spread-core/lxd/lxd-spread-core22-img.tar.gz -lxc image import lxd-core22-img.tar.gz --alias ucspread22 +curl -o lxd-core24-img.tar.gz https://storage.googleapis.com/snapd-spread-core/lxd/lxd-spread-core24-img.tar.gz +lxc image import lxd-core24-img.tar.gz --alias ucspread22 lxc image show ucspread22 > temp.profile yq e '.properties.aliases = "ucspread22,amd64"' -i ./temp.profile yq e '.properties.remote = "images"' -i ./temp.profile cat ./temp.profile | lxc image edit ucspread22 -rm ./temp.profile ./lxd-core22-img.tar.gz +rm ./temp.profile ./lxd-core24-img.tar.gz ``` -2. Import the LXD core22 test profile. Make sure your working directory is the root of this repository. +2. Import the LXD core24 test profile. Make sure your working directory is the root of this repository. ``` -lxc profile create core22 -cat tests/spread/core22.lxdprofile | lxc profile edit core22 +lxc profile create core24 +cat tests/spread/core24.lxdprofile | lxc profile edit core24 ``` 3. Set environment variable to enable KVM acceleration for the nested qemu instance ``` diff --git a/hook-tests/600-no-debian.chroot b/hook-tests/600-no-debian.chroot index 1bb60779..30c16897 100755 --- a/hook-tests/600-no-debian.chroot +++ b/hook-tests/600-no-debian.chroot @@ -13,7 +13,7 @@ then else echo "Error! PPA section of dpkg.yaml not as expected." echo "If that is intentional, please update the ppa_section content in the" - echo "test file: core22/hook-tests/600-no-debian.test." + echo "test file: hook-tests/600-no-debian.test." exit 1 fi @@ -25,7 +25,7 @@ do echo "Couldn't find package: $pkg in $FILE." echo "If that is intentional, please update the packages_section " echo "content in the " - echo "test file: core22/hook-tests/600-no-debian.test." + echo "test file: hook-tests/600-no-debian.test." exit 1 fi done diff --git a/hooks/000-provide-uids-gids.chroot b/hooks/000-provide-uids-gids.chroot index ce6080e6..2ed6cd82 100755 --- a/hooks/000-provide-uids-gids.chroot +++ b/hooks/000-provide-uids-gids.chroot @@ -28,7 +28,6 @@ www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin -gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin _apt:x:100:65534::/nonexistent:/usr/sbin/nologin EOF @@ -65,7 +64,6 @@ operator:x:37: list:x:38: irc:x:39: src:x:40: -gnats:x:41: shadow:x:42: utmp:x:43: video:x:44: @@ -105,7 +103,6 @@ www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin -gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin messagebus:x:100:103::/var/run/dbus:/bin/false snappypkg:x:101:104:Reserved:/nonexistent:/bin/false @@ -139,7 +136,6 @@ www-data:*:16329:0:99999:7::: backup:*:16329:0:99999:7::: list:*:16329:0:99999:7::: irc:*:16329:0:99999:7::: -gnats:*:16329:0:99999:7::: nobody:*:16329:0:99999:7::: messagebus:*:16413:0:99999:7::: snappypkg:*:16413:0:99999:7::: @@ -186,7 +182,6 @@ operator:x:37: list:x:38: irc:x:39: src:x:40: -gnats:x:41: shadow:x:42: utmp:x:43: video:x:44: @@ -248,7 +243,6 @@ operator:*:: list:*:: irc:*:: src:*:: -gnats:*:: shadow:*:: utmp:*:: video:*:: diff --git a/hooks/001-extra-packages.chroot b/hooks/001-extra-packages.chroot index 0ab9471c..8fc3b09e 100755 --- a/hooks/001-extra-packages.chroot +++ b/hooks/001-extra-packages.chroot @@ -23,13 +23,15 @@ mkdir -p /var/log/journal apt update apt install --no-install-recommends -y ca-certificates -# shellcheck disable=SC1091 -CODENAME=$(. /etc/os-release; echo "$UBUNTU_CODENAME") -# enable the ucdev PPA with additional packages to build bases -echo "deb https://ppa.launchpadcontent.net/ucdev/base-ppa/ubuntu/ $CODENAME main" \ - > /etc/apt/sources.list.d/ubuntu-image.list - -cat >/etc/apt/trusted.gpg.d/ucdev-base-ppa.asc <<'EOF' +# TODO: There is no PPA for kinetic yet. +if false; then + # shellcheck disable=SC1091 + CODENAME=$(. /etc/os-release; echo "$UBUNTU_CODENAME") + # enable the ucdev PPA with additional packages to build bases + echo "deb https://ppa.launchpadcontent.net/ucdev/base-ppa/ubuntu/ $CODENAME main" \ + > /etc/apt/sources.list.d/ubuntu-image.list + + cat >/etc/apt/trusted.gpg.d/ucdev-base-ppa.asc <<'EOF' -----BEGIN PGP PUBLIC KEY BLOCK----- mQINBGLW9dwBEAC7UJatAWOrUgfJlElkTUfmjL6JCTONYGy1Qzrw65YgzjdJGvXQ @@ -59,6 +61,7 @@ jdVw2j6diVag+TBwXXX/pBCBMFvUHJph5afKSfnrIuDk6yzCV8TaGAer =L0hK -----END PGP PUBLIC KEY BLOCK----- EOF +fi cat </etc/apt/sources.list.d/local-packages.list deb [trusted=yes] file:/install-data/local-debs ./ diff --git a/hooks/018-set-os-release.chroot b/hooks/018-set-os-release.chroot index 48751f29..6b7b74be 100755 --- a/hooks/018-set-os-release.chroot +++ b/hooks/018-set-os-release.chroot @@ -2,10 +2,10 @@ cat >/usr/lib/os-release< Date: Thu, 24 Nov 2022 14:13:32 +0100 Subject: [PATCH 2/4] Add model for core24 --- tests/lib/prepare-utils.sh | 4 ++- ubuntu-core-24-amd64-dangerous.model | 40 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 ubuntu-core-24-amd64-dangerous.model diff --git a/tests/lib/prepare-utils.sh b/tests/lib/prepare-utils.sh index 0031c8af..50080882 100644 --- a/tests/lib/prepare-utils.sh +++ b/tests/lib/prepare-utils.sh @@ -141,7 +141,9 @@ download_core24_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 + # TODO: Add the model on the repository + #curl -o ubuntu-core-amd64-dangerous.model https://raw.githubusercontent.com/snapcore/models/master/ubuntu-core-24-amd64-dangerous.model + cp "${PROJECT_PATH}/ubuntu-core-24-amd64-dangerous.model" ubuntu-core-amd64-dangerous.model # download neccessary images snap download pc-kernel --channel=22/${snap_branch} --basename=upstream-pc-kernel diff --git a/ubuntu-core-24-amd64-dangerous.model b/ubuntu-core-24-amd64-dangerous.model new file mode 100644 index 00000000..d643cf3a --- /dev/null +++ b/ubuntu-core-24-amd64-dangerous.model @@ -0,0 +1,40 @@ +type: model +authority-id: pxF0fchmU682PEmmay31jjyCHgvscRcj +series: 16 +brand-id: pxF0fchmU682PEmmay31jjyCHgvscRcj +model: ubuntu-core-22-amd64-dangerous +architecture: amd64 +base: core24 +grade: dangerous +snaps: + - + default-channel: 22/edge + id: UqFziVZDHLSyO3TqSWgNBoAdHbLI4dAH + name: pc + type: gadget + - + default-channel: 22/edge + id: pYVQrBcKmBa0mZ4CCN7ExT6jH8rY1hza + name: pc-kernel + type: kernel + - + name: core24 + type: base + - + default-channel: latest/edge + id: PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4 + name: snapd + type: snapd +timestamp: 2022-11-24T13:08:57+00:00 +sign-key-sha3-384: 2bzuyMIlgATtieQPbKSEb-ANrLeJ0bqCeHjLo9qUZdp9_oTNEdYw3GmgW8cMQeuW + +AcLBcwQAAQoAHRYhBLWbV9CJDi3E1AxkGifbKb17Yvw3BQJjf3UZAAoJECfbKb17Yvw3EMQP/2oR +kKgwe7H9zp3WUbSTP8hGBmk7KaSDTxWz7wv5DZLygYdNiNtia5yYQ3clABiIjBQXgGO8BCFGx1G8 +PGcQ1nFdloAoH4e8EkTg5VNS/nQQm44Px4swaNGijnd7btowqKDqp+GlBTVUpsUUBJu+0KCUd1Hn +x2QGYYwoTtLCxkFMSwjZ8o5V9vwE+tlT4PWse2+l7LnRoIl382z6iroJfnCkpyu24lTbYxS2xi7K +drcMBHGRscP/Fik5EPKMte4LJYwVjU5Meg0mW+OfG7RXjlms3NYMWVxRbfie9SaUa75gcKUhR7yd +hFO/CsPzCEBDvn6/SBzvB18XKCkCqiCeE6KZZY16ux9gNMrpXCHp80FgPoqop38LmUD/o8Y/8c70 +8akEItGdM2RvUiRqw3jsQitVUpQtQkHP3NPlWHPqWdh6xoOExo7HVGAUi+g/92anNUvs7+ba8t2G +GTSyBxEj2uAvc1MoMYh8QhDUZlZMx4bxY3yl68sFgZIjDS8ns9dK8bt+yWyZQrBb+3GOY1dxk41C +B8M4QRUn6FUekKchxv4wx/dzO/+kM1RtqwKMdpE/DCSI58Xgji7qNSmdFGd8Vl1Upy0ELT2QPH8y +hMiPkq7lnUuM2nyjNBRoCM8rYVqCdxp4b6CkM7HRImXCdxk2f5XkEvaPCtHeUmoA9I9SXQjo From fb6ec403d3f9bc4ddc1e4f7f2e017cd31be05fc1 Mon Sep 17 00:00:00 2001 From: Valentin David Date: Thu, 24 Nov 2022 15:21:22 +0100 Subject: [PATCH 3/4] Patch pc gadget pc gadget is not yet available for core24 branch --- tests/lib/prepare-utils.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/lib/prepare-utils.sh b/tests/lib/prepare-utils.sh index 50080882..0f99d9d7 100644 --- a/tests/lib/prepare-utils.sh +++ b/tests/lib/prepare-utils.sh @@ -148,6 +148,13 @@ download_core24_snaps() { # download neccessary images snap download pc-kernel --channel=22/${snap_branch} --basename=upstream-pc-kernel snap download pc --channel=22/${snap_branch} --basename=upstream-pc-gadget + # TODO: remove this when pc gadget is available for core24 + unsquashfs -d upstream-pc-gadget upstream-pc-gadget.snap + rm upstream-pc-gadget.snap + sed -i 's/core22/core24/g' upstream-pc-gadget/meta/snap.yaml + snap pack upstream-pc-gadget --filename=upstream-pc-gadget.snap + rm -rf upstream-pc-gadget + # END OF TODO snap download snapd --channel=${snap_branch} --basename=upstream-snapd } From 4ecf8e36aa940d56c4748f76cdc5695733e12ec6 Mon Sep 17 00:00:00 2001 From: Valentin David Date: Fri, 25 Nov 2022 11:57:16 +0100 Subject: [PATCH 4/4] Add missing systemd-resolved --- hooks/001-extra-packages.chroot | 1 + 1 file changed, 1 insertion(+) diff --git a/hooks/001-extra-packages.chroot b/hooks/001-extra-packages.chroot index 8fc3b09e..616aa1ea 100755 --- a/hooks/001-extra-packages.chroot +++ b/hooks/001-extra-packages.chroot @@ -116,6 +116,7 @@ PACKAGES=( systemd systemd-sysv systemd-timesyncd + systemd-resolved tzdata udev vim-tiny