Skip to content

Add pipeline schedule variables to forward:pipeline

What does this MR do and why?

In #213729 (closed), we implemented trigger:forward that allows users to have an option to decide sending some variables to downstream pipelines via bridge jobs. (!82676 (merged))

A user report (#357509 (closed)) reminded us that we don't pass schedule pipeline variables along with pipeline variables. In our "CI/CD variable precedence" list, they have the same priority. So we decided that we could consider pipeline schedule variables as pipeline variables.

This is still behind a feature flag ci_trigger_forward_variables #355572 (closed). We can disable the feature flag after merging this, then restart enabling.

Screenshots or screen recordings

1. Enable ci_trigger_forward_variables

Feature.enable(:ci_trigger_forward_variables)

2. Setup the pipeline

.gitlab-ci.yml

variables: # default variables for each job
  VARIABLE1: value 1

# default behavior
child1:
  trigger:
    include: .child-pipeline.yml

# forwarding pipeline variables
child2:
  trigger:
    include: .child-pipeline.yml
    forward:
      pipeline_variables: true

# not forwarding yaml variables
child3:
  trigger:
    include: .child-pipeline.yml
    forward:
      yaml_variables: false

.child-pipeline.yml

test:
  script:
    - echo $VARIABLE1
    - echo $VARIABLE2

3. Schedule a pipeline and run

Screen_Shot_2022-04-06_at_17.17.43

Screen_Shot_2022-04-06_at_17.18.08

4. Result

Parent Pipeline

Screen_Shot_2022-04-06_at_17.19.41

Child 1

3.<span data-escaped-char>_</span>child_1

Child 2

3.<span data-escaped-char>_</span>child_2

Child 3

3.<span data-escaped-char>_</span>child_3

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Furkan Ayhan

Merge request reports