Merge request pipeline workflow fails with child pipelines
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
It seems like child pipelines don't inherit the workflow:rules from the upstream pipeline. If you are attempting to include Workflows/MergeRequest-Pipelines.gitlab-ci.yml and create a pipeline from a merge request, the child pipeline will fail to create with "Downstream pipeline cannot be created, no stages/jobs for this pipeline." However, this works when running a pipeline on master.
.gitlab-ci.yml
include:
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
image: node:14-buster
build_pipeline:
trigger:
include:
- project: 'gitlab-gold/cbledsoe-test/mr-template-test-downstream'
ref: 'master'
file: 'node/build/.application-build-stages.gitlab-ci.yml'
strategy: depend
.application-build-stages.gitlab-ci.yml
stages:
- build
build:
stage: build
script:
- echo "This is a build job"
If you insert a job, it will run but shouldn't be a requirement:
include:
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
image: node:14-buster
job_1:
script:
- echo "This should now run"
build_pipeline:
trigger:
include:
- project: 'gitlab-gold/cbledsoe-test/mr-template-test-downstream'
ref: 'master'
file: 'node/build/.application-build-stages.gitlab-ci.yml'
strategy: depend
Lastly, if you replace the included workflow and just add it directly, it still does not work and fails similarly:
.gitlab-ci.yml
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
image: node:14-buster
build_pipeline:
trigger:
include:
- project: 'gitlab-gold/cbledsoe-test/mr-template-test-downstream'
ref: 'master'
file: 'node/build/.application-build-stages.gitlab-ci.yml'
strategy: depend
Example Project
See ZD Ticket.
What is the current bug behavior?
When including Workflows/MergeRequest-Pipelines.gitlab-ci.yml with parent-child pipelines, the pipeline fails with Downstream pipeline cannot be created.
What is the expected correct behavior?
We would expect that when you use the merge requests pipelines workflow, it would work with parent child pipelines and the child pipeline would inherit rules.
ZD Ticket (Internal Use)
Output of checks
This happens on GitLab.com 13.9.0-pre 9939a5f9