Specify that an MR must be merged after another MR
Problem to solve
At GitLab, we have two separate projects - https://gitlab.com/gitlab-org/gitlab-ce and https://gitlab.com/gitlab-org/gitlab-ee
Sometimes we need to create an MR, containing the same code, against both projects. When we do this, it is imperative that the EE MR be merged before the CE MR. This means that, as maintainers, we can't simply "set and forget" the "Merge When Pipeline Succeeds" flag - we have to keep an eye on the EE MR, and manually press the merge button on the CE MR once it merges.
Further details
Recent example:
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23655
- https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/8755
MWPS was used on these two MRs. The CE MR was merged almost 30 minutes earlier than the EE MR, contravening our stated policy. It happened to be fine at this time, with these MRs, but in the future, this could lead to the CE MR being automatically reverted.
One way of solving this is with "super merge requests" - https://gitlab.com/gitlab-org/gitlab-ee/issues/6424 / https://gitlab.com/gitlab-org/gitlab-ee/issues/3427 - but this is EE-only and, perhaps too big a bite. It also ensures that all MRs go in at the same time, when all we need here is for one MR to go in after another.
Another example would be gitaly-proto
-> gitaly
-> gitlab-ce
merges where each project should be changed in a certain order, versions incremented and dependencies bumped.
Proposal
Allow merge requests to be related to each other, so that the order in which they should merge can be described.
Working as a developer, I will be able to:
- open my
gitlab-ce
andgitlab-ee
merge requests - add a link between the two merge requests indicating that the
gitlab-ee
merge request must merge before thegitlab-ce
merge request
If a merge request is ready to merge (including merge when pipeline succeeds), but it is related to an unmerged merge request with the "merge after" attribute, then the merge is prohibited. This will prevent the gitlab-ce
merge request accidentally being merged before the corresponding gitlab-ee
merge request is merged.
The next iteration (TODO) would allow the merge button to be clicked on the gitlab-ce
merge request if the gitlab-ee
merge request is mergeable, triggering the gitlab-ee
merge request then the gitlab-ce
merge request.
What does success look like, and how can we measure that?
Merge requests are already highly utilized, but there are many large projects/applications with related repositories where changes regularly span multiple repos. We can measure usage by extending the usage ping to measure how many merge request relationships are created. This should increase as we continue to implement group merge requests further.
As a GitLab maintainer, I can set MWPS on a CE+EE MR pair and walk away, confident that they will be merged in the right order