Skip to content

Ensure the train ref is mergeable

Hordur Freyr Yngvason requested to merge ensure-mergeable-train-ref into master

What does this MR do and why?

Ensure the train ref is mergeable

In order for it to be safe to fast-forward merge directly from the merge train ref, the ref needs to look exactly like the target branch would on merge. This was not always the case: Old merge trains did not respect most merge preferences, such as the commit message, squashing, and the project's merge method. Thus, it was possible for train refs to include commit messages that should not be merged.

To solve this, we rely on the presence of a recently added merge parameter and ensure it is only present for mergeable train refs.

#421588 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. To test the happy path still works, follow the steps in !130763 (merged)
  2. To verify the primary edge case behaviour, repeat the previous step, but with the following variation:
    • Have merge_trains_create_ref_service disabled when you add the first car to the train
    • Enable the flag before the last merge train pipeline finishes
    • Add more MRs to the train with the flag enabled
    • The new cars should continue being built using the legacy merge commit message
    • The first car should merge successfully, but the ones added later should fail merging with a rebase error

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Hordur Freyr Yngvason

Merge request reports