Hi,
This script works fine when tested from 
So i want to do this with a job or a pipeline
how can i make a job or pipeline run this groovy script.

i'm getting random errors when I try to run this groovy script as part of a 
pipleline.
Thanks,
Rakesh

On Thursday, February 26, 2015 at 3:23:27 AM UTC+5:30, Victor Volle wrote:
>
> Final solution:
>
> instance = Jenkins.getInstance()
> globalNodeProperties = instance.getGlobalNodeProperties()
> envVarsNodePropertyList = globalNodeProperties.getAll(hudson.slaves.
> EnvironmentVariablesNodeProperty.class)
>
> newEnvVarsNodeProperty = null
> envVars = null
>
> if ( envVarsNodePropertyList == null || envVarsNodePropertyList.size() == 
> 0 ) {
>   newEnvVarsNodeProperty = new hudson.slaves.
> EnvironmentVariablesNodeProperty();
>   globalNodeProperties.add(newEnvVarsNodeProperty)
>   envVars = newEnvVarsNodeProperty.getEnvVars()
> } else {
>   envVars = envVarsNodePropertyList.get(0).getEnvVars()
> }
>
> envVars.put("FOO", "foo")
>
> instance.save()
>
>
>
>

-- 
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/80bd02c4-830e-4640-8afa-959e8034a7bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to