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

[DEVOPS-1100] Catch errors in check-hydra.sh and exit appropriately #3762

Merged
merged 2 commits into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ let
# Backwards compat for iohk-ops.
makeFaucetFrontend = self.cardano-sl-faucet-frontend;

####################################################################
# Report Server

cardano-report-server-static = self.justStaticExecutablesGitRev self.cardano-report-server;


####################################################################
# Daedalus wallet
Expand Down Expand Up @@ -265,7 +270,6 @@ let
cardano-sl-crypto
cardano-sl-db
cardano-sl-explorer
cardano-sl-explorer-frontend
cardano-sl-explorer-static
cardano-sl-generator
cardano-sl-infra
Expand All @@ -276,9 +280,10 @@ let
cardano-sl-util
cardano-sl-wallet
cardano-sl-wallet-new
cardano-sl-x509
cardano-report-server
cardano-report-server-static; }
cardano-sl-x509;
inherit (self.haskellPackages)
cardano-report-server; }

);

in
Expand Down
27 changes: 25 additions & 2 deletions scripts/ci/check-hydra.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
#!/bin/sh
#!/usr/bin/env nix-shell
#!nix-shell -p jq -i bash

nix-build https://github.com/nixos/nixpkgs/archive/4fb198892d298452023ab176e7067da58d30772e.tar.gz -A hydra
echo '~~~ Evaluating release.nix'
./result/bin/hydra-eval-jobs -I . release.nix
command time --format '%e' -o eval-time.txt ./result/bin/hydra-eval-jobs -I . release.nix > eval.json
EVAL_EXIT_CODE="$?"
if [ "$EVAL_EXIT_CODE" != 0 ]
then
rm eval.json eval-time.txt
echo -e "\\e[31;1mERROR: Failed to evaluate release.nix\\e[0m"
exit 1
fi
EVAL_TIME=$(cat eval-time.txt)
jq . < eval.json
ERRORS=$(jq -r 'map_values(.error)|to_entries[]|select(.value)|@text "\(.key): \(.value)"' < eval.json)
NUM_ERRORS=$(jq -r '[ map_values(.error)|to_entries[]|select(.value) ] |length' < eval.json)
rm eval.json eval-time.txt

if [ "$NUM_ERRORS" != 0 ]
then
echo -e "\\e[31;1mERROR: evaluation completed in $EVAL_TIME seconds with $NUM_ERRORS errors\\e[0m"
echo "$ERRORS"
exit 1
else
echo -e "\\e[32;1mOK: evaluation completed in $EVAL_TIME seconds with no errors\\e[0m"
exit 0
fi