Hey man! Your solution also worked for me! Thank you very much!

miercuri, 25 februarie 2015, 22:39:06 UTC+2, Victor Volle a scris:
>
> I have a partial *solution, *when I have already enabled Global 
> Properties:
>
>
> <https://lh4.googleusercontent.com/-EJJeUHpiDSs/VO4yDdXk2vI/AAAAAAAAACY/UDR7x-oUvJo/s1600/Configure%2BSystem%2B%5BJenkins%5D%2B2015-02-25%2B21-35-00.png>
>
>
> the following script works for me:
>
>
> import jenkins.*
>
> import jenkins.model.*
>
> import hudson.*
>
> import hudson.model.*
>
>
> nodes = Jenkins.getInstance().getGlobalNodeProperties()
>
> nodes.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class)
>
> if ( nodes.size() != 1 ) {
>
>   println("error: unexpected number of environment variable containers: "
>
>           + nodes.size()
>
>           + " expected: 1")
>
> } else {
>
>   envVars= nodes.get(0).getEnvVars()
>
>   envVars.put("FOO", "foo")
>
>   ...
>
>   Jenkins.getInstance().save()
>
>   println("okay")
>
> }
>
> I send this script to Jenkins with:
>
> java -jar /tmp/jenkins-cli.jar -s http://localhost:8080/jenkins/ groovy 
> /tmp/jenkins_global_vars.groovy
>
> and the variables are set and persisted. What I haven't yet figured out, 
> is how to enable the Global Properties in the first place
>
>

-- 
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/f77a132b-5b94-4a2a-9518-765cf00fb855%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to