Skip to content

Triggering multiple dynamically generated child pipelines in a single phase causes all but one to fail

Summary

Running multiple children pipelines in the same stage which use different causes all of them except one to fail. The first job as specified in the .gitlab-ci.yml succeeds, the rest fail with a "yaml invalid" error (ex).

Steps to reproduce

.gitlab-ci.yml:

stages:
  - generate
  - run

generate-config:
  stage: generate
  script:
    - ./generate-configs.sh
    - cat config-a.yml
    - cat config-b.yml
  artifacts:
    paths:
      - config-a.yml
      - config-b.yml

trigger-a:
  stage: run
  trigger:
    include:
      - artifact: config-a.yml
        job: generate-config

trigger-b:
  stage: run
  trigger:
    include:
      - artifact: config-b.yml
        job: generate-config

generate-configs.sh:

#!/bin/bash

cat > config-a.yml <<HEREDOC
service-a-1:
  script:
    - echo 'job 1 for service A'
service-a-2:
  script:
    - echo 'job 2 for service A'
HEREDOC

cat > config-b.yml <<HEREDOC
service-b-1:
  script:
    - echo 'job 1 for service B'
service-b-2:
  script:
    - echo 'job 2 for service B'
HEREDOC

Example Project

https://gitlab.com/fgrimshaw/dynamic-ci

What is the current bug behavior?

The second generated child pipeline here fails with an invalid yaml error: https://gitlab.com/fgrimshaw/dynamic-ci/pipelines/129356665

What is the expected correct behavior?

The second generated child pipeline here shouldn't fail with an invalid yaml error

Relevant logs and/or screenshots

Not logs or screenshots, but here is some relevant information:

  • In the example .gitlab-ci.yml, reversing the order of trigger-a and trigger-b causes b to succeed and a to fail
  • Any extra dynamic child pipelines fail similar to b in the example project
  • Splitting up generate-config into separate jobs for a and b does not have an effect
  • This only occurs when trigger-a and trigger-b appear in the same stages; this does not happen when they are in separate stages
  • The bug does not occur in Fabio Pitino's demo video here: https://www.youtube.com/watch?v=nMdfus2JWHM

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

N/A

Results of GitLab application Check

N/A

Possible fixes

N/A

Edited by Finn Grimshaw