Created
February 20, 2019 00:35
-
-
Save marcosborges/3f8a8a7c82a97477e678d527f1c11e46 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| def write(name, value){ | |
| def instance = Jenkins.getInstance() | |
| def globalProps = hudson.model.Hudson.instance.globalNodeProperties | |
| def props = globalProps.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class) | |
| for (prop in props) { | |
| prop.envVars.put(name,value) | |
| } | |
| instance.save() | |
| } | |
| def all(){ | |
| def instance = Jenkins.getInstance() | |
| def globalProps = hudson.model.Hudson.instance.globalNodeProperties | |
| def props = globalProps.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class) | |
| return props.envVars | |
| } | |
| def find(name){ | |
| def instance = Jenkins.getInstance() | |
| def globalProps = hudson.model.Hudson.instance.globalNodeProperties | |
| def props = globalProps.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class) | |
| return props.envVars[name] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment