Skip to content

Ensure that dynamic child pipeline depends explicitly on the generator job

Problem

When using "Dynamic Child Pipeline" feature we are not strictly checking whether the job generating the configurations is a dependency for the trigger job using the generated configuration.

The following snippet has child-pipeline job running before generate-config. This will cause the following behavior:

  1. Parent pipeline is created successfully
  2. Parent pipeline's jobs are enqueued
  3. Trigger job child-pipeline runs and attempts to create a child pipeline
  4. The child pipeline fails with error Job generate-config not found in parent pipeline or does not have artifacts
  5. Trigger job fails by consequence
  6. Parent pipeline fails by consequence
child-pipeline:
  stage: test
  trigger:
    include:
      - artifact: generated-config.yml
        job: generate-config

generate-config:
  stage: deploy
  script: generate-ci-config > generated-config.yml
  when: always
  artifacts:
    paths:
      - generated-config.yml

Expected behavior

  1. Parent pipeline fails immediately showing an error child-pipeline does not depend on a generate-config job

Original discussion: !23790 (comment 298174064)

Edited by Fabio Pitino