Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid concurrency by canceling triggered worklfows before running new ones #159

Merged
merged 11 commits into from
Nov 10, 2023
1 change: 0 additions & 1 deletion .github/workflows/bump-version-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ on:
jobs:
release:
runs-on: ubuntu-22.04

# Map the job outputs to step outputs
outputs:
release-version: ${{ steps.bump-version.outputs.release-version }}
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/docker-build-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ on:
required: false
default: "."
type: string

secrets:
docker-user:
description: "Username for the Docker registry login."
Expand All @@ -67,11 +68,14 @@ on:
description: "GitHub token."
required: false

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-docker
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
docker-build:
name: Docker build
runs-on: ubuntu-22.04

steps:
- name: Check out repository
uses: bakdata/ci-templates/actions/[email protected]
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/helm-gke-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ on:
default: "v3.8.1"
required: false
type: string

secrets:
gke-service-account:
description: "GKE service account key for authentication"
Expand All @@ -70,11 +71,14 @@ on:
description: "GKE cluster for authentication"
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-helm-gke-deploy
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
deploy:
name: Deploy
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: bakdata/ci-templates/actions/[email protected]
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/helm-gke-destroy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ on:
default: "v3.8.1"
required: false
type: string

secrets:
gke-service-account:
description: "GKE service account key for authentication"
Expand All @@ -41,11 +42,14 @@ on:
description: "GKE cluster for authentication"
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-helm-gke-destroy
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
destroy:
name: Destroy
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: bakdata/ci-templates/actions/[email protected]
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/helm-multi-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ on:
description: "The GitHub token for committing the changes."
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-helm-multi-release
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
helm-lint:
runs-on: ubuntu-22.04

steps:
- name: Lint Helm chart
uses: bakdata/ci-templates/actions/[email protected]
Expand Down Expand Up @@ -134,7 +137,7 @@ jobs:

publish-artifacts:
runs-on: ubuntu-22.04
needs: [package-new-artifacts,update-version]
needs: [package-new-artifacts, update-version]
env:
artifact-dir: "${{ inputs.artifact-dir }}"
charts-path: "${{ inputs.artifact-dir }}"
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/helm-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ on:
description: "The old version in your `.bumpversion.cfg` file."
value: ${{ jobs.helm-release.outputs.old-version }}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-helm-release
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
helm-lint:
runs-on: ubuntu-22.04

steps:
- name: Lint Helm chart
uses: bakdata/ci-templates/actions/[email protected]
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/java-gradle-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ on:
required: false
type: string
default: "."

secrets:
signing-key-id:
description: "Key id for signing the Sonatype publication."
Expand All @@ -51,11 +52,14 @@ on:
description: "Token for Sonarcloud."
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-java-gradle-base
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
build:
name: Build
runs-on: ubuntu-22.04

steps:
- name: Build
uses: bakdata/ci-templates/actions/[email protected]
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/java-gradle-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ on:
required: false
type: string
default: "."

secrets:
sonar-token:
description: "Token for Sonarcloud."
Expand Down Expand Up @@ -68,6 +69,10 @@ on:
description: "GitHub token for requesting changes from API."
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-java-gradle-docker
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
build-and-test:
name: Build, Test and Assess code quality
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/java-gradle-library.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ on:
required: false
type: string
default: "."

secrets:
sonar-token:
description: "Token for Sonarcloud."
Expand Down Expand Up @@ -58,6 +59,10 @@ on:
description: "GitHub token for requesting changes from API."
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-java-gradle-lib
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
build-and-test:
name: Build, Test and Assess code quality
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/java-gradle-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ on:
required: false
type: string
default: "."

secrets:
sonar-token:
description: "Token for Sonarcloud."
Expand Down Expand Up @@ -64,6 +65,10 @@ on:
description: "GitHub token for requesting changes from API."
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-java-gradle-plugin
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
build-and-test:
name: Build, Test and Assess code quality
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/java-gradle-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ on:
required: false
type: string
default: "."

secrets:
github-username:
description: "GitHub username for committing the changes."
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/kustomize-gke-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ on:
default: "v3.8.1"
required: false
type: string

secrets:
gke-service-account:
description: "GKE service account key for authentication"
Expand All @@ -42,6 +43,10 @@ on:
description: "GKE cluster for authentication"
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-kustomize-gke-deploy
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
deploy:
name: Deploy
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/kustomize-gke-destroy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ on:
default: "v3.8.1"
required: false
type: string

secrets:
gke-service-account:
description: "GKE service account key for authentication"
Expand All @@ -37,6 +38,10 @@ on:
description: "GKE cluster for authentication"
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-kustomize-gke-destroy
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
destroy:
name: Destroy
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/python-poetry-publish-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ on:
required: false
default: "./"
type: string

secrets:
pypi-token:
description: "PyPI token"
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-python-poetry-publish-pypi
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
publish:
name: Publish
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/python-poetry-publish-snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
required: false
default: "./"
type: string

secrets:
pypi-token:
description: "TestPyPI token"
Expand All @@ -32,6 +33,10 @@ on:
description: "The old version of the package."
value: ${{ jobs.publish-snapshot.outputs.old-version }}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-python-poetry-publish-snapshot
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
publish-snapshot:
name: Publish snapshot
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/python-poetry-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ on:
required: false
default: "./"
type: string

secrets:
github-username:
description: "The GitHub username for committing the changes."
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-tag-versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
required: false
default: "SNAPSHOT"
type: string

secrets:
github-email:
description: "The GitHub email for committing the changes."
Expand All @@ -34,7 +35,6 @@ on:
jobs:
bump_and_release:
runs-on: ubuntu-latest

steps:
- name: Check out default branch
uses: bakdata/ci-templates/actions/[email protected]
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-python-setup-poetry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
env:
POETRY_VERSION: "1.2.2"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-test-python-setup-poetry
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}

jobs:
tests:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
Expand Down