diff --git a/script/ci/cloudbuild-pg11.yaml b/script/ci/cloudbuild-pg11.yaml index c50d4fd87655..81815745ac00 100644 --- a/script/ci/cloudbuild-pg11.yaml +++ b/script/ci/cloudbuild-pg11.yaml @@ -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: diff --git a/script/ci/cloudbuild-pg12.yaml b/script/ci/cloudbuild-pg12.yaml index 86e37c8bc58a..089bffd5b861 100644 --- a/script/ci/cloudbuild-pg12.yaml +++ b/script/ci/cloudbuild-pg12.yaml @@ -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: