This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch v1-10-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit ad5679025d84378a54ac22a9203c3cc75f7aedd8 Author: Jarek Potiuk <jarek.pot...@polidea.com> AuthorDate: Fri Oct 30 21:48:40 2020 +0100 Implements canceling of future duplicate runs (but the latest) (#11980) * Implements canceling of future duplicate runs (but the latest) Previous version of the cancel-workflow-runs action implemented canceling of only past duplicates, but when there are queues involved, some future "cancel-workflow-runs" might be in a queue for long time. This change has the effect that cancel-workflow-runs for duplicates will also allow future runs of the same branch/repo sparing only the most recent run - no matter if the duplicates were older than my own run. This should handle the case where we have queues blocking the "cancel-workflow-runs" from running. * Update .github/workflows/build-images-workflow-run.yml Co-authored-by: Kaxil Naik <kaxiln...@gmail.com> Co-authored-by: Kaxil Naik <kaxiln...@gmail.com> (cherry picked from commit 36b5cc6df0c7b49bcd9d38c37c2ed4b881089d6d) --- .github/workflows/build-images-workflow-run.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-images-workflow-run.yml b/.github/workflows/build-images-workflow-run.yml index a4f2dbe..81c4fb4 100644 --- a/.github/workflows/build-images-workflow-run.yml +++ b/.github/workflows/build-images-workflow-run.yml @@ -21,7 +21,6 @@ on: # yamllint disable-line rule:truthy workflow_run: workflows: ["CI Build"] types: ['requested'] - env: MOUNT_LOCAL_SOURCES: "false" MOUNT_FILES: "true" @@ -66,7 +65,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} sourceRunId: ${{ github.event.workflow_run.id }} - name: "Cancel duplicated 'CI Build' runs" - uses: potiuk/cancel-workflow-runs@0acb1c01f6740dfbca6eab6e21a5b5066e8bafb3 # v3_3 + uses: potiuk/cancel-workflow-runs@c8448eb1e435664b3731ea1ead2efa0d1bb83b5b # v4_0 with: token: ${{ secrets.GITHUB_TOKEN }} cancelMode: duplicates @@ -84,7 +83,7 @@ jobs: # in GitHub Actions, we have to use Job names to match Event/Repo/Branch from the # build-info step there to find the duplicates ¯\_(ツ)_/¯. - uses: potiuk/cancel-workflow-runs@0acb1c01f6740dfbca6eab6e21a5b5066e8bafb3 # v3_3 + uses: potiuk/cancel-workflow-runs@c8448eb1e435664b3731ea1ead2efa0d1bb83b5b # v4_0 with: cancelMode: namedJobs token: ${{ secrets.GITHUB_TOKEN }} @@ -93,9 +92,7 @@ jobs: [".*Event: ${{ steps.source-run-info.outputs.sourceEvent }} Repo: ${{ steps.source-run-info.outputs.sourceHeadRepo }} Branch: ${{ steps.source-run-info.outputs.sourceHeadBranch }}.*"] - if: > - env.BUILD_IMAGES == 'true' && steps.source-run-info.outputs.sourceEvent != 'schedule' - && steps.source-run-info.outputs.sourceEvent != 'push' + if: env.BUILD_IMAGES == 'true' - name: "Cancel all 'CI Build' runs where some jobs failed" # We find any of the "CI Build" workflow runs, where any of the important jobs @@ -104,7 +101,7 @@ jobs: # can cancel all the matching "Build Images" workflow runs in the two following steps. # Yeah. Adding to the complexity ¯\_(ツ)_/¯. - uses: potiuk/cancel-workflow-runs@0acb1c01f6740dfbca6eab6e21a5b5066e8bafb3 # v3_3 + uses: potiuk/cancel-workflow-runs@c8448eb1e435664b3731ea1ead2efa0d1bb83b5b # v4_0 id: cancel-failed with: token: ${{ secrets.GITHUB_TOKEN }} @@ -138,14 +135,14 @@ jobs: # it to cancel any jobs that have matching names containing Source Run Id: # followed by one of the run ids. Yes I know it's super complex ¯\_(ツ)_/¯. if: env.BUILD_IMAGES == 'true' && steps.source-run-info-failed.outputs.cancelledRuns != '[]' - uses: potiuk/cancel-workflow-runs@0acb1c01f6740dfbca6eab6e21a5b5066e8bafb3 # v3_3 + uses: potiuk/cancel-workflow-runs@c8448eb1e435664b3731ea1ead2efa0d1bb83b5b # v4_0 with: cancelMode: namedJobs token: ${{ secrets.GITHUB_TOKEN }} notifyPRCancel: true jobNameRegexps: ${{ steps.extract-cancelled-failed-runs.outputs.matching-regexp }} - name: "Cancel duplicated 'CodeQL' runs" - uses: potiuk/cancel-workflow-runs@0acb1c01f6740dfbca6eab6e21a5b5066e8bafb3 # v3_3 + uses: potiuk/cancel-workflow-runs@c8448eb1e435664b3731ea1ead2efa0d1bb83b5b # v4_0 id: cancel with: token: ${{ secrets.GITHUB_TOKEN }} @@ -376,7 +373,7 @@ jobs: needs: [build-images] steps: - name: "Canceling the 'CI Build' source workflow in case of failure!" - uses: potiuk/cancel-workflow-runs@cancel_message # v3 + uses: potiuk/cancel-workflow-runs@c8448eb1e435664b3731ea1ead2efa0d1bb83b5b # v4_0 with: token: ${{ secrets.GITHUB_TOKEN }} cancelMode: self @@ -391,7 +388,7 @@ jobs: needs: [build-images] steps: - name: "Canceling the 'CI Build' source workflow in case of failure!" - uses: potiuk/cancel-workflow-runs@0acb1c01f6740dfbca6eab6e21a5b5066e8bafb3 # v3_3 + uses: potiuk/cancel-workflow-runs@c8448eb1e435664b3731ea1ead2efa0d1bb83b5b # v4_0 with: token: ${{ secrets.GITHUB_TOKEN }} cancelMode: self