From 48ebe0f4c6171942a6ab8014a7caf279ab21a7ca Mon Sep 17 00:00:00 2001 From: Prateek Pandey Date: Wed, 23 Nov 2022 18:59:57 +0530 Subject: [PATCH] ci: cancel redundant builds of workflow on push (#5427) Use concurrency to ensure that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. Signed-off-by: prateekpandey14 Signed-off-by: prateekpandey14 --- .github/workflows/conformance.yaml | 4 ++++ .github/workflows/e2e.yaml | 4 ++++ .github/workflows/image-build.yaml | 4 ++++ .github/workflows/image.yaml | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/.github/workflows/conformance.yaml b/.github/workflows/conformance.yaml index 7c803b2968..43e9f69927 100644 --- a/.github/workflows/conformance.yaml +++ b/.github/workflows/conformance.yaml @@ -5,6 +5,10 @@ on: - 'main' - 'release*' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: run-conformance: runs-on: ubuntu-latest diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 23ff971354..6b525c9005 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -18,6 +18,10 @@ on: permissions: read-all +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: e2e-test: strategy: diff --git a/.github/workflows/image-build.yaml b/.github/workflows/image-build.yaml index 6bba70a5ba..5de2e7c7ac 100644 --- a/.github/workflows/image-build.yaml +++ b/.github/workflows/image-build.yaml @@ -10,6 +10,10 @@ permissions: packages: write id-token: write +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: pre-checks: runs-on: ubuntu-latest diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml index c45588943a..e6e5279bf4 100644 --- a/.github/workflows/image.yaml +++ b/.github/workflows/image.yaml @@ -10,6 +10,10 @@ permissions: packages: write id-token: write +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: push-init-kyverno: uses: ./.github/workflows/reuse.yaml