Created
June 9, 2015 05:14
-
-
Save johnyzed/2af71090419af2b20c5a to your computer and use it in GitHub Desktop.
alter jenkins global parameter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(args[0],args[1]) | |
Jenkins.getInstance().save() | |
println("okay") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script can be made a lot groovier :)