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 1
1
#! /bin/bash
2
2
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} "
4
4
cancel_build_url=" https://api.buildkite.com/v2/organizations/elastic/pipelines/${BUILDKITE_PIPELINE_SLUG} /builds/${BUILDKITE_JOB_ID} /cancel"
5
5
6
6
# Don't look at this build (it's running now!)
7
7
# Don't look at the last build (it's okay if it's still running!)
8
8
# Look three builds back instead (if this build is still running,
9
9
# 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 )
11
13
12
14
echo " Determining if there are multiple builds waiting."
13
15
if [[ " $THIRD_TO_LAST_BUILD_STATE " == " running" ]]; then
You can’t perform that action at this time.
0 commit comments