WIP: Enqueue, merge and drop actions for merge trains
What does this MR do?
Basically, merge train has three actions:
- Enqueue a merge request to a train
- Merge a merge request on a train
- Drop a merge request on a train
This MR adds MergeTrainService
to support these actions and call the methods in relevant places.
Given there are two merge requests MR1 and MR2, here is a scenario and the expected behavior:
Scenario A)
- User enqueues MR1. The system creates a merge request pipeline run a merge ref from its source and target branch.
- User enqueues MR2. The system creates a merge request pipeline run a merge ref from its source and MR1's
refs/train
. - MR1's merge request pipeline succeeded. The system merges MR1.
- MR2's merge request pipeline succeeded. The system merges MR2.
Scenario B)
- User enqueues MR1. The system creates a merge request pipeline run a merge ref from its source and target branch.
- User enqueues MR2. The system creates a merge request pipeline run a merge ref from its source and MR1's
refs/train
. - MR1's merge request pipeline failed. The system doesn't merge MR1 and drops it from the train. The system runs a new pipeline on MR2 in order to regenerate the correct merge ref.
- MR2's merge request pipeline succeeded. The system merges MR2.
Scenario C)
- User enqueues MR1. The system creates a merge request pipeline run a merge ref from its source and target branch.
- User enqueues MR2. The system creates a merge request pipeline run a merge ref from its source and MR1's
refs/train
. - MR2's merge request pipeline succeeded, but the system doesn't merge MR2. It waits until MR1 has been merged.
- MR1's merge request pipeline succeeded. The system merges MR1 and MR2 altogether.
TODO:
- push to merge request,
- change of merge request between WIP and non-WIP,
- change of target branch,
- close and re-open of MR,
- removal/destroy of MR?
Reference: https://gitlab.com/gitlab-org/gitlab-ee/issues/9186
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation created/updated or follow-up review issue created -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Performance and testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Shinya Maeda