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
Prev Previous commit
Next Next commit
Move concurrency block after the vars
MichaelKora committed Nov 8, 2023
commit 56527a003fb98e9341bb96cdc14800c832a1aefc
8 changes: 4 additions & 4 deletions .github/workflows/bump-version-release.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Bump Version Release
# Reusable workflow for creating release tags using bumpversion

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-bump-version-release
cancel-in-progress: true

on:
workflow_call:
inputs:
@@ -48,6 +44,10 @@ on:
description: "The old version in your `.bumpversion.cfg` file."
value: ${{ jobs.release.outputs.old-version }}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-bump-version-release
cancel-in-progress: true

MichaelKora marked this conversation as resolved.
Show resolved Hide resolved
jobs:
release:
runs-on: ubuntu-22.04
8 changes: 5 additions & 3 deletions .github/workflows/docker-build-and-publish.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Docker build and publish
# Reusable workflow to build and push an image from a Dockerfile to any container registry

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-docker
cancel-in-progress: true
on:
workflow_call:
inputs:
@@ -57,6 +54,7 @@ on:
required: false
default: "."
type: string

secrets:
docker-user:
description: "Username for the Docker registry login."
@@ -70,6 +68,10 @@ on:
description: "GitHub token."
required: false

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-docker
cancel-in-progress: true
MichaelKora marked this conversation as resolved.
Show resolved Hide resolved

jobs:
docker-build:
name: Docker build
9 changes: 5 additions & 4 deletions .github/workflows/helm-gke-deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Helm GKE Deploy
# Reusable workflow for deploying a Helm chart on GKE Kubernetes

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-helm-deploy
cancel-in-progress: true

on:
workflow_call:
inputs:
@@ -60,6 +56,7 @@ on:
default: "v3.8.1"
required: false
type: string

secrets:
gke-service-account:
description: "GKE service account key for authentication"
@@ -74,6 +71,10 @@ on:
description: "GKE cluster for authentication"
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-helm-deploy
MichaelKora marked this conversation as resolved.
Show resolved Hide resolved
cancel-in-progress: true

jobs:
deploy:
name: Deploy
9 changes: 5 additions & 4 deletions .github/workflows/helm-gke-destroy.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Helm GKE Destroy
# Reusable workflow for destroying a Helm chart on GKE Kubernetes

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-helm-destroy
cancel-in-progress: true

on:
workflow_call:
inputs:
@@ -31,6 +27,7 @@ on:
default: "v3.8.1"
required: false
type: string

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

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-helm-destroy
cancel-in-progress: true

jobs:
destroy:
name: Destroy
8 changes: 4 additions & 4 deletions .github/workflows/helm-multi-release.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Helm Multi Release
# Reusable workflow for packaging and publishing Helm charts having multiple subcharts on GitHub pages

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-helm-multi-release
cancel-in-progress: true

on:
workflow_call:
inputs:
@@ -48,6 +44,10 @@ 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: true

jobs:
helm-lint:
runs-on: ubuntu-22.04
8 changes: 4 additions & 4 deletions .github/workflows/helm-release.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: Reusable workflow for packaging and publishing Helm charts on GitHub pages

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-helm-release
cancel-in-progress: true

on:
workflow_call:
inputs:
@@ -66,6 +62,10 @@ 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: true

jobs:
helm-lint:
runs-on: ubuntu-22.04
8 changes: 5 additions & 3 deletions .github/workflows/java-gradle-base.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Java Gradle Base
# Reusable workflow for building testing and assessing code quality

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-java-gradle-base
cancel-in-progress: true
on:
workflow_call:
inputs:
@@ -37,6 +34,7 @@ on:
required: false
type: string
default: "."

secrets:
signing-key-id:
description: "Key id for signing the Sonatype publication."
@@ -54,6 +52,10 @@ on:
description: "Token for Sonarcloud."
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-java-gradle-base
cancel-in-progress: true

jobs:
build:
name: Build
9 changes: 5 additions & 4 deletions .github/workflows/java-gradle-docker.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Java Gradle Docker
# Reusable workflow for building and publishing Java Gradle artifacts including a tarball image

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-java-gradle-docker
cancel-in-progress: true

on:
workflow_call:
inputs:
@@ -37,6 +33,7 @@ on:
required: false
type: string
default: "."

secrets:
sonar-token:
description: "Token for Sonarcloud."
@@ -72,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: true

jobs:
build-and-test:
name: Build, Test and Assess code quality
8 changes: 5 additions & 3 deletions .github/workflows/java-gradle-library.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Java Gradle library
# Reusable workflow for building and publishing Java Gradle libraries

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-java-gradle-lib
cancel-in-progress: true
on:
workflow_call:
inputs:
@@ -32,6 +29,7 @@ on:
required: false
type: string
default: "."

secrets:
sonar-token:
description: "Token for Sonarcloud."
@@ -61,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: true

jobs:
build-and-test:
name: Build, Test and Assess code quality
8 changes: 5 additions & 3 deletions .github/workflows/java-gradle-plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Java Gradle plugin
# Reusable workflow for building and publishing Java Gradle plugins on the Gradle Plugin Portal

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-java-gradle-plugin
cancel-in-progress: true
on:
workflow_call:
inputs:
@@ -32,6 +29,7 @@ on:
required: false
type: string
default: "."

secrets:
sonar-token:
description: "Token for Sonarcloud."
@@ -67,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: true

jobs:
build-and-test:
name: Build, Test and Assess code quality
9 changes: 5 additions & 4 deletions .github/workflows/java-gradle-release.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Java Gradle Release
# Reusable workflow for releasing Java Gradle projects

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-java-gradle-release
cancel-in-progress: true

on:
workflow_call:
inputs:
@@ -42,6 +38,7 @@ on:
required: false
type: string
default: "."

secrets:
github-username:
description: "GitHub username for committing the changes."
@@ -59,6 +56,10 @@ on:
description: "Bumped version of your project."
value: ${{ jobs.release.outputs.release-version }}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-java-gradle-release
cancel-in-progress: true

MichaelKora marked this conversation as resolved.
Show resolved Hide resolved
jobs:
release:
name: Release
9 changes: 5 additions & 4 deletions .github/workflows/kustomize-gke-deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Kustomize GKE Deploy
# Reusable workflow for deploying resources with Kustomize on GKE Kubernetes

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-kustomize-gke-deploy
cancel-in-progress: true

on:
workflow_call:
inputs:
@@ -32,6 +28,7 @@ on:
default: "v3.8.1"
required: false
type: string

secrets:
gke-service-account:
description: "GKE service account key for authentication"
@@ -46,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: true

jobs:
deploy:
name: Deploy
9 changes: 5 additions & 4 deletions .github/workflows/kustomize-gke-destroy.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Kustomize GKE Destroy
# Reusable workflow for destroying resources with Kustomize on GKE Kubernetes

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-kustomize-gke-destroy
cancel-in-progress: true

on:
workflow_call:
inputs:
@@ -27,6 +23,7 @@ on:
default: "v3.8.1"
required: false
type: string

secrets:
gke-service-account:
description: "GKE service account key for authentication"
@@ -41,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: true

jobs:
destroy:
name: Destroy
9 changes: 5 additions & 4 deletions .github/workflows/python-poetry-publish-pypi.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: Reusable workflow for publishing to PyPI

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-python-poetry-publish-pypi
cancel-in-progress: true

on:
workflow_call:
inputs:
@@ -27,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: true

jobs:
publish:
name: Publish
9 changes: 5 additions & 4 deletions .github/workflows/python-poetry-publish-snapshot.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: Reusable workflow for publishing Python packages as snapshot

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-python-poetry-publish-snapshot
cancel-in-progress: true

on:
workflow_call:
inputs:
@@ -22,6 +18,7 @@ on:
required: false
default: "./"
type: string

secrets:
pypi-token:
description: "TestPyPI token"
@@ -36,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: true

jobs:
publish-snapshot:
name: Publish snapshot
9 changes: 5 additions & 4 deletions .github/workflows/python-poetry-release.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: Reusable workflow for building and releasing Python packages

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-python-poetry-release
cancel-in-progress: true

on:
workflow_call:
inputs:
@@ -41,6 +37,7 @@ on:
required: false
default: "./"
type: string

secrets:
github-username:
description: "The GitHub username for committing the changes."
@@ -61,6 +58,10 @@ on:
description: "The old version of the package."
value: ${{ jobs.create-release.outputs.old-version }}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-python-poetry-release
cancel-in-progress: true

MichaelKora marked this conversation as resolved.
Show resolved Hide resolved
jobs:
create-release:
name: Release
9 changes: 5 additions & 4 deletions .github/workflows/release-tag-versions.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: Reusable workflow for releasing tag versions

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-release-version
cancel-in-progress: true

on:
workflow_call:
inputs:
@@ -24,6 +20,7 @@ on:
required: false
default: "SNAPSHOT"
type: string

secrets:
github-email:
description: "The GitHub email for committing the changes."
@@ -35,6 +32,10 @@ on:
description: "The GitHub token for committing the changes."
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-release-version
cancel-in-progress: true

MichaelKora marked this conversation as resolved.
Show resolved Hide resolved
jobs:
bump_and_release:
runs-on: ubuntu-latest
8 changes: 4 additions & 4 deletions .github/workflows/test-python-setup-poetry.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: Test python-setup-poetry action

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-test-python-setup-poetry
cancel-in-progress: true

on:
pull_request:
branches:
@@ -15,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: true

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