👷 Auto-cancel interruptible jobs on new commits#4571
Merged
thomas-lebeau merged 4 commits intomainfrom May 7, 2026
Merged
Conversation
Without this directive, GitLab relies on the project-level "Auto-cancel redundant pipelines" setting, which is currently not effective for this project. Explicitly enabling `auto_cancel.on_new_commit: interruptible` ensures interruptible jobs (e.g. unit-bs, e2e-bs queued behind the browserstack resource group) are cancelled when a new commit lands on the same branch.
BenoitZugmeyer
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
When pushing several commits in quick succession to a branch, in-flight pipelines keep running and consume CI resources even though only the latest one matters. This is especially wasteful for jobs queued behind
resource_group: browserstack, where superseded commits can sit in the BS queue for an hour and still run to completion.GitLab's documented default for
workflow.auto_cancel.on_new_commitisconservative, which should already cancel interruptible jobs on new commits to the same ref. In practice this doesn't seem to be working for our project anymore — pushing a new commit while a pipeline is still in the test stage does not cancel the older pipeline, even though all running jobs are markedinterruptible: true.Setting the keyword explicitly fixes this.
Changes
workflow.auto_cancel.on_new_commit: interruptibleto.gitlab-ci.ymlso pipelines superseded by a newer commit on the same branch are cancelled automatically.Test instructions
Validated on this branch by pushing back-to-back commits:
unit-bs/e2e-bsstayed queued inwaiting_for_resource.unit-bsande2e-bs) transitioned tocanceled.The empty
🧪 testcommits on this branch were used purely to exercise the behaviour and will be dropped when squashing the PR to main.Checklist