Spike: Investigate automatic merge when ready (succeed pipeline and required approvals added)
Time-box: 3 days
Why are we doing this work
In the scope of this Spike, we would like to understand what we need to do to proceed with Automatically merge when ready (merge checks an... (#8128 - closed). We want to contribute to Automatically merge when ready (merge checks an... (#8128 - closed) and introduce a new strategy to allow maintainers to click Merge when pipeline succeeds and has approvals
. This will allow us to enable #400221+ and will significantly improve GitLab overall.
Based on my initial findings, we must introduce a new strategy in https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/auto_merge_service.rb#L8 that would be similar to https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/auto_merge/merge_when_pipeline_succeeds_service.rb and will automatically merge MR when the pipeline succeeds, MR is in the mergeable state, and we have all needed approvals.
To visualize why we would need it, this scenario: Imagine you have an MR in the gitlab-org/gitlab project where License Approval Policy is defined to require approval from the Legal team when a new dependency with an unmatched license is introduced. You go through the standard review process: get approval from the reviewer, then you get approval from the maintainer, but the maintainer needs to set MWPS as we still require approval from the Legal team. So to make sure the given MR can be merged without revisiting it by the maintainer after we get all the needed approval is the new strategy: MWPS when we have approvals. Then when this is set, we can merge the MR after the Legal team adds their approval without additional involvement from the maintainer.
As an expected result of this Spike, we would like to get the following:
- Draft MR with Proof of Concept of how this change could be implemented (we want to work on backend only, no need to introduce any changes on the UI as they will require additional work with UX team),
- implementation plan added to Automatically merge when ready (merge checks an... (#8128 - closed) to start discussion with groupcode review team,