Once a commit is merged from the train to the target branch will CI run again on the commit to the target branch? I suppose the answer is "yes" because the master branch might run a different CI pipeline to the one used for MRs and branches.
In this scenario I am a bit worried about the impact this will have on our CI resources. Each MR will be built three times.
When the MR is made,
When it joins the train
When it is merged.
The second and third runs should run CI on exactly the same commit as each other so are redundant if the pipelines are the same. Running CI on master is essential to make artifacts available though so unless there is some thought given to this in the implementation I fear the merge train will be too costly when CI takes a long time to run (6 hours for us).
Perhaps it would be good to allow more of a batch mode which groups a number of MRs together into a batch and then builds each one individually after they have landed.
Intended users
Developers
Further details
Proposal
It's not the initial case for merge trains, but some users may want queueing of merges into master without the merge request pipeline to validate that things will work. They are more interested in an orderly flow of changes to master than about any particular pipeline breaking master. This issue would introduce the ability to set up merge trains that just merge in sequence, without the merge request pipeline.
Permissions and Security
Documentation
What does success look like, and how can we measure that?
There is some misunderstanding here. We definitely want to make sure MRs pass before they are merged to master but we potentially don't have the CI resources to run both steps 2 and 3 which have identical pipelines and should produce the same result.
Thanks for confiming @mpickering. If your goal is just to disable 2, then wouldn't you achieve that by not enabling merge trains? Sorry if I'm being daft here, but that sounds to me like the existing flow we have today.
The existing flow doesn't work for us as "Merge when pipeline succeeds" is incompatible with the "Fast-forward only" merge strategy. This is worked around now by using a merge bot which acts in a similar manner to the proposed merge train.
We don't want to disable 2, as that ensures only good commits reach master, I was musing about the possibility of sharing work between 2 and 3 if they run the same jobs as each other.
We also have teams interested in having the Merge Train feature as a more basic "just queue" MRs instead of having to set up specific pipelines for merge requests.
I guess this request makes more sense for fast-forward strategies, as it would be just an easy way to set up MR dependencies, and just rebasing the code should be enough to verify that the MR is correct by running the whole pipeline.
For other strategies it wouldn't offer any guarantee, as the guarantee it's specifically that pipeline with on: merge_request jobs.
@v_mishraMerge Request Dependencies could easily benefit from this capability for teams that aren't using CI Pipelines - it the capability allowed queueing of Merge Requests that are dependent on other MRs.
Thanks for the tag @poffey21 (this missed our radar because of the wrong labels. Fixed it)
Merge Request Dependencies could easily benefit from this capability for teams that aren't using CI Pipelines - it the capability allowed queueing of Merge Requests that are dependent on other MRs.
This sounds like a really interesting take. cc @jheimbuck_gl I've marked this as workflowproblem validation for now. This issue will increase the scope for merge trains as a feature.
@jheimbuck_gl the stacked diffs offering feels relatively similar to I think what the goal would be, where you can bundle merges easily together and then queue them up for merge - but not necessarily dependent upon the Merge Train or even CI Pipelines.
@jheimbuck_gl I'm not sure I even understand what this issue and conversely this thread are asking for in terms of features.
We do have an issue for stacked diffs, but it's not anything we're looking at currently.
The relation to merge request dependencies isn't clear to me either because I believe stacked diffs, like other forms of working with atomic commits can be merged in any order with/without the other things also being merged.
I could see an enhacement to merge request dependencies that does allow you to queue automatically merge all the MRs if they all meet requirements (which is maybe the ask here?), but I'd have to think about that more.
I could see an enhacement to merge request dependencies that does allow you to queue automatically merge all the MRs if they all meet requirements (which is maybe the ask here?)
@jheimbuck_gl and @phikaian enhacement to merge request dependencies that does allow you to queue automatically merge all the MRs was exactly what I was thinking. The reason I was including it here is that it feels like a UI for stacked MRs (be it merge trains or dependent MRs) might actually be able to solve many of these problems at the same time and get us closer to the Stacked Diffs construct #24528.
@jheimbuck_gl It sounds like what @poffey21 is asking for should be a new issue about queuing merge request dependencies. I'm not sure that's what this issue is describing as this issue seems to be talking about batching up CI related things.
@veethika I think it's somewhat related (due to their CI usage concern), but not exactly a duplicate of #415838. I do, however, think this issue should be closed because it's not entirely clear what the actual problem to solve is or how the proposals would help.
Here, it sounds like the proposal is to allow merge trains but skip the actual merge train pipeline. Which doesn't make much sense to me. Why use merge trains then? And it's already possible to do this using rules to filter out undesired jobs with something like if: $CI_MERGE_REQUEST_EVENT_TYPE != 'merge_train'. I would, however, suggest doing the opposite: Run a predictive test suite in merge requests (tune the completeness of this to minimize merge train flakiness / time to merge), run a full test suite in merge trains, and only a minimal set of jobs on the stable branches (release artifacts etc), with the exception that a full test suite should run for merges that have bypassed the train. All of this is already possible today.
Skipping the merge train pipeline also wouldn't help with the use case stated within the "Proposal" section:
They are more interested in an orderly flow of changes to master than about any particular pipeline breaking master. This issue would introduce the ability to set up merge trains that just merge in sequence, without the merge request pipeline.
Merges are always sequential, regardless of whether merge trains are used. That's just how git works. And specific merge ordering can be enforced using dependencies. Again, no merge trains required. It sounds like maybe they also want stacked merge request workflows, which are currently a focus of investigation.
I would, however, suggest doing the opposite: Run a predictive test suite in merge requests (tune the completeness of this to minimize merge train flakiness / time to merge), run a full test suite in merge trains, and only a minimal set of jobs on the stable branches (release artifacts etc), with the exception that a full test suite should run for merges that have bypassed the train. All of this is already possible today.
Skipping the merge train pipeline also wouldn't help with the use case stated within the "Proposal" section:
Looking at the conversation in the thread above #10397 (comment 972991730) it does seem like there are mostly inferences going in terms of what's expected here. As a team we have a much better understanding of the feature today and also a clear vision. The epic &12024 has a clear vision and we don't know how this issue fits into it.