Skip to content

Commit

Permalink
Cancel previous ci job on new push (#15472)
Browse files Browse the repository at this point in the history
* Cancel previous ci jobs on the same branch on new push
  • Loading branch information
ibrahimmenem committed Feb 10, 2020
1 parent 98b2c03 commit a5a7f22
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions script/ci/cloudbuild-pg11.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
steps:

# Cancel previous job on the same branch
- name: gcr.io/cloud-builders/gcloud
entrypoint: /bin/bash
args:
- '-c'
- 'gcloud builds list --ongoing --filter="substitutions.BRANCH_NAME=${BRANCH_NAME} AND substitutions.REPO_NAME=cartodb AND id!=${BUILD_ID}" --format="get(ID)" > jobs_to_cancel'

- name: gcr.io/cloud-builders/gcloud
entrypoint: /bin/bash
args:
- '-c'
- 'gcloud builds cancel $(cat jobs_to_cancel | xargs) || true'

# Decrypt github key
- name: gcr.io/cloud-builders/gcloud
args:
Expand Down
13 changes: 13 additions & 0 deletions script/ci/cloudbuild-pg12.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
steps:

# Cancel previous job on the same branch
- name: gcr.io/cloud-builders/gcloud
entrypoint: /bin/bash
args:
- '-c'
- 'gcloud builds list --ongoing --filter="substitutions.BRANCH_NAME=${BRANCH_NAME} AND substitutions.REPO_NAME=cartodb AND id!=${BUILD_ID}" --format="get(ID)" > jobs_to_cancel'

- name: gcr.io/cloud-builders/gcloud
entrypoint: /bin/bash
args:
- '-c'
- 'gcloud builds cancel $(cat jobs_to_cancel | xargs) || true'

# Decrypt github key
- name: gcr.io/cloud-builders/gcloud
args:
Expand Down

0 comments on commit a5a7f22

Please sign in to comment.