From: Daan De Meyer Date: Tue, 21 Jan 2025 19:21:03 +0000 (+0100) Subject: ci: Use mkosi sandbox to run the integration tests X-Git-Tag: v25~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3402%2Fhead;p=thirdparty%2Fmkosi.git ci: Use mkosi sandbox to run the integration tests Using mkosi sandbox allows all the tools for the test logic themselves to be executed from the tools tree as well. --- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 068c532c8..13a7ff95c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -153,12 +153,9 @@ jobs: sudo mv /opt/hostedtoolcache /opt/hostedtoolcache.trash sudo systemd-run rm -rf /usr/local.trash /opt/hostedtoolcache.trash + # Make sure the latest changes from the pull request are used. - name: Install - run: | - sudo apt-get update - sudo apt-get install python3-pytest lvm2 cryptsetup-bin btrfs-progs sqop - # Make sure the latest changes from the pull request are used. - sudo ln -svf $PWD/bin/mkosi /usr/bin/mkosi + run: sudo ln -svf $PWD/bin/mkosi /usr/bin/mkosi working-directory: ./ - name: Configure @@ -171,6 +168,8 @@ jobs: KernelCommandLine=systemd.default_device_timeout_sec=180 [Build] + ToolsTree=default + ToolsTreeDistribution=${{ matrix.tools }} Environment=SYSTEMD_REPART_MKFS_OPTIONS_EROFS="--quiet" [Runtime] @@ -205,22 +204,19 @@ jobs: done - name: Build tools tree - run: | - mkosi \ - --directory "" \ - --distribution ${{ matrix.tools }} \ - --include mkosi-tools + run: sudo mkosi -f sandbox true - name: Build image - run: mkosi --distribution ${{ matrix.distro }} -f + run: sudo mkosi --distribution ${{ matrix.distro }} -f - name: Run integration tests run: | - sudo --preserve-env \ - timeout -k 30 1h python3 -m pytest \ - --tb=no \ - --capture=no \ - --verbose \ - -m integration \ - --distribution ${{ matrix.distro }} \ - tests/ + sudo mkosi sandbox \ + timeout -k 30 1h \ + python3 -m pytest \ + --tb=no \ + --capture=no \ + --verbose \ + -m integration \ + --distribution ${{ matrix.distro }} \ + tests/ diff --git a/mkosi.conf.d/40-tools/mkosi.conf b/mkosi.conf.d/40-tools/mkosi.conf new file mode 100644 index 000000000..4eef1de8c --- /dev/null +++ b/mkosi.conf.d/40-tools/mkosi.conf @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Build] +ToolsTreePackages= + gnupg + lvm2 diff --git a/mkosi.conf.d/40-tools/mkosi.conf.d/arch.conf b/mkosi.conf.d/40-tools/mkosi.conf.d/arch.conf index bde7df91a..48805ca3c 100644 --- a/mkosi.conf.d/40-tools/mkosi.conf.d/arch.conf +++ b/mkosi.conf.d/40-tools/mkosi.conf.d/arch.conf @@ -5,6 +5,8 @@ ToolsTreeDistribution=arch [Build] ToolsTreePackages= + cryptsetup mypy python-pytest ruff + sequoia-sop diff --git a/mkosi.conf.d/40-tools/mkosi.conf.d/azure-centos-fedora.conf b/mkosi.conf.d/40-tools/mkosi.conf.d/azure-centos-fedora.conf index 7a9fd493e..a49ef929d 100644 --- a/mkosi.conf.d/40-tools/mkosi.conf.d/azure-centos-fedora.conf +++ b/mkosi.conf.d/40-tools/mkosi.conf.d/azure-centos-fedora.conf @@ -7,5 +7,6 @@ ToolsTreeDistribution=|fedora [Build] ToolsTreePackages= + cryptsetup python3-mypy python3-pytest diff --git a/mkosi.conf.d/40-tools/mkosi.conf.d/debian-kali-ubuntu.conf b/mkosi.conf.d/40-tools/mkosi.conf.d/debian-kali-ubuntu.conf index 027afcf6c..85ebe3019 100644 --- a/mkosi.conf.d/40-tools/mkosi.conf.d/debian-kali-ubuntu.conf +++ b/mkosi.conf.d/40-tools/mkosi.conf.d/debian-kali-ubuntu.conf @@ -7,5 +7,8 @@ ToolsTreeDistribution=|ubuntu [Build] ToolsTreePackages= + cryptsetup-bin + fdisk mypy python3-pytest + sqop diff --git a/mkosi.conf.d/40-tools/mkosi.conf.d/fedora.conf b/mkosi.conf.d/40-tools/mkosi.conf.d/fedora.conf index 0b6bd4a5a..0ec19244c 100644 --- a/mkosi.conf.d/40-tools/mkosi.conf.d/fedora.conf +++ b/mkosi.conf.d/40-tools/mkosi.conf.d/fedora.conf @@ -6,3 +6,4 @@ ToolsTreeDistribution=fedora [Build] ToolsTreePackages= ruff + sequoia-sop diff --git a/mkosi.conf.d/40-tools/mkosi.conf.d/opensuse.conf b/mkosi.conf.d/40-tools/mkosi.conf.d/opensuse.conf index 966500e68..2a7cd1118 100644 --- a/mkosi.conf.d/40-tools/mkosi.conf.d/opensuse.conf +++ b/mkosi.conf.d/40-tools/mkosi.conf.d/opensuse.conf @@ -5,6 +5,7 @@ ToolsTreeDistribution=opensuse [Build] ToolsTreePackages= + cryptsetup grub2 # TODO: Move to default tools tree when https://bugzilla.opensuse.org/show_bug.cgi?id=1227464 is resolved. mypy python3-pytest diff --git a/tests/test_signing.py b/tests/test_signing.py index 4bcb2050e..7b8f3e804 100644 --- a/tests/test_signing.py +++ b/tests/test_signing.py @@ -14,11 +14,8 @@ pytestmark = pytest.mark.integration def test_signing_checksums_with_sop(config: ImageConfig) -> None: - if find_binary("sqop", root=config.tools) is None: - pytest.skip("Needs 'sqop' binary in tools tree PATH to perform sop tests.") - if find_binary("sqop") is None: - pytest.skip("Needs 'sqop' binary in host system PATH to perform sop tests.") + pytest.skip("Need 'sqop' binary to perform sop tests.") with tempfile.TemporaryDirectory() as path, Image(config) as image: tmp_path = Path(path)