Skip to content

Introduce trigger:forward for CI bridge jobs

Furkan Ayhan requested to merge 213729-trigger-forward-variables into master

What does this MR do and why?

By default, only YAML-defined bridge variables are passed to downstream pipelines. With the forward keyword, it is now available to pass manual pipeline variables to downstream pipelines.

  • forward:yaml_variables is an existing behavior, by default it's true. When true, YAML-defined bridge variables are passed to downstream pipelines.
  • forward:pipeline_variables is a new feature, by default it's false. When true, manual pipeline variables are passed to downstream pipelines.

This is behind a feature flag ci_trigger_forward_variables #355572 (closed).

Related to #213729 (closed)

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. Run the pipeline

1._run_with_variable

4. Result

Parent Pipeline

2._parent_pipeline

Child 1

3._child_1

Child 2

3._child_2

Child 3

3._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