From a0bb54b92979d3e3e095b1ce3e20396727e1b5d8 Mon Sep 17 00:00:00 2001 From: Alireza Ziaee Date: Tue, 4 Oct 2022 23:30:38 +0330 Subject: [PATCH 1/3] Add concurrency settings for workflow --- .github/workflows/actionlint.yml | 7 +++++++ .github/workflows/ci_cd.yml | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 9bb0d9c9c..ae80184ce 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -6,6 +6,13 @@ on: branches: - main +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: actionlint: runs-on: ubuntu-latest diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 35f2151b6..f42698e10 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -10,6 +10,13 @@ on: - published workflow_dispatch: +# Cancels all previous workflow runs for pull requests that have not completed. +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests + # or the commit hash for any other events. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + jobs: lint: name: Lint @@ -65,7 +72,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: ${{ matrix.image }} - path: /tmp/${{ matrix.image }}.tar + path: test-ing: name: Run tests for ingestion-server From 3da8b2c1d46816bc2f62d1d87401730691bd8287 Mon Sep 17 00:00:00 2001 From: Alireza Ziaee Date: Sat, 8 Oct 2022 13:53:59 +0330 Subject: [PATCH 2/3] Add remaining concurrency settings --- .github/workflows/actionlint.yml | 7 ------- .github/workflows/build_imaginary.yml | 2 ++ .github/workflows/ci_cd.yml | 14 +++++++------- .github/workflows/migration_safety_warning.yml | 5 +++++ .github/workflows/push_docker_image.yml | 2 ++ 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index ae80184ce..9bb0d9c9c 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -6,13 +6,6 @@ on: branches: - main -# Cancels all previous workflow runs for pull requests that have not completed. -concurrency: - # The concurrency group contains the workflow name and the branch name for pull requests - # or the commit hash for any other events. - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - cancel-in-progress: true - jobs: actionlint: runs-on: ubuntu-latest diff --git a/.github/workflows/build_imaginary.yml b/.github/workflows/build_imaginary.yml index a819c1405..0ce93fd63 100644 --- a/.github/workflows/build_imaginary.yml +++ b/.github/workflows/build_imaginary.yml @@ -12,6 +12,8 @@ on: default: true description: Set to `false` to trigger _just_ a redeployment +concurrency: ${{ github.workflow }}-${{ inputs.deploy-to }} + jobs: build: name: Build diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index f42698e10..6a1607fe8 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -10,13 +10,13 @@ on: - published workflow_dispatch: -# Cancels all previous workflow runs for pull requests that have not completed. concurrency: - # The concurrency group contains the workflow name and the branch name for pull requests - # or the commit hash for any other events. - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - cancel-in-progress: true - + group: ${{ github.workflow }}-${{ github.event_name == 'release' && 'release' || github.ref }} + # Don't continue building images for a PR if the PR is updated quickly + # For other workflows, allow them to complete and just block on them. This + # ensures deployments in particular to happen in series rather than parallel. + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: lint: name: Lint @@ -72,7 +72,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: ${{ matrix.image }} - path: + path: /tmp/${{ matrix.image }}.tar test-ing: name: Run tests for ingestion-server diff --git a/.github/workflows/migration_safety_warning.yml b/.github/workflows/migration_safety_warning.yml index bca485ff2..db065ea5b 100644 --- a/.github/workflows/migration_safety_warning.yml +++ b/.github/workflows/migration_safety_warning.yml @@ -5,6 +5,11 @@ on: paths: - "**/migrations/**/*" +concurrency: + # The concurrency group contains the workflow name and the branch name for pull requests. + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref }} + cancel-in-progress: true + jobs: check-and-apply-labels: name: "Check and Apply Labels" diff --git a/.github/workflows/push_docker_image.yml b/.github/workflows/push_docker_image.yml index e7488031f..807632f30 100644 --- a/.github/workflows/push_docker_image.yml +++ b/.github/workflows/push_docker_image.yml @@ -9,6 +9,8 @@ on: description: Commit that the image is built from required: true +concurrency: ${{ github.workflow }}-${{ inputs.image }}-${{ inputs.commit }} + jobs: push: name: Publish requested Docker image From e9777a463a0d98065d76f0534b54aaae09dacc9f Mon Sep 17 00:00:00 2001 From: Alireza Ziaee Date: Sat, 8 Oct 2022 13:57:40 +0330 Subject: [PATCH 3/3] Fix concurrency settings for Migration Safety Check workflow --- .github/workflows/migration_safety_warning.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/migration_safety_warning.yml b/.github/workflows/migration_safety_warning.yml index db065ea5b..0fa624cda 100644 --- a/.github/workflows/migration_safety_warning.yml +++ b/.github/workflows/migration_safety_warning.yml @@ -7,7 +7,7 @@ on: concurrency: # The concurrency group contains the workflow name and the branch name for pull requests. - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref }} + group: ${{ github.workflow }}-${{ github.head_ref }} cancel-in-progress: true jobs: