removed darwin from hydra and added reboot option to upgrade script

This commit is contained in:
emily 2024-05-13 12:17:37 +02:00
parent c8c8d75da9
commit 063e13b13f
Signed by: emily
GPG key ID: F6F4C66207FCF995
2 changed files with 25 additions and 5 deletions

View file

@ -5,7 +5,7 @@
sshUser = "hydra-queue-runner";
maxJobs = 40;
speedFactor = 40;
systems = [ "x86_64-linux" "x86_64-darwin" ];
systems = [ "x86_64-linux" ];
supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
sshKey = "/var/lib/hydra/id_ed25519";
}
@ -14,7 +14,7 @@
sshUser = "build";
maxJobs = 4;
speedFactor = 8;
systems = [ "aarch64-linux" "aarch64-darwin" ];
systems = [ "aarch64-linux" ];
supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
sshKey = "/var/lib/hydra/id_ed25519";
}

View file

@ -2,6 +2,21 @@
set -euo pipefail
ALLOW_REBOOT=
while [[ $# -gt 0 ]]; do
case $1 in
--allow-reboot)
ALLOW_REBOOT=1
shift
;;
*)
echo "Unknown option $1"
exit 1
;;
esac
done
HYDRA_URL="https://hydra.kyouma.net/job/infra/nixfiles/nixosConfigurations.${HOSTNAME}/latest-finished"
NEW_STORE_PATH="$(curl --fail -s -L -H "Accept: application/json" "${HYDRA_URL}" | jq -r ".buildoutputs.out.path")"
@ -44,9 +59,14 @@ echo "Set new profile as boot target"
nixos-needsreboot
if [[ -f "/var/run/reboot-required" ]]; then
delay=$(echo -n $RANDOM | tail -c 2)
echo "Rebooting system in ${delay} Minutes"
shutdown -r +"${delay}"
if [[ -n "$ALLOW_REBOOT" ]]; then
delay=$(echo -n $RANDOM | tail -c 2)
echo "Rebooting system in ${delay} Minutes"
shutdown -r +"${delay}"
else
echo "Unattended reboot not allowed"
echo "Reboot system manually"
fi
else
echo "Activating system now"
/nix/var/nix/profiles/system/bin/switch-to-configuration switch