fail if any non-final build is not passed
the buildkite docs seem to be incomplete. `timed_out` is also a valid failure state, but this isn't mentioned anywhere in the rest api docs
This commit is contained in:
@@ -139,7 +139,7 @@ try:
|
||||
# failed (but not retried).
|
||||
#
|
||||
# This information is checked by querying the Buildkite REST API
|
||||
# and counting all `failed` or `canceled` steps.
|
||||
# and counting all non-`passed` steps.
|
||||
#
|
||||
# This step must be :ice_cream: (yes, really!) because the post-command
|
||||
# hook will inspect this name.
|
||||
@@ -155,7 +155,7 @@ try:
|
||||
readonly FAILED_JOBS=$(curl --silent \
|
||||
-H "Authorization: Bearer $(buildkite-agent secret get build_status_token)" \
|
||||
"https://api.buildkite.com/v2/organizations/$${BUILDKITE_ORGANIZATION_SLUG}/pipelines/$${BUILDKITE_PIPELINE_SLUG}/builds/$${BUILDKITE_BUILD_NUMBER}" \
|
||||
| jq '.jobs | map(select(.state == "failed" or .state == "canceled")) | length')
|
||||
| jq '.jobs | map(select(has("state") and .state != "passed" and .name != ":ice_cream:")) | length')
|
||||
|
||||
echo "$$FAILED_JOBS build jobs failed."
|
||||
(( $$FAILED_JOBS == 0 ))
|
||||
|
||||
Reference in New Issue
Block a user