Refresh Merged Result Pipelines when the target branch contains new commits
Description
As a SW Engineer, I want to have pipelines that includes the state of the main branch in the pipelines of my feature branch. Thus, I am using the Merged Result Pipelines feature.
Current Situation
After pushing a change to the feature branch and the pipeline is over, pushing a change in the main branch will not trigger a new pipeline, which makes the pipeline of the feature branch obsolete. I am able to merge the MR with an obsolete Merge Result Pipeline that could finally fail after merging in the master branch.
Ideal situation
After changing the merge request, it would be useful to know that the Merged Result Pipeline is obsolete. Either the pipeline in the development branch could be triggered again automatically to always be up-to-date (thus I imagine scalability issues this could cause on a large project with several branches). Or the team could be informed that the pipeline is stale when looking at the MR (in a similar way that we are notified when conflicts are detected) and the developer can decide to force merge or to restart a pipeline before merging.
Steps to reproduce
- Create a GitLab project
- Enable Merged Result Pipelines
- Create a
.gitlab-ci.yml
file with 2 simple jobs printing "hello world" in the main branch - Create a branch from main and create a merge request for that new branch
- In the main branch, change the print of the second job to "hello world 2"
- In the feature branch, change the print of the first job to "hello world 1"
- Observe the pipeline of the feature branch running and the change of the main branch being integrated in the pipeline result
- Then do a change again to the main branch, for example change the second job to "hello world 3"
Now on the merge request, the pipeline result is stale but to know about it, I have to know exactly what was the commit used at that time on the main branch.
Possible workaround
Create a job in the Main branch's pipeline that would trigger a pipeline on all existing MR or post a message in all MR to notify the dev