Skip to content

Add "Merge when pipeline succeeds and approved" strategy

What does this MR do and why?

Related to #407352 (closed) and #8128 (closed).

As a result of the related spike, this MR is a draft with proof of concept for new auto-merge strategy: "Merge when approved and pipeline succeeds". The idea is to release this behind a feature flag.

It is similar to "merge when pipeline succeeds", but can also be enabled before approvals are given. When this strategy is enabled and pipeline finishes before the approvals are given, the MR gets merged with the final required approval given.

Screenshots or screen recordings

Various scenarios

Approval is given before pipeline succeeds (same behavior as the current MWPS)

approvals_before_pipeline_succeeds

Approval is given after pipeline succeeds (new behavior that merges the MR)

approvals_after_pipeline_succeeds

Merge is clicked after the approval is given and pipeline succeeds (current behavior without auto-merge)

merge_after_pipeline_and_approvals

With feature flag :merge_when_approved_and_pipeline_succeeds disabled (uses MWPS)

mwps

Email preview

HTML

CleanShot_2023-05-23_at_11.29.36_2x

plain-text

CleanShot_2023-05-23_at_11.30.25_2x

How to set up and validate locally

  1. Enable the feature flag
    Feature.enable(:merge_when_approved_and_pipeline_succeeds)
  2. Open an MR which requires approval
  3. Click "Set to auto-merge"
  4. Wait until pipeline succeeds
  5. Approve
  6. MR gets merged

Todos

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Martin Čavoj

Merge request reports

Loading