Lets you configure tools so that agents will install them on demand whenever running a job that needs them. This could be especially useful when running a large farm of agents in a cloud which all start with a minimal operating system configuration.
Several techniques are already supported: run arbitrary shell command; download & unpack archive from arbitrary URL; download and install official Oracle JDK, Ant release, or Maven release.
The configuration is part of a tool; a project owner just picks a tool (JDK, Ant, Maven, ...) by name as usual, and may observe a build running some extra steps if it needs to perform an installation, but it is otherwise transparent. Installers can be limited to agents marked with a label.
Jenkins 2.7.1 on
localhost:8080 with no executors.
One JNLP agent node
ubuntu-vbox with one executor and Remote FS root set to
JDK 6and a JDK installer set to 6u13.
Ant 1.7.1and an Ant installer set to 1.7.1.
Freestyle project, no SCM. Two build steps:
Execute shell with Command:
echo "JDK: $JAVA_HOME" echo '<project/>' > build.xml
An Ubuntu 8.10 server installation inside VirtualBox (NAT networking) with only
default-jre-headless installed and user
#!/bin/sh -e su - jenkins -c /jenkins/slave-jnlp 2>&1 | perl -p -e 's/\n/\r\n/g' 1>&2 &
# ... jenkins ALL=NOPASSWD: ALL
#!/bin/sh dir=`dirname $0` server=http://10.0.2.2:8080 node=ubuntu-vbox while : do wget -O $dir/slave.jar $server/jnlpJars/slave.jar && \ java -jar $dir/slave.jar -jnlpUrl $server/computer/$node/slave-agent.jnlp sleep 15 done
... Building remotely on ubuntu-vbox ... JDK: /jenkins/tools/JDK_6 ... [...] $ /jenkins/tools/Ant_1.7.1/bin/ant -version Apache Ant version 1.7.1 compiled on June 27 2008 Finished: SUCCESS
Related: Tool Environment Plugin
Jenkins gets the information where to download the versions via a JSON download from the internet.
The JSON data for the tools are stored in the files http://mirrors.jenkins-ci.org/updates/updates/, so adding a new version of an existing tool would require a path to the related file. The JSON data for some tools is created by
backend/crawler in Jenkins sources.
More things should extend
ToolInstallation for this system to be really useful. An incomplete list:
Just in case you cannot find a ToolInstaller/ToolInstallation for your tool, there are also generic plugins which can be configured in flexible ways: