'In Jenkins freestyle job, how can I set a variable and use it in a "Conditional step (single)" step?
I have a free-style Jenkins job with an "Execute shell" step. In it, I have an if()
condition and when the condition is satisfied, I set a variable TRIGGER_JOB=true
, a variable that I initially set to false
in the Inject environment variables to the build process -> Script Content
box of the job, and I do see that the variable gets set to true
.
Now I want to add a "Conditional step (single)" to this job, and set it so it's "Run" drop-down box is set to "Boolean condition," and a "TOKEN" set to $TRIGGER_JOB
, the above variable. However, I get this error
Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'TRIGGER_JOB' in '$TRIGGER_JOB'], action = [Don't run]
How do I fix this? What are alternatives?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|