From 007d255d870bee37db03da1875c0387598bdedde Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 22 Jan 2025 22:24:36 +0100 Subject: [PATCH 1/2] mkosi: Run two more mkosi commands with sudo Running some mkosi commands as root and other not can lead to cache invalidations with the latest version, so make sure we run everything as root after we've built the tools tree. --- .github/workflows/coverage.yml | 2 +- .github/workflows/mkosi.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index abe4bbd467..bca6bc51f5 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -148,7 +148,7 @@ jobs: sudo --preserve-env mkosi sandbox lcov --ignore-errors inconsistent,inconsistent "${lcov_args[@]}" --output-file build/test/coverage/everything.coverage-info - name: List coverage report - run: mkosi sandbox lcov --ignore-errors inconsistent,inconsistent --list build/test/coverage/everything.coverage-info + run: sudo mkosi sandbox lcov --ignore-errors inconsistent,inconsistent --list build/test/coverage/everything.coverage-info - name: Coveralls uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8 diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index 47a43c689f..c589a0c1fa 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -204,7 +204,7 @@ jobs: - name: Run integration tests run: | - if [[ "$(mkosi sandbox meson test --help)" == *"--max-lines"* ]]; then + if [[ "$(sudo mkosi sandbox meson test --help)" == *"--max-lines"* ]]; then MAX_LINES=(--max-lines 300) else MAX_LINES=() From 94558e6fc70b53bfa36707afd7e90ff1737194cf Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 22 Jan 2025 15:58:13 +0100 Subject: [PATCH 2/2] mkosi: Update to latest With the latest mkosi, mkosi takes care of making sure it is available within mkosi sandbox so we get rid of all the --preserve-env= options when we invoke mkosi sandbox with sudo as these are not required anymore. It also doesn't matter anymore if mkosi is installed in /usr on the host so we get rid of the documentation around that as well. --- .github/workflows/coverage.yml | 19 ++++++++----------- .github/workflows/mkosi.yml | 12 +++++------- docs/HACKING.md | 9 ++++----- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index bca6bc51f5..0b6c5dd98e 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -25,7 +25,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: systemd/mkosi@00db6f1a12fb04ed9f837b40ff34f82fab4d4a03 + - uses: systemd/mkosi@0df7ef3f404b211fbc8d856214929de10311ee22 # Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space # immediately, we remove the files in the background. However, we first move them to a different location @@ -83,25 +83,23 @@ jobs: run: mkosi summary - name: Build tools tree - run: sudo --preserve-env mkosi -f sandbox true + run: sudo mkosi -f sandbox true - name: Configure meson run: | - sudo --preserve-env --preserve-env=PATH \ - mkosi sandbox \ + sudo mkosi sandbox \ meson setup \ --buildtype=debugoptimized \ -Dintegration-tests=true \ build - name: Build image - run: sudo --preserve-env mkosi sandbox meson compile -C build mkosi + run: sudo mkosi sandbox meson compile -C build mkosi - name: Initial coverage report run: | - sudo --preserve-env mkdir -p build/test/coverage - sudo --preserve-env \ - mkosi sandbox \ + sudo mkdir -p build/test/coverage + sudo mkosi sandbox \ lcov \ --directory build/mkosi.builddir/arch~rolling~x86-64 \ --capture \ @@ -115,8 +113,7 @@ jobs: - name: Run integration tests run: | - sudo --preserve-env \ - mkosi sandbox \ + sudo mkosi sandbox \ meson test \ -C build \ --no-rebuild \ @@ -145,7 +142,7 @@ jobs: lcov_args+=(--add-tracefile "${file}") done < <(find build/test/coverage -name "TEST-*.coverage-info") - sudo --preserve-env mkosi sandbox lcov --ignore-errors inconsistent,inconsistent "${lcov_args[@]}" --output-file build/test/coverage/everything.coverage-info + sudo mkosi sandbox lcov --ignore-errors inconsistent,inconsistent "${lcov_args[@]}" --output-file build/test/coverage/everything.coverage-info - name: List coverage report run: sudo mkosi sandbox lcov --ignore-errors inconsistent,inconsistent --list build/test/coverage/everything.coverage-info diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index c589a0c1fa..7a4c7b6d16 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -120,7 +120,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: systemd/mkosi@00db6f1a12fb04ed9f837b40ff34f82fab4d4a03 + - uses: systemd/mkosi@0df7ef3f404b211fbc8d856214929de10311ee22 # Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space # immediately, we remove the files in the background. However, we first move them to a different location @@ -188,19 +188,18 @@ jobs: run: mkosi summary - name: Build tools tree - run: sudo --preserve-env mkosi -f sandbox true + run: sudo mkosi -f sandbox true - name: Configure meson run: | - sudo --preserve-env --preserve-env=PATH \ - mkosi sandbox \ + sudo mkosi sandbox \ meson setup \ --buildtype=debugoptimized \ -Dintegration-tests=true \ build - name: Build image - run: sudo --preserve-env mkosi sandbox meson compile -C build mkosi + run: sudo mkosi sandbox meson compile -C build mkosi - name: Run integration tests run: | @@ -210,8 +209,7 @@ jobs: MAX_LINES=() fi - sudo --preserve-env \ - mkosi sandbox \ + sudo mkosi sandbox \ env \ TEST_PREFER_QEMU=${{ matrix.vm }} \ TEST_SKIP=${{ matrix.skip }} \ diff --git a/docs/HACKING.md b/docs/HACKING.md index d302a15f28..a47065e074 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -31,11 +31,10 @@ and allows building and booting an OS image with the latest systemd installed for testing purposes. First, install `mkosi` from the -[GitHub repository](https://github.com/systemd/mkosi#running-mkosi-from-the-repository). -Note that it's not possible to use your distribution's packaged version of mkosi -as mkosi has to be installed outside of `/usr` for the following steps to work. When -installing mkosi from the github repository, make sure to symlink it to `~/.local/bin` -instead of `/usr/local/bin` if you want to add it to your `$PATH`. +[GitHub repository](https://github.com/systemd/mkosi#running-mkosi-from-the-repository) +or via your distribution's package manager. Note that systemd regularly adopts +newer mkosi features that are not in an official release yet so there's a good +chance that your distribution's packaged version of mkosi will be too old. Then, you can build and run systemd executables as follows: