In the Jenkins configuration ( http: // JenkinsURL / configure ) in the Global Properties section, I defined some "environment variables".
How can I access them in the Groovy Script console ( http: // JenkinsURL / script )?
I tried to find a suitable solution (for example, the solutions mentioned in: Access to building environment variables from Groovy Script at the Jenkins build phase (Windows) ) but it seems that none of them work for me.
I tried for example:
System.getenv("myVar")
and
manager.build.getEnvironment(listener).get('myVar')
and
import jenkins.model.Jenkins Jenkins.instance.getProperty('myVar') //No signature of method: hudson.model.Hudson.getProperty() is applicable for argument types: (java.lang.String)
and
import jenkins.model.Jenkins Jenkins.instance.ParameterValue("DEV_local")
source share