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()

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

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 
For more options, visit https://groups.google.com/d/optout.

Reply via email to