ci: wait for a running activation before switching a host
All checks were successful
nixos / nixos (push) Successful in 1m8s
All checks were successful
nixos / nixos (push) Successful in 1m8s
nixos-rebuild activates through a transient unit with a fixed name. An activation that started a long one-shot job waits for it; a deploy in the meantime failed with "did you forget --ask-sudo-password?", twice today. Wait up to 20 minutes for the earlier activation to finish. Assisted-by: Claude:opus-5-5
This commit is contained in:
parent
b8cbf0fbf5
commit
c6431760bd
1 changed files with 8 additions and 0 deletions
|
|
@ -81,6 +81,14 @@ jobs:
|
|||
continue
|
||||
fi
|
||||
echo "== $host"
|
||||
# nixos-rebuild runs the activation as a fixed transient unit;
|
||||
# while an earlier one still runs (it waits for one-shot units
|
||||
# it started), a new switch fails with a misleading sudo error
|
||||
for i in $(seq 1 120); do
|
||||
nix develop -c ssh "$host" 'systemctl is-active -q nixos-rebuild-switch-to-configuration.service' || break
|
||||
echo "$host: an earlier activation is still running, waiting"
|
||||
sleep 10
|
||||
done
|
||||
nix develop -c nixos-rebuild switch --flake ".#$host" \
|
||||
--target-host "$host" --build-host "$host" --sudo
|
||||
done
|
||||
|
|
|
|||
Loading…
Reference in a new issue