refactor(ops/pipelines): Move 🦆 logic into static pipeline

This simplifies the fallback logic used in case of Nix evaluation
failure and makes it so that the evaluation step itself is the one
that is marked as failed in Buildkite.

This is possible because the pipeline upload command will insert new
steps at the point where it runs in the pipeline, and not later.

Change-Id: I870534c004ebc457a1602623c4e5f9c0c68e28fc
This commit is contained in:
Vincent Ambo 2021-12-10 10:10:02 +03:00 committed by tazjin
parent 9ea4d55d81
commit e4231c9816
3 changed files with 37 additions and 49 deletions

View file

@ -77,40 +77,6 @@ let
# Simultaneously run protobuf checks
protoCheck
# Wait for all previous checks to complete
({
wait = null;
continue_on_failure = true;
})
# Wait for all steps to complete, then exit with success or
# failure depending on whether any other steps failed.
#
# This information is checked by querying the Buildkite GraphQL
# API and fetching the count of failed steps.
#
# This step must be :duck:! (yes, really!)
({
command = let duck = pkgs.writeShellScript "duck" ''
set -ueo pipefail
readonly FAILED_JOBS=$(${pkgs.curl}/bin/curl 'https://graphql.buildkite.com/v1' \
--silent \
-H "Authorization: Bearer $(cat /etc/secrets/buildkite-besadii)" \
-d "{\"query\": \"query BuildStatusQuery { build(uuid: \\\"$BUILDKITE_BUILD_ID\\\") { jobs(passed: false) { count } } }\"}" | \
${pkgs.jq}/bin/jq -r '.data.build.jobs.count')
echo "$FAILED_JOBS build jobs failed."
if (( $FAILED_JOBS > 0 )); then
exit 1
fi
''; in "${duck}";
label = ":duck:";
key = ":duck:";
})
# After duck, on success, create a gcroot if the build branch is
# canon.
#