Issue
I have an upstream pipeline job that triggers a downstream pipeline job, the upstream job sends a few parameters to the downstream job. How should I read these parameters in the downstream job? Both jobs are non-parameterized.
The upstream job sends parameters like so.
build job: 'downstream-job',
parameters: [[$class: 'StringParameterValue', name: 'Environment', value: "dev"]]
This answer says uses the variable directly but this doesn't seem to work. When I try using the variable Environment
in the downstream job, I get an error saying.
groovy.lang.MissingPropertyException: No such property: Environment for class: groovy.lang.Binding
Solution
From the documentation here, it has to be params.Environment
.
Answered By - Harshith Bolar
Answer Checked By - Mary Flores (JavaFixing Volunteer)