Skip to content

WIP: Enqueue, merge and drop actions for merge trains

Shinya Maeda requested to merge connect-events-for-merge-train into master

What does this MR do?

Basically, merge train has three actions:

  1. Enqueue a merge request to a train
  2. Merge a merge request on a train
  3. 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)

  1. User enqueues MR1. The system creates a merge request pipeline run a merge ref from its source and target branch.
  2. User enqueues MR2. The system creates a merge request pipeline run a merge ref from its source and MR1's refs/train.
  3. MR1's merge request pipeline succeeded. The system merges MR1.
  4. MR2's merge request pipeline succeeded. The system merges MR2.

Scenario B)

  1. User enqueues MR1. The system creates a merge request pipeline run a merge ref from its source and target branch.
  2. User enqueues MR2. The system creates a merge request pipeline run a merge ref from its source and MR1's refs/train.
  3. 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.
  4. MR2's merge request pipeline succeeded. The system merges MR2.

Scenario C)

  1. User enqueues MR1. The system creates a merge request pipeline run a merge ref from its source and target branch.
  2. User enqueues MR2. The system creates a merge request pipeline run a merge ref from its source and MR1's refs/train.
  3. MR2's merge request pipeline succeeded, but the system doesn't merge MR2. It waits until MR1 has been merged.
  4. MR1's merge request pipeline succeeded. The system merges MR1 and MR2 altogether.

TODO:

  1. push to merge request,
  2. change of merge request between WIP and non-WIP,
  3. change of target branch,
  4. close and re-open of MR,
  5. removal/destroy of MR?

Reference: https://gitlab.com/gitlab-org/gitlab-ee/issues/9186

Does this MR meet the acceptance criteria?

Conformity

Performance and testing

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

Merge request reports