Skip to content

Passing Variables to Downstream Pipeline

Problem to Solve

It can be useful in a lot of situations to pass a variable to a downstream (triggered) pipeline. It contain configuration or other important state information that's needed to

We have the syntax that would seem to support this, but when you do it it just passes on the name of the variable. For example, if you create one pipeline and define a variable:

variables:  
  WHATEVER: 'something'  

Trigger another pipeline from the previous one and pass the variable previously created:

pipeline2:  
  stage: next  
  variables:  
    ANYTHING: $WHATEVER  
  trigger: path/to/another/project  

Try to echo the variable ANYTHING in the next pipeline, you'll get '$WHATEVER' instead of 'something'

Proposal

Change the behavior of the above implementation such that when you echo the variable ANYTHING it will show 'something' instead of '$WHATEVER'

Documentation Reference

https://docs.gitlab.com/ee/ci/multi_project_pipelines.html#passing-variables-to-a-downstream-pipeline

Edited by Jason Yavorsky