Add feature flag allowing auto merge for incomplete pipelines
What does this MR do and why?
This adds a feature flag expanding the availability of "when pipeline succeeds"-type auto merges.
With this change, when the flag
auto_merge_when_incomplete_pipeline_succeeds
is enabled, auto merges
will also become available for pipelines in the following states:
-
created
: Users expect "when pipeline succeeds" action to be the default auto merge strategy as soon as they see the new pipeline. Users can see a pipeline as soon as it exists, even before it starts processing, and excludingcreated
has caused unexpected immediate merges. -
manual
,scheduled
: Both of these imply a type of delayed execution that is intentional, but could still benefit from increased merge automation (not having to wait for the action to be completed).
See:
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
- Enable the flag
auto_merge_when_incomplete_pipeline_succeeds
:Feature.enable(:auto_merge_when_incomplete_pipeline_succeeds)
- In a project, create a merge request changing the
.gitlab-ci.yml
toworkflow: rules: - if: $CI_MERGE_REQUEST_IID - if: $CI_COMMIT_TAG - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH test: script: echo hi when: manual allow_failure: false
- Observe that the merge action is an auto-merge instead of an immediate merge.
- Set the MR to auto merge
- Run the pipeline
- Observe that it merges
Edited by Hordur Freyr Yngvason