Allow Merge Request with Dependencies into the Merge Train if all Dependencies are in that Train

Problem

As a developer working on an MR that is dependent on another MR already on the merge train, I want to be able to add an MR to the train, so I don't have to wait/monitor/watch the MR on the train to wait for it to merge.

Proposal

If a merge request has dependencies to other merge requests, it can currently only be added to a merge train once all dependencies are merged. This could be relaxed such that the merge request can already be added to a merge train if all remaining dependencies are already part of that same merge train (guaranteed to be merged in the correct order).

Should any of the dependencies be dropped from the merge train, the merge request has to be removed from the train as well. Since the dependency was ahead of the merge request when it failed, all requests behind the merge request would need to be re-triggered anyway -> this does not lead to additional re-run effort on the train.

Usage Scenario

A bigger feature is split into several merge requests that build upon each other (especially after #11393 (closed) (complex dependencies) is implemented). If both the base MR and one or more follow-up MRs are ready to be merged, they could then be added to the merge train at the same time. In cases where it takes some time for a MR to get merged after being added to the train (in our case this sometimes takes up to 24h), merging long dependency chains becomes impractical. A workaround would be to first merge the dependencies into their base MRs, but that changes the scope of the base MR (suddenly the MR changes more than its description states).

Use Cases / Details

  • Handle a single dependent MR, if it is on the train allow this MR to be added.
  • If the MR this MR is dependent on is kicked off the train this MR should also be kicked off the train
Edited by James Heimbuck