Skip to content

Merge immediately possible in invalid scenarios with merge trains enabled

Summary

If pipelines must succeed is configured, MRs should only be merged if a pipeline has successfully run. However, this is not currently being enforced for pipelines for merged results (and therefore downstream features like merge trains). If both of these features are on it is possible to click on merge immediately and skip the "pipeline must succeed" protection, regardless of whether or not master is still at the ref that the pipeline validated.

(see also here and here)

Steps to reproduce

  • Be sure to configure Pipelines for merged results and Pipelines must succeed

Screenshot_2020-07-01_at_14.22.24

  • Create a branch and commit something
  • Open an MR to merge the branch to master
    • a pipeline will be started on the merged result and succeed
    • Start merge train / merge immediately will be available on the MR (correct behavior so far)
  • Push another change directly to master. Master will be advanced as compared to the MR pipeline.
  • Merge immediately is still available on the MR (bug)

Example Project

https://gitlab.com/mbruemmer/new-project

What is the current bug behavior?

  • Merge immediately is available even though target branch is advanced

What is the expected correct behavior?

  • Merge immediately is only available if the target branch is not advanced

Relevant logs and/or screenshots

Screenshot_2020-07-01_at_14.12.00

As seen in this screenshot, Master is ahead by 1 commit but I can still merge immediately, even though the pipeline for merged results is no outdated.

Output of checks

This bug happens on GitLab.com

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Check to make sure that the pipeline that succeeded against master is still valid before presenting "merge immediately". If master has advanced, clearly say why merging immediately is not possible.

Edited by Veethika Mishra