aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2021-11-30 17:32:40 +0100
committerregnat <rg@regnat.ovh>2021-11-30 17:54:25 +0100
commit5f64b69d23bfee70d222671a7d10f2efe22b99c6 (patch)
tree163ec417d8d1262bce3706a8f3f870988416790b /scripts
parentb96164f4af4b68a91b68c59087383a4f69e7d81e (diff)
Add a github cron to check the hydra status
Add a regular github action that will check the status of the latest hydra evaluation. Things aren’t ideal right now because this job will only notify “the user who last modified the cron syntax in the workflow file” (so myself atm). But at least that’ll give a notification for failing hydra jobs
Diffstat (limited to 'scripts')
-rw-r--r--scripts/check-hydra-status.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/check-hydra-status.sh b/scripts/check-hydra-status.sh
new file mode 100644
index 000000000..c1d2d7c40
--- /dev/null
+++ b/scripts/check-hydra-status.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+# set -x
+
+
+# mapfile BUILDS_FOR_LATEST_EVAL < <(
+# curl -H 'Accept: application/json' https://hydra.nixos.org/jobset/nix/master/evals | \
+# jq -r '.evals[0].builds[] | @sh')
+BUILDS_FOR_LATEST_EVAL=$(
+curl -sS -H 'Accept: application/json' https://hydra.nixos.org/jobset/nix/master/evals | \
+ jq -r '.evals[0].builds[]')
+
+someBuildFailed=0
+
+for buildId in $BUILDS_FOR_LATEST_EVAL; do
+ buildInfo=$(curl -sS -H 'Accept: application/json' "https://hydra.nixos.org/build/$buildId")
+
+ buildStatus=$(echo "$buildInfo" | \
+ jq -r '.buildstatus')
+
+ if [[ "$buildStatus" -ne 0 ]]; then
+ someBuildFailed=1
+ echo "Job “$(echo "$buildInfo" | jq -r '.job')” failed on hydra"
+ fi
+done
+
+exit "$someBuildFailed"