I want to use a global variable that I have created in my Jenkins Configuration as follow:
My question is: How can I use it in my Pipeline(aka workflow) job? I'm doing something like:
When I ran it, It displayed:
[Pipeline] node
Running on master in /opt/devops/jenkins_home/jobs/siman/jobs/java/jobs/demo-job/workspace
[Pipeline] {
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
groovy.lang.MissingPropertyException: No such property: PRODUCTION_MAILS for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:224)
Instead If I create a "Free Style Project" I can use the global property as follow without problems:
When I ran it, it display the value if I do some "echo" as follow:
This is how I achieved it:
node('master') {
echo "${env.PRODUCTION_MAILS}"
}