Would be grateful for a decent full code example of how to pass parameters (parameterized build) from JobA
to JobB
in Jenkins Pipeline plugin?
I am using a script like below and can not figure from the docs how to access parameters from JobA
in say a build step shell script in JobB
:
build job: 'JobA', parameters: [[$class: 'StringParameterValue', name: 'CVS_TAG', value: 'test']]
build job: 'JobB', parameters: [[$class: 'StringParameterValue', name: 'CVS_TAG', value: 'test']]
echo env.CVS_TAG
Above gives an error:
groovy.lang.MissingPropertyException: No such property: CVS_TAG for class: groovy.lang.Binding
And can not access $CVS_TAG
in a build step shell script in JobB
.
Thanks
Per you responses I have also tried this unsuccessfully:
build job: 'JobA', parameters: [[$class: 'StringParameterValue', name: 'test_param', value: 'working']]
env.test_param=test_param
echo ${test_param}
The error is always:
groovy.lang.MissingPropertyException: No such property: test_param for class: groovy.lang.Binding at groovy.lang.Binding.getVariable(Binding.java:63)