From: Daan De Meyer Date: Thu, 11 May 2023 11:53:15 +0000 (+0200) Subject: ci: Simplify checks X-Git-Tag: v15~165^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31147fa979ca5cffc7091de16ae232a9fbd6d54d;p=thirdparty%2Fmkosi.git ci: Simplify checks Instead of mounting the filesystem and checking the contents of the failed-services file, let's just shut down the machine with a non-zero exit status if there are failed services. This works for both nspawn and qemu now that we have the vsock notify socket set up. --- diff --git a/.github/mkosi.extra/usr/lib/systemd/mkosi-check-and-shutdown.sh b/.github/mkosi.extra/usr/lib/systemd/mkosi-check-and-shutdown.sh index 7b36998d5..4ebd3aac3 100755 --- a/.github/mkosi.extra/usr/lib/systemd/mkosi-check-and-shutdown.sh +++ b/.github/mkosi.extra/usr/lib/systemd/mkosi-check-and-shutdown.sh @@ -6,5 +6,3 @@ systemctl --failed --no-legend | tee /failed-services # Exit with non-zero EC if the /failed-services file is not empty (we have -e set) [[ ! -s /failed-services ]] - -: >/testok diff --git a/.github/mkosi.extra/usr/lib/systemd/system/mkosi-check-and-shutdown.service b/.github/mkosi.extra/usr/lib/systemd/system/mkosi-check-and-shutdown.service index f09132dd6..31304d92d 100644 --- a/.github/mkosi.extra/usr/lib/systemd/system/mkosi-check-and-shutdown.service +++ b/.github/mkosi.extra/usr/lib/systemd/system/mkosi-check-and-shutdown.service @@ -3,11 +3,9 @@ Description=Check if any service failed and then shut down the machine After=multi-user.target network-online.target Requires=multi-user.target -OnFailure=poweroff.target -OnFailureJobMode=replace-irreversibly +SuccessAction=exit +FailureAction=exit [Service] Type=oneshot -ExecStartPre=rm -f /failed-services /testok ExecStart=/usr/lib/systemd/mkosi-check-and-shutdown.sh -ExecStartPost=systemctl poweroff --no-block diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fcf368800..f6e0b762b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -197,14 +197,6 @@ jobs: if: matrix.format == 'disk' || matrix.format == 'directory' run: sudo python3 -m mkosi boot - - name: Check ${{ matrix.distro }}/${{ matrix.format }} systemd-nspawn - if: matrix.format == 'disk' || matrix.format == 'directory' - run: sudo python3 -m mkosi shell bash -c "[[ -e /testok ]] || { cat /failed-services; exit 1; }" - - name: Boot ${{ matrix.distro }}/${{ matrix.format }} UEFI if: matrix.format == 'disk' run: timeout -k 30 10m python3 -m mkosi qemu - - - name: Check ${{ matrix.distro }}/${{ matrix.format }} UEFI - if: matrix.format == 'disk' || matrix.format == 'directory' - run: sudo python3 -m mkosi shell bash -c "[[ -e /testok ]] || { cat /failed-services; exit 1; }"