Merge request using multiple pipelines native/external
We have a gitlab repository that triggers multiple pipelines for merge requests.
- Native gitlab-ci pipeline.
- External Jenkins pipelines using webhooks
The gitlab pipelines triggers a merge request pipeline
And though the webhook a commit pipelines is triggered.
I would expect that only gitlab pipeline would be used as a gatekeeper for the merge request because its a merge request pipeline but apparently I see that in case a jenkins pipeline gets triggered after the gitlab pipeline, it takes over the gatekeeper pipeline on the overview of the MR.
So it starts like this:
And then when jenkins gets triggered it changes to this:
And eventually in case I re-trigger Jenkins or create a merge request pipeline, the latest will become the gatekeeper pipelines.
If my expectations were true (that only merge request pipeline should be taken into account).
Then I could write a gitlab job as part of the pipeline, and using gitlab api I could ensures that jenkins jobs are also passing.
Could anyone please suggest how to deal with this problem ?
My goal is:
- To ensure that both gitlab and jenkins pipelines are passing.
- Jenkins pipelines to appear as pipelines on gitlab so that developers can easily access them.
Other things I tried:
At the beginning I thought that this is happening because the jenkins pipeline is updating the latest commit of this merge request, but while I was trying different things I also tried to use merge result pipelines.
For merge request pipelines a new “virtual” commit is generated for creating the “merge result”, so latest commit for the merge request is not the same as the latest commit triggered for Jenkins. But apparently the latest jenkins pipeline still becomes the pipeline to allow merge request to be merged.
Here is the merge result pipeline:
And here is what happens on overview of the MR after jenkins job triggers/finish
The version is: GitLab Enterprise Edition 15.10.3-ee
Thanks for taking the time to read this long topic.