The behaviour of the merge request pipelines is unclear
Description
The documentation about "Pipelines for merge requests" seems to miss a few details which cause me some confusion.
Steps to reproduce
Running a job for a merge request is quite clear: add merge_requests
to the "only" array.
The problem is when gitlab-ci.yml
has many jobs which must run to validate any push, including a merge request.
Suppose that we have the following stages:
stages:
- pre-flight
- quality
- test
- build
- documentation
- deploy
pre-flight
Contains only one job which builds a dependencies cache using a "push" policy.
quality
Contains several jobs:
- One runs some static code analysis on the changed code ("merge_request" only, since that's the only way to get the source and target branch which are required to build a proper diff).
- A few other jobs run full static code analysis: only "master" and "develop" (not sure if I must specify "except: merge_requests"
Test
All sort of automated tests.
"merge_requests" is not specified in "except/only".
Build, Documentation, Deploy
I think their purpose is pretty clear.
"merge_requests" is not specified in "except/only".
Actual result
When I create a merge request or push changes in a branch which has a merge request, I get two pipelines, as described in the docs.
The docs also say that the detached pipeline has the precedence, but it seems that if this pipeline pass and the other one fails, the merge request will show no issues and will allow merging despite the "Pipelines must succeed" setting being checked.
Expected result
The merge request must show the failed pipeline below the description and prevent merging if any pipeline (attached or not) fails.