I'm trying to apply the guidance I recently read at how to trigger parameterized builds from a different build in Jenkins and https://plugins.jenkins.io/parameterized-trigger/ - but this doesn't seem to work, and I'd like to ask the community for help understanding what I'm doing wrong.
My jobs are set up thus:
foo2is a non-parameterized buildfoo2's Build isExecute shellwith commands:
string1="123abc" export string2="456def"foo2's Post-build Action isTrigger parameterized build on other projects- It triggers
foo3 - It attempts to pass parameters to
foo3withPredefined parameters:
a_string=${string1} b_string=${string2}- It triggers
foo3is a parameterized build with two string paramters:a_stringandb_string.foo3's Build step isExecute shellwith commands:
echo ${a_string} echo ${b_string}
Question/Problem: when foo3 is triggered, its console output are the string literals ${string1} and ${string2}, instead of the desired 123abc and 456def -- what am I doing wrong? How can I pass variables set during foo2's Build stage to foo3?
Output of foo3 build:
Started by upstream project "foo2" build number 4
originally caused by:
Started by user unknown or anonymous
Running as SYSTEM
Building remotely on builder-231 (docker-cleanup) in workspace /home/user/workspace/foo3
[foo3] $ /bin/sh -xe /tmp/jenkins2920927890739081404.sh
+ echo ${string1}
${string1}
+ echo ${string2}
${string2}
Finished: SUCCESS
Screenshots:
foo2's Build and Post-build action to trigger foo3:



string1andstring2will not available outsideExecute shellstep so the values ofa_stringandb_stringwill be empty forfoo3build. – Oli May 15 '21 at 10:24