mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
5f64b69d23
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
28 lines
754 B
Bash
28 lines
754 B
Bash
#!/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"
|