Reputation: 16813
I have 2 Jenkins jobs namely test-trigger1
and test-trigger2
and I want to set up test-trigger1
to trigger test-trigger2
using an injected environment variable.
So in test-trigger1
's Configure->Build Environment->Inject environment variables to the build process->Properties Content box
I have this
Then I added a Build->Execute Shell
step, which simply has
and a subsequent Build->Conditional step(single)
step that has
However, I'm not triggering the test-trigger2
job, and I see this in test-trigger1
's console output
(Steps for SCM checkout ommitted)
Run condition [Boolean condition] enabling prebuild for step [Trigger/call builds on other projects]
[EnvInject] - Executing scripts and injecting environment variables after the SCM step.
[EnvInject] - Injecting as environment variables the properties content
TRIGGER_JOB=false
[EnvInject] - Variables injected successfully.
[test-trigger1] $ /bin/sh -xe /tmp/jenkins5417082998696567335.sh
+ echo TRIGGER_JOB=false
TRIGGER_JOB=false
+ TRIGGER_JOB=true
+ echo TRIGGER_JOB=true
TRIGGER_JOB=true
[Boolean condition] checking [false] against [^(1|y|yes|t|true|on|run)$] (origin token: ${ENV,var="TRIGGER_JOB"})
Run condition [Boolean condition] preventing perform for step [Trigger/call builds on other projects]
Notifying upstream projects of job completion
[Boolean condition] checking [false] against [^(1|y|yes|t|true|on|run)$] (origin token: ${ENV,var="TRIGGER_JOB"})
Run condition [Boolean condition] preventing perform for step [Builder to mark whether executed]
Finished: SUCCESS
Apparently, the Execute shell
step is not setting the injected environment variable correctly, or I'm not setting it correctly? Any ideas on how I can make this work?
Upvotes: 0
Views: 314