A job with catch-all rules entry triggers a Merge Request Pipeline
Summary
Creating a CI job with a catch-all rules
entry (containing only a when
key) causes an additional Merge Request Pipeline to be created without all the other jobs.
Steps to reproduce
Create a CI yaml file with the following content:
stages:
- build
- deploy
job1:
stage: build
script:
- echo "Job 1!"
job2:
stage: deploy
rules:
- if: '$CI_COMMIT_REF_NAME == "master"'
when: always
- when: manual
script:
- echo "Job 2!"
Job 1 is a compile/test job and should always run. It should especially run for merge requests.
Job 2 is a deploy job and should only run on master, or when the user wants it to on any given commit, triggered manually.
Example Project
See here: thirtythreeforty/merge-request-ci-debug!1
What is the current bug behavior?
The YAML, which makes no mention of merge_requests
, creates a Merge Request Pipeline containing only a manually-executable Job 2. Job 1 is not included.
It also creates a "normal" branch pipeline containing Job 1 and Job 2 (manual).
The merge request refuses to allow the branch to be merged, because the (blocked) MR Pipeline has not finished.
What is the expected correct behavior?
For the example yaml given, no Merge Request Pipeline should be created at all, and the MR should use the normal branch pipeline containing Job 1 and Job 2 (manual).
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com.