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[Jenkins]%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c7f7c51a-91c4-4fe8-9847-4cd5169153d6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
