File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- last_build_url =" https://api.buildkite.com/v2/organizations/elastic/pipelines/${BUILDKITE_PIPELINE_SLUG} /builds?branch=${BUILDKITE_BRANCH} "
3+ build_data_url =" https://api.buildkite.com/v2/organizations/elastic/pipelines/${BUILDKITE_PIPELINE_SLUG} /builds?branch=${BUILDKITE_BRANCH} "
44cancel_build_url=" https://api.buildkite.com/v2/organizations/elastic/pipelines/${BUILDKITE_PIPELINE_SLUG} /builds/${BUILDKITE_JOB_ID} /cancel"
55
66# Don't look at this build (it's running now!)
77# Don't look at the last build (it's okay if it's still running!)
88# Look three builds back instead (if this build is still running,
99# it means there's already one in the queue and we can safely cancel this one)
10- THIRD_TO_LAST_BUILD_STATE=$( curl -s -H " Authorization: Bearer ${BUILDKITE_API_TOKEN} " $last_successful_build_url | jq -r ' .[2].status' )
10+ THIRD_TO_LAST_BUILD_STATE=$( curl -s -H " Authorization: Bearer ${BUILDKITE_API_TOKEN} " $build_data_url | jq -r ' .[2].status' )
11+
12+ echo $( curl -s -H " Authorization: Bearer ${BUILDKITE_API_TOKEN} " $build_data_url )
1113
1214echo " Determining if there are multiple builds waiting."
1315if [[ " $THIRD_TO_LAST_BUILD_STATE " == " running" ]]; then
You can’t perform that action at this time.
0 commit comments