From 34fdbf1231f0885f22b2c75ab46f21908e1b041f Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Thu, 18 May 2023 10:55:03 +0200 Subject: [PATCH] Add concurrency limits on all workflows to eliminate wasted cycles (#2603) --- .github/workflows/arc-publish-chart.yaml | 4 ++++ .github/workflows/arc-publish.yaml | 4 ++++ .github/workflows/arc-release-runners.yaml | 4 ++++ .github/workflows/arc-validate-chart.yaml | 7 +++++++ .github/workflows/arc-validate-runners.yaml | 7 +++++++ .github/workflows/gha-e2e-tests.yaml | 7 +++++++ .github/workflows/gha-publish-chart.yaml | 6 +++++- .github/workflows/gha-validate-chart.yaml | 7 +++++++ .github/workflows/global-publish-canary.yaml | 4 ++++ .github/workflows/global-run-codeql.yaml | 7 +++++++ .github/workflows/go.yaml | 7 +++++++ 11 files changed, 63 insertions(+), 1 deletion(-) diff --git a/.github/workflows/arc-publish-chart.yaml b/.github/workflows/arc-publish-chart.yaml index 54785bb..e5c9ce1 100644 --- a/.github/workflows/arc-publish-chart.yaml +++ b/.github/workflows/arc-publish-chart.yaml @@ -28,6 +28,10 @@ env: permissions: contents: write +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + jobs: lint-chart: name: Lint Chart diff --git a/.github/workflows/arc-publish.yaml b/.github/workflows/arc-publish.yaml index fb23500..fa318c1 100644 --- a/.github/workflows/arc-publish.yaml +++ b/.github/workflows/arc-publish.yaml @@ -25,6 +25,10 @@ env: TARGET_ORG: actions-runner-controller TARGET_REPO: actions-runner-controller +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + jobs: release-controller: name: Release diff --git a/.github/workflows/arc-release-runners.yaml b/.github/workflows/arc-release-runners.yaml index 8adad96..211c129 100644 --- a/.github/workflows/arc-release-runners.yaml +++ b/.github/workflows/arc-release-runners.yaml @@ -19,6 +19,10 @@ env: TARGET_WORKFLOW: release-runners.yaml DOCKER_VERSION: 20.10.23 +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + jobs: build-runners: name: Trigger Build and Push of Runner Images diff --git a/.github/workflows/arc-validate-chart.yaml b/.github/workflows/arc-validate-chart.yaml index ed3b3ac..c11ad22 100644 --- a/.github/workflows/arc-validate-chart.yaml +++ b/.github/workflows/arc-validate-chart.yaml @@ -27,6 +27,13 @@ env: permissions: contents: read +concurrency: + # This will make sure we only apply the concurrency limits on pull requests + # but not pushes to master branch by making the concurrency group name unique + # for pushes + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: validate-chart: name: Lint Chart diff --git a/.github/workflows/arc-validate-runners.yaml b/.github/workflows/arc-validate-runners.yaml index 42380e9..0b43f39 100644 --- a/.github/workflows/arc-validate-runners.yaml +++ b/.github/workflows/arc-validate-runners.yaml @@ -12,6 +12,13 @@ on: permissions: contents: read +concurrency: + # This will make sure we only apply the concurrency limits on pull requests + # but not pushes to master branch by making the concurrency group name unique + # for pushes + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: shellcheck: name: runner / shellcheck diff --git a/.github/workflows/gha-e2e-tests.yaml b/.github/workflows/gha-e2e-tests.yaml index 65230a2..48ca585 100644 --- a/.github/workflows/gha-e2e-tests.yaml +++ b/.github/workflows/gha-e2e-tests.yaml @@ -18,6 +18,13 @@ env: IMAGE_NAME: "arc-test-image" IMAGE_VERSION: "0.4.0" +concurrency: + # This will make sure we only apply the concurrency limits on pull requests + # but not pushes to master branch by making the concurrency group name unique + # for pushes + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: default-setup: runs-on: ubuntu-latest diff --git a/.github/workflows/gha-publish-chart.yaml b/.github/workflows/gha-publish-chart.yaml index f0e0107..8d893e0 100644 --- a/.github/workflows/gha-publish-chart.yaml +++ b/.github/workflows/gha-publish-chart.yaml @@ -33,7 +33,11 @@ env: HELM_VERSION: v3.8.0 permissions: - packages: write + packages: write + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true jobs: build-push-image: diff --git a/.github/workflows/gha-validate-chart.yaml b/.github/workflows/gha-validate-chart.yaml index d616d9a..eb4f1f5 100644 --- a/.github/workflows/gha-validate-chart.yaml +++ b/.github/workflows/gha-validate-chart.yaml @@ -23,6 +23,13 @@ env: permissions: contents: read +concurrency: + # This will make sure we only apply the concurrency limits on pull requests + # but not pushes to master branch by making the concurrency group name unique + # for pushes + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: validate-chart: name: Lint Chart diff --git a/.github/workflows/global-publish-canary.yaml b/.github/workflows/global-publish-canary.yaml index 2757908..cf97a71 100644 --- a/.github/workflows/global-publish-canary.yaml +++ b/.github/workflows/global-publish-canary.yaml @@ -37,6 +37,10 @@ permissions: contents: read packages: write +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + env: # Safeguard to prevent pushing images to registeries after build PUSH_TO_REGISTRIES: true diff --git a/.github/workflows/global-run-codeql.yaml b/.github/workflows/global-run-codeql.yaml index 908e864..b13463d 100644 --- a/.github/workflows/global-run-codeql.yaml +++ b/.github/workflows/global-run-codeql.yaml @@ -10,6 +10,13 @@ on: schedule: - cron: '30 1 * * 0' +concurrency: + # This will make sure we only apply the concurrency limits on pull requests + # but not pushes to master branch by making the concurrency group name unique + # for pushes + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: analyze: name: Analyze diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index 6c13bac..21a783b 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -18,6 +18,13 @@ on: permissions: contents: read +concurrency: + # This will make sure we only apply the concurrency limits on pull requests + # but not pushes to master branch by making the concurrency group name unique + # for pushes + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: fmt: runs-on: ubuntu-latest