In Jenkins configuration (http://JenkinsURL/configure) within \"Global properties\" I defined some \"Environment variables\".
How can I access them in the Groovy Scr
You can get global properties like this:
import jenkins.model.Jenkins
def envVars = Jenkins.instance.getGlobalNodeProperties()[0].getEnvVars()
println envVars['myVar']
I referred to the link below, about how to set global properties programatically. https://groups.google.com/forum/#!topic/jenkinsci-users/KgCGuDmED1Q
You can use System
to get environment variables.
def env = System.getenv()
println(env['JENKINS_HOME'])
(See also http://@myJenkHostname@/env-vars.html (where @myJenkHostname@
is your Jenkins hostname) for a list of built-in environment variables.)