Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 4aea21d

Browse files
committed
[DEVOPS-1100] Catch errors in check-hydra.sh and exit appropriately
1 parent fcc489c commit 4aea21d

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

scripts/ci/check-hydra.sh

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1-
#!/bin/sh
1+
#!/usr/bin/env nix-shell
2+
nix-shell -p jq
23

34
nix-build https://github.com/nixos/nixpkgs/archive/4fb198892d298452023ab176e7067da58d30772e.tar.gz -A hydra
45
echo '~~~ Evaluating release.nix'
5-
./result/bin/hydra-eval-jobs -I . release.nix
6+
env time --format '%e' -o eval-time.txt ./result/bin/hydra-eval-jobs -I . release.nix > eval.json
7+
EVAL_EXIT_CODE="$?"
8+
EVAL_TIME=$(cat eval-time.txt)
9+
jq -r '.' < eval.json
10+
jq -r 'map_values(.error)|to_entries[]|select(.value)|@text "\(.key): \(.value)"' < eval.json
11+
NUM_ERRORS=$(jq -r '[ map_values(.error)|to_entries[]|select(.value) ] |length' < eval.json)
12+
rm eval.json eval-time.txt
13+
14+
if [ "$NUM_ERRORS" != 0 ] || [ "$EVAL_EXIT_CODE" != 0 ]
15+
then
16+
echo "ERROR: evaluation completed in $EVAL_TIME seconds with $NUM_ERRORS errors"
17+
exit 1
18+
else
19+
echo "OK: evaluation completed in $EVAL_TIME seconds with no errors"
20+
fi

0 commit comments

Comments
 (0)