My question got answered on SO, for people who want to do the same:
http://stackoverflow.com/questions/25889437/how-to-modify-add-delete-tool-installations-on-a-jenkins-slave-using-groovy
Op maandag 15 september 2014 10:52:44 UTC+2 schreef Nico Mommaerts:
>
> Hey,
>
> atm I am using a Groovy script to configure our different Jenkins masters,
> including the tool installations, eg:
>
> mavenDesc = Jenkins.instance.getDescriptorByName("hudson.tasks.Maven");
> if (mavenDesc != null) {
> MavenInstallation mi = new MavenInstallation("maven3.0.2",
> "/home/jenkins/apache-maven-3.0.2");
> MavenInstallation mi32 = new MavenInstallation("maven3.2.3",
> "/home/jenkins/apache-maven-3.2.3");
> mavenDesc.setInstallations(mi, mi32);
> }
>
> This works fine but now I want to do the same for the slaves (different OS
> so different locations). Can't figure out how though...this is the furthest
> I have gotten:
>
> for (aSlave in jenkins.slaves) {
> for ( ToolLocationNodeProperty.ToolLocation toolLocation : aSlave.
> getNodeProperties().get(ToolLocationNodeProperty.class).getLocations()) {
> //println(toolLocation.getKey())
> //println(toolLocation.getType())
> println(toolLocation.getName())
> println(toolLocation.getHome())
> }
> }
>
> All instances seem immutable though and I don't seem to find any way to
> add a Tool location to a slave.
>
> Any ideas?
>
--
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].
For more options, visit https://groups.google.com/d/optout.