At this moment I defined a environment variable called GLOBAL_VAR with the value \'test\' under Manage Jenkins -> Configure System -> Global Properties. I have a shell script wh
Here is an example of some working code:
import jenkins.model.*
nodes = Jenkins.instance.globalNodeProperties
nodes.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class)
envVars = nodes[0].envVars
envVars['MY_GLOBAL_PROPERTY']
Sources of my solution:
https://gist.github.com/johnyzed/2af71090419af2b20c5a
http://pghalliday.com/jenkins/groovy/sonar/chef/configuration/management/2014/09/21/some-useful-jenkins-groovy-scripts.html
Note to the "hard core" moderator that deleted my previous answer: I have spent quite a few hours searching on the Internet before finding the right solution, you shouldn't delete posts without knowing what is it really talking about. I find such behavior rather discouraging :(