Skip to content

Commit efd9b29

Browse files
committed
ci: fix cancelled jobs in CI merge queue
The CI merge queue failed again, see cyberus-technology#89 [0]. We are using the concurrency cancellation feature in GitHub to cancel outdated CI jobs on new pushes. It works similar to "interruptible" in GitLab. However, with the GitHub merge queue, this causes often weird behavior where jobs are suddenly cancelled in the merge train. I couldn't find proper documentation for that specific combination of features (merge queue + concurrency group) and what fails here doesn't fail in other projects that use these both things. In a GitHub merge queue in this project, each job is created twice by default (as we have `on merge_group and `on pull_request` in the CI file): - for the PR/push itself - for the merge queue Currently, sometime our merge queue fails because some of these jobs are cancelled: ``` Canceling since a higher priority waiting request for Build-refs/heads/gh-readonly-queue/main/pr-89-b4aed85cf70ae7e2df098e42c352c3dd62ef9173 exists ``` To prevent cancellation, I try to switch to more distinct concurrency groups. I didn't find proper documentation or best practices, but with some research, I came up with this solution. [0] https://github.com/cyberus-technology/libvirt-tests/actions/runs/20262687453/job/58178287796 On-behalf-of: SAP philipp.schuster@sap.com Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
1 parent b4aed85 commit efd9b29

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ on:
66
push:
77

88
concurrency:
9-
group: ${{ github.workflow }}-${{ github.ref }}
10-
cancel-in-progress: true
9+
# Special care needs to be taken here to prevent cancelled runs in the GitHub
10+
# merge queue.
11+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
12+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1113

1214
jobs:
1315
checks:

0 commit comments

Comments
 (0)