Follow-up language discussions about auto_cancel configuration
The Feature
workflow:
rules:
- if: $VAR == "value"
auto_cancel:
on_new_commit: none
on_job_failure: noneon_new_commit
I'm somewhat worried that the on_new_commit option isn't quite accurate, because the automatic cancellation is caused by a new pipeline on the same ref, not the new commit. For example if you add new commits with [skip ci] and don't run a new Pipeline, the current one will not autocancel when you push to the repository.
The most obvious alternative, on_new_pipeline isn't full accurate either, because auto_cancel isn't triggered by all pipelines. But it is triggered by most pipelines:
# CI sources are those pipeline events that affect the CI status of the ref
# they run for. By definition it excludes dangling pipelines.
def self.ci_sources
sources.except(*dangling_sources.keys)
end
def self.dangling_sources
sources.slice(:webide, :parent_pipeline, :ondemand_dast_scan, :ondemand_dast_validation, :security_orchestration_policy)
endThis notably leaves out webide: the Run Pipeline button. The security related pipelines and child Pipelines are less "primary" sorts of pipelines, so I think it's reasonable to not auto cancel from those. But if we say "automatically cancel on new pipeline" and don't automatically cancel when someone clicks "Run Pipeline", that's pretty counterintuitive.
- Is there a more accurate, but still concise term we could use instead of "commit" or "pipeline" for
on_* - Can we make
webidepipelines trigger auto-cancellation? Is there a historical reason we don't do that? I vaguely remember the discussion but have not found it.
conservative
"Conservative" is a pretty generic word, and so it's not obvious what this means unless someone goes to the docs and reads about it. It's the default behavior, so it probably won't be explicitly used as often as "all" or "interruptible", but I'm still trying to think of something brief that's more self-descriptive.
interruptible
I had been confused by this in the past, but !141090 (merged) does a very clever job of re-orienting the subject of job:interruptible to the job itself, and away from the whole pipeline that it currently refers to ("conservative" behavior). This is kind of brilliant IMO and unwinds a very confusing configuration feature in an elegant way without a breaking change. I don't actually want to change anything about this. I just want to shout out this change because it makes the original interruptible configuration so much better!
The Docs Page
https://docs.gitlab.com/ee/ci/yaml/#workflowauto_cancelon_new_commit
In !141090 (comment 1719558166), @marcel.amirault brought up the creation of a separate docs page for this function, which I think is a good idea. It's a fairly major piece of CI configuration, and as we're making it more complex, I think an easy place to link to (shorter than the huge configuration doc) for people would be helpful.