on e94de40 help sign in
haskell.nix/scripts/check-hydra.nix
41 lines 1.3 kB history raw
1{ stdenv, writeScript, coreutils, time, gnutar, gzip, hydra-migration, jq }:
3with stdenv.lib;
5writeScript "check-hydra.sh" ''
6 #!${stdenv.shell}
8 set -euo pipefail
10 export PATH="${makeBinPath [ coreutils time gnutar gzip hydra-migration jq ]}"
12 echo '~~~ Evaluating release.nix with --arg ifdLevel '$1
13 command time --format '%e' -o eval-time.txt \
14 hydra-eval-jobs \
15 --option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" \
16 --arg supportedSystems '[ builtins.currentSystem ]' \
17 --arg ifdLevel $1 \
18 -I . release.nix > eval.json
19 EVAL_EXIT_CODE="$?"
20 if [ "$EVAL_EXIT_CODE" != 0 ]
21 then
22 rm eval.json eval-time.txt
23 echo -e "\\e[31;1mERROR: Failed to evaluate release.nix\\e[0m"
24 exit 1
25 fi
26 EVAL_TIME=$(cat eval-time.txt)
27 jq . < eval.json
28 ERRORS=$(jq -r 'map_values(.error)|to_entries[]|select(.value)|@text "\(.key): \(.value)"' < eval.json)
29 NUM_ERRORS=$(jq -r '[ map_values(.error)|to_entries[]|select(.value) ] |length' < eval.json)
30 rm eval.json eval-time.txt
32 if [ "$NUM_ERRORS" != 0 ]
33 then
34 echo -e "\\e[31;1mERROR: evaluation completed in $EVAL_TIME seconds with $NUM_ERRORS errors\\e[0m"
35 echo "$ERRORS"
36 exit 1
37 else
38 echo -e "\\e[32;1mOK: evaluation completed in $EVAL_TIME seconds with no errors\\e[0m"
39 exit 0
40 fi
41''