Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
add buildkite job to run check-hydra.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
disassembler committed Nov 28, 2018
1 parent b3ef300 commit 17b7554
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ steps:
- "./check-brittany"
agents:
system: x86_64-linux

- label: 'release.nix'
command: 'scripts/buildkite/check-hydra.sh'
agents:
system: x86_64-linux
2 changes: 1 addition & 1 deletion pkgs.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let
nixpkgs = builtins.fetchTarball "https://github.com/nixos/nixpkgs/archive/38db6fdfb9672a0206a2042447132094bc05a5ea.tar.gz";
nixpkgs = builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/38db6fdfb9672a0206a2042447132094bc05a5ea.tar.gz";
in
import nixpkgs {
config = {
Expand Down
30 changes: 30 additions & 0 deletions scripts/buildkite/check-hydra.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env nix-shell
#!nix-shell -p jq hydra -i bash -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/09195057114a0a8d112c847a9a8f52957420857d.tar.gz

echo '~~~ Evaluating release.nix'
command time --format '%e' -o eval-time.txt \
hydra-eval-jobs \
--option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" \
-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

0 comments on commit 17b7554

Please sign in to comment.