Skip to content

Commit

Permalink
.github: Cancel outdated comment workflows
Browse files Browse the repository at this point in the history
When updating a pull request, workflows associated with the previous
version continue to run. A way to prevent that and cancel outdated
workflows is to use concurrency groups.

This commit fixes workflows running on a schedule or on PR comment.
We define each concurrency group such that they are unique to the
pull request (via PR URL) if triggered by event issue_comment.

For each workflow, there's a single concurrency group for all scheduled
runs. That assumes the timeout of scheduled workflows is always shorter
than the duration between two runs.

Signed-off-by: Paul Chaignon <paul@cilium.io>
  • Loading branch information
pchaigno authored and tklauser committed May 19, 2021
1 parent dacbd85 commit 7e953b9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/aks.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: ConformanceAKS (ci-aks)

# Any change in triggers needs to be reflected in the concurrency group.
on:
issue_comment:
types:
Expand All @@ -13,6 +14,10 @@ on:
# - "labeled"
###

concurrency:
group: "${{ github.workflow }} ${{ github.event.issue.pull_request.url || 'scheduled' }}"
cancel-in-progress: true

env:
name: ${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }}
location: westeurope
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/eks.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: ConformanceEKS (ci-eks)

# Any change in triggers needs to be reflected in the concurrency group.
on:
issue_comment:
types:
Expand All @@ -13,6 +14,10 @@ on:
# - "labeled"
###

concurrency:
group: "${{ github.workflow }} ${{ github.event.issue.pull_request.url || 'scheduled' }}"
cancel-in-progress: true

env:
clusterName: ${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }}
region: us-east-2
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/gke.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: ConformanceGKE (ci-gke)

# Any change in triggers needs to be reflected in the concurrency group.
on:
issue_comment:
types:
Expand All @@ -13,6 +14,10 @@ on:
# - "labeled"
###

concurrency:
group: "${{ github.workflow }} ${{ github.event.issue.pull_request.url || 'scheduled' }}"
cancel-in-progress: true

env:
clusterName: ${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }}
zone: us-west2-a
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/multicluster.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Multicluster / Cluster mesh (ci-multicluster)

# Any change in triggers needs to be reflected in the concurrency group.
on:
issue_comment:
types:
Expand All @@ -13,6 +14,10 @@ on:
# - "labeled"
###

concurrency:
group: "${{ github.workflow }} ${{ github.event.issue.pull_request.url || 'scheduled' }}"
cancel-in-progress: true

env:
clusterName1: ${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }}-mesh-1
clusterName2: ${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }}-mesh-2
Expand Down

0 comments on commit 7e953b9

Please sign in to comment.