we want to provide an auto-installer for my company. So that the developers do not have to set up their workbench with a very long installation guide. We managed to provide 90%.
Last week we received an email that we should configure Jenkins during the installation. The first part of configuring the Proxy Setting is via a groovy script.
Groovy file:
pc = new hudson.ProxyConfiguration(name, port, userName, password, noProxyHost);
jenkins.model.Jenkins.instance.proxy = pc;
println "Jenkins-Proxy settings updated!
Commandline
type set setJenkinsProxy.groovy | java -jar jenkins-cli.jar -s
http://localhost:8080/jenkins groovy =
The next part is to set the already installed JDK. First thought was to use a groovy script to set the JDK.
Groovy file:
jdk = new hudson.model.JDK(name, home, list);
jdklist = []
jdklist.add(jdk)
jenkins.model.Jenkins.instance.JDKs = jdk;
println "JDK settings updated!
Even with a runnable .jar file, that will use the jenkins-cli.jar, it didn't work.
JDK.jar
public static void main(String[] args) {
JDK jdk = new JDK(args[0], args[1]);
List<JDK> jdklist = new ArrayList<JDK>();
jdklist.add(jdk);
jenkins.model.Jenkins.jdks = jdklist;
System.out.println("Jenkins JDK set!");
}
Is there a proper way to set this Environment? I would really appreciate any way of help.
EDIT: Would like to set Jenkins Location as well as Email- Notification too.
and here the example to set the jdk (groovy script executing via commandline)
name = "Java";
home = "C:\\Program Files\\Java\\jdk1.7.0_40";
list = null;
dis = new hudson.model.JDK.DescriptorImpl();
dis.setInstallations( new hudson.model.JDK(name, home));
println "JDK settings updated!"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With