Skip to content

Child pipelines fail to create on merge requests

Summary

When trying to use child pipelines, for microservice architecture for example, commits to MRs are parsed as pipelines for merge requests and fail to create the child pipelines, causing MRs to be un-mergeable.

Steps to reproduce

To start, create a project with a CI configuration similar to this:

stages:
  - triggers

trigger_a:
  stage: triggers
  trigger:
    include:
      - local: services/a/.service-ci.yml
    strategy: depend
  rules:
    - changes:
        - services/a/**/*

trigger_b:
  stage: triggers
  trigger:
    include:
      - local: services/b/.service-ci.yml
    strategy: depend
  rules:
    - changes:
        - services/b/**/*

And a directory structure where the dirs services/a and services/b both exist. They should each have an existing CI configuration as listed in the include blocks above - this can just be a simple job that runs an echo script for testing.

  1. Create a new branch with changes to files in either of the subdirectories services/a or services/b.
  2. Push the changes to GitLab and create a new MR.
  3. The pipeline for the MR will fail - the pipeline that runs will be detached and unable to create the child pipeline

Example Project

https://gitlab.com/philbz/child_pipeline_bug_repro

What is the current bug behavior?

The pipeline for the MR will be run detached, unable to create the child pipelines. As a result, the entire pipeline will fail with the error message: downstream pipeline cannot be created.

What's interesting is that the pipeline works fine in the context of the branch itself, it's only the merge request context that causes it problems.

What is the expected correct behavior?

The child pipeline(s) should be created for the merge request.

We list a very similar workflow in our parent/child pipeline documentation as far as creating this architecture for microservices, so it's hard to understand why it would not work.

In that same document, we explain merge request child pipelines, which is not what I am intending to do here, but that seems to be how the configuration is being parsed. I also tried using the rules syntax there to only evaluate in the context of a merge request, but this gave the same failure.

Relevant logs and/or screenshots

n/a

Output of checks

This bug happens on GitLab.com

Possible fixes

I'm not sure if this is a parsing issue or what. My feeling was there's some kind of limitation around pipelines executing in the context of merge requests not being able to execute child pipelines, but if that were the case I don't think we would have it in our docs. Is this even a bug, or is it a known limitation? In either case it seems like a fairly common workflow that I derived almost entirely from our docs. It affects at least one customer that I know of: https://gitlab.zendesk.com/agent/tickets/156756 (internal link)

Edited by Phil Zona