We had a similar problem and solved it wrt. 
https://groups.google.com/forum/#%21topic/jenkinsci-users/KgCGuDmED1Q with 
the following dynamic parameter script

import jenkins.*
import jenkins.model.*
import hudson.*
import hudson.model.*

nodes = Jenkins.getInstance().getGlobalNodeProperties()
nodes.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class)

if ( nodes.size() != 1 ) {
  throw new RuntimeException ("error: unexpected number of environment 
variable containers: ${nodes.size()}, expected 1!")
}
envVars= nodes.get(0).getEnvVars()
envVars.get("CONFIG_REPO_ADDONS_VERSION")

On Wednesday, April 22, 2015 at 9:14:54 AM UTC+2, zacky azoulay wrote:
>
> Hi
>
> At this moment I defined a environment variable called TEST1 with the 
> value 'myvalue' under Manage Jenkins -> Configure System -> Global 
> Properties. I have a groovy script when a project is being build containing
>
> def env = System.getenv()
> println(env['TEST1'])
> println(env['USER'])
>
> i got 
>
> myvalue
> lroot
>
> while in the Extensible Choice -> System Groovy Choice Parameter -> Groovy 
> System Script i run the same scripts but i got only lroot
>
> is there a way to get the environment variable in the extensible-choice 
> like jenkins user hudson.model.User.current() or 
>   hudson.model.Hudson.instance.getAuthentication().getName()
>
> thank and regards zacky
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/84e7f218-de8b-4260-8f17-8ebe4973ce16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to