Hi, I’m trying to create a multi project pipeline that passes variable between pipelines. Let’s say I have projects A,B and C - project A pipeline generates a dynamic variable and passes it to project B through a trigger job. This works as expected, in the first job in project B pipeline I can see that the variable has the configured value, the in another trigger job in pipeline B I trigger pipeline C. The problem is this variable that pipeline B inherited from pipeline A wasn’t also passed on to pipeline C.
From the gitlab CI docs I understood that all environment variables are automatically inherited in a trigger job, but it seems this isn’t the case here. I suspect this has something to do with variable “scopes”, that inherited variables in a triggered pipeline aren’t exactly the same as other variables.
Looks something like this -
Project A pipeline:
Test1-A-job:
Variables:
VAR1: “something”
Trigger:
Depends: true
Project: path/to/projectB
Project B pipeline:
Test1-B-job:
Script:
- echo $VAR1 #VAR1 has expected value “something”
Test2-B-job:
Trigger:
Depends: true
Project: path/to/projectC
Project C pipeline:
Test1-C-job:
Script:
- echo $VAR1 #VAR1 was not passed on and doesn’t have a defined value
I also tried setting trigger:forward:pipeline_variables to true in the trigger job in pipeline B, which didn’t work
If anyone has any insight to this problem I would love your help, or if anyone could explain why only variables that are set inside the pipeline yaml are forwarded, but not inherited ones