How to get environment variable in Jenkins Groovy script console?
<p>In Jenkins configuration (<a href="http://JenkinsURL/configure" rel="noreferrer">http://JenkinsURL/configure</a>) within "Global properties" I defined some "Environment variables".</p>

<p>How can I access them in the Groovy Script console (<a href="http://JenkinsURL/script" rel="noreferrer">http://JenkinsURL/script</a>)?</p>

<p>I've tried to find appropriate solution (for example the solutions mentioned in: <a href="https://stackoverflow.com/questions/21236268/access-to-build-environment-variables-from-a-groovy-script-in-a-jenkins-build-st">Access to build environment variables from a groovy script in a Jenkins build step (Windows)</a>)
but it seems that none of them work for me.</p>

<p>I've tried for example:</p>

<pre><code>System.getenv("myVar")
</code></pre>

<p>and</p>

<pre><code>manager.build.getEnvironment(listener).get('myVar') //no manager error
</code></pre>

<p>and</p>

<pre><code>import jenkins.model.Jenkins
Jenkins.instance.getProperty('myVar') //No signature of method: hudson.model.Hudson.getProperty() is applicable for argument types: (java.lang.String)
</code></pre>

<p>and</p>

<pre><code>import jenkins.model.Jenkins
Jenkins.instance.ParameterValue("DEV_local")
</code></pre>