]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
ci: Simplify checks
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 11 May 2023 11:53:15 +0000 (13:53 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 11 May 2023 11:53:15 +0000 (13:53 +0200)
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.

.github/mkosi.extra/usr/lib/systemd/mkosi-check-and-shutdown.sh
.github/mkosi.extra/usr/lib/systemd/system/mkosi-check-and-shutdown.service
.github/workflows/ci.yml

index 7b36998d521cdb2a26acc6a1bd9fb3817288751a..4ebd3aac374a143aa1365359d89d1e6120487277 100755 (executable)
@@ -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
index f09132dd675a888cf514e38acf00dba42f532f32..31304d92d931021de2e291d3f640ae5919c6bd73 100644 (file)
@@ -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
index fcf368800e7e53d96ffd97f01fffbfb654e0e1fc..f6e0b762b204b6c90ce75233518d0118c6812bce 100644 (file)
@@ -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; }"