From 4a26d389b7c66678f99744dbe90f8b9e72c345e6 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Fri, 27 May 2022 12:13:54 +0530 Subject: [PATCH] ci: stop inprogress jobs when pr is updated stop the in progress jobs when a PR is updated Ref: https://docs.github.com/en/actions/using-workflows/ \ workflow-syntax-for-github-actions# \ example-using-concurrency-to-cancel-any-in-progress-job-or-run example job is here https://core.trac.wordpress.org/changeset/50930 Signed-off-by: Madhu Rajanna --- .github/workflows/build.yml | 5 +++++ .github/workflows/canary-integration-test.yml | 5 +++++ .github/workflows/codegen.yml | 5 +++++ .github/workflows/codespell.yaml | 5 +++++ .github/workflows/commitlint.yml | 5 +++++ .github/workflows/crds-gen.yml | 5 +++++ .github/workflows/golangci-lint.yaml | 5 +++++ .github/workflows/helm-lint.yaml | 5 +++++ .github/workflows/integration-test-helm-suite.yaml | 5 +++++ .github/workflows/integration-test-mgr-suite.yaml | 5 +++++ .github/workflows/integration-test-multi-cluster-suite.yaml | 5 +++++ .github/workflows/integration-test-object-suite.yaml | 5 +++++ .github/workflows/integration-test-smoke-suite.yaml | 5 +++++ .github/workflows/integration-test-upgrade-suite.yaml | 5 +++++ .github/workflows/linters.yaml | 5 +++++ .github/workflows/mod-check.yml | 5 +++++ .github/workflows/rbac-gen.yaml | 5 +++++ .github/workflows/shellcheck.yaml | 5 +++++ .github/workflows/unit-test.yml | 5 +++++ 19 files changed, 95 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 09a49e258..f5fb54799 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,11 @@ defaults: # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell shell: bash --noprofile --norc -eo pipefail -x {0} +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: macos-build: runs-on: macos-10.15 diff --git a/.github/workflows/canary-integration-test.yml b/.github/workflows/canary-integration-test.yml index cb46ce3e7..052b071c1 100644 --- a/.github/workflows/canary-integration-test.yml +++ b/.github/workflows/canary-integration-test.yml @@ -16,6 +16,11 @@ defaults: # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell shell: bash --noprofile --norc -eo pipefail -x {0} +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: canary: runs-on: ubuntu-18.04 diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml index 58420d486..b2da7528e 100644 --- a/.github/workflows/codegen.yml +++ b/.github/workflows/codegen.yml @@ -16,6 +16,11 @@ defaults: # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell shell: bash --noprofile --norc -eo pipefail -x {0} +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: codegen: runs-on: ubuntu-18.04 diff --git a/.github/workflows/codespell.yaml b/.github/workflows/codespell.yaml index 509ea592a..6f0052ee1 100644 --- a/.github/workflows/codespell.yaml +++ b/.github/workflows/codespell.yaml @@ -11,6 +11,11 @@ on: - master - release-* +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: codespell: name: codespell diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 5624d95aa..dff9c7511 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -11,6 +11,11 @@ on: - master - release-* +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: lint: runs-on: ubuntu-18.04 diff --git a/.github/workflows/crds-gen.yml b/.github/workflows/crds-gen.yml index f987fb77b..32d2d4aa5 100644 --- a/.github/workflows/crds-gen.yml +++ b/.github/workflows/crds-gen.yml @@ -16,6 +16,11 @@ defaults: # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell shell: bash --noprofile --norc -eo pipefail -x {0} +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: crds-gen: runs-on: ubuntu-18.04 diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml index a0185b39f..0b0e63754 100644 --- a/.github/workflows/golangci-lint.yaml +++ b/.github/workflows/golangci-lint.yaml @@ -11,6 +11,11 @@ on: - master - release-* +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: golangci: name: golangci-lint diff --git a/.github/workflows/helm-lint.yaml b/.github/workflows/helm-lint.yaml index 1d2f7b81f..f23bf8b89 100644 --- a/.github/workflows/helm-lint.yaml +++ b/.github/workflows/helm-lint.yaml @@ -13,6 +13,11 @@ on: - master - release-* +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: lint-test: runs-on: ubuntu-latest diff --git a/.github/workflows/integration-test-helm-suite.yaml b/.github/workflows/integration-test-helm-suite.yaml index eb9adfcc8..0a95c663e 100644 --- a/.github/workflows/integration-test-helm-suite.yaml +++ b/.github/workflows/integration-test-helm-suite.yaml @@ -10,6 +10,11 @@ defaults: # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell shell: bash --noprofile --norc -eo pipefail -x {0} +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: TestCephHelmSuite: if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && !contains(github.event.pull_request.labels.*.name, 'skip-ci') }} diff --git a/.github/workflows/integration-test-mgr-suite.yaml b/.github/workflows/integration-test-mgr-suite.yaml index 4d7b93f4c..ebdb704ec 100644 --- a/.github/workflows/integration-test-mgr-suite.yaml +++ b/.github/workflows/integration-test-mgr-suite.yaml @@ -9,6 +9,11 @@ defaults: # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell shell: bash --noprofile --norc -eo pipefail -x {0} +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: TestCephMgrSuite: runs-on: ubuntu-18.04 diff --git a/.github/workflows/integration-test-multi-cluster-suite.yaml b/.github/workflows/integration-test-multi-cluster-suite.yaml index d31738b52..80325e16f 100644 --- a/.github/workflows/integration-test-multi-cluster-suite.yaml +++ b/.github/workflows/integration-test-multi-cluster-suite.yaml @@ -10,6 +10,11 @@ defaults: # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell shell: bash --noprofile --norc -eo pipefail -x {0} +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: TestCephMultiClusterDeploySuite: if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && !contains(github.event.pull_request.labels.*.name, 'skip-ci') }} diff --git a/.github/workflows/integration-test-object-suite.yaml b/.github/workflows/integration-test-object-suite.yaml index 60dbabd42..3e2cc7f91 100644 --- a/.github/workflows/integration-test-object-suite.yaml +++ b/.github/workflows/integration-test-object-suite.yaml @@ -10,6 +10,11 @@ defaults: # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell shell: bash --noprofile --norc -eo pipefail -x {0} +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: TestCephObjectSuite: if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && !contains(github.event.pull_request.labels.*.name, 'skip-ci') }} diff --git a/.github/workflows/integration-test-smoke-suite.yaml b/.github/workflows/integration-test-smoke-suite.yaml index bc05d6beb..c6ed08a13 100644 --- a/.github/workflows/integration-test-smoke-suite.yaml +++ b/.github/workflows/integration-test-smoke-suite.yaml @@ -10,6 +10,11 @@ defaults: # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell shell: bash --noprofile --norc -eo pipefail -x {0} +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: TestCephSmokeSuite: if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && !contains(github.event.pull_request.labels.*.name, 'skip-ci') }} diff --git a/.github/workflows/integration-test-upgrade-suite.yaml b/.github/workflows/integration-test-upgrade-suite.yaml index 330c103be..e75f5621a 100644 --- a/.github/workflows/integration-test-upgrade-suite.yaml +++ b/.github/workflows/integration-test-upgrade-suite.yaml @@ -10,6 +10,11 @@ defaults: # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell shell: bash --noprofile --norc -eo pipefail -x {0} +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: TestCephUpgradeSuite: if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' && !contains(github.event.pull_request.labels.*.name, 'skip-ci') }} diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml index 0ceb2cb15..5b3d3ed66 100644 --- a/.github/workflows/linters.yaml +++ b/.github/workflows/linters.yaml @@ -11,6 +11,11 @@ on: - master - release-* +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: yaml-linter: runs-on: ubuntu-latest diff --git a/.github/workflows/mod-check.yml b/.github/workflows/mod-check.yml index 657b61533..5daefcc33 100644 --- a/.github/workflows/mod-check.yml +++ b/.github/workflows/mod-check.yml @@ -11,6 +11,11 @@ on: - master - release-* +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + defaults: run: # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell diff --git a/.github/workflows/rbac-gen.yaml b/.github/workflows/rbac-gen.yaml index 7a97aed33..d84317f39 100644 --- a/.github/workflows/rbac-gen.yaml +++ b/.github/workflows/rbac-gen.yaml @@ -16,6 +16,11 @@ defaults: # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell shell: bash --noprofile --norc -eo pipefail -x {0} +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: gen-rbac: runs-on: ubuntu-18.04 diff --git a/.github/workflows/shellcheck.yaml b/.github/workflows/shellcheck.yaml index a92b6aaf4..85cb9d79c 100644 --- a/.github/workflows/shellcheck.yaml +++ b/.github/workflows/shellcheck.yaml @@ -11,6 +11,11 @@ on: - master - release-* +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: shellcheck: name: Shellcheck diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index e4e028eaa..75f6d7dad 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -16,6 +16,11 @@ defaults: # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell shell: bash --noprofile --norc -eo pipefail -x {0} +# cancel the in-progress workflow when PR is refreshed. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: unittests: runs-on: ubuntu-18.04