- Each computer has an user called
jenkinsand a group called
jenkins. All computers use the same UID and GID. (If you have access to NIS, this can be done more easily.) This is not a Jenkins requirement, but it makes the slave management easier.
- On each computer,
/var/jenkinsdirectory is set as the home directory of user
jenkins. Again, this is not a hard requirement, but having the same directory layout makes things easier to maintain.
- All machines run
sshd. Windows slaves run
- All machines have
/usr/sbin/ntpdateinstalled, and synchronize clock regularly with the same NTP server.
/var/jenkinshave all the build tools beneath it --- a few versions of Ant, Maven, and JDKs. JDKs are native programs, so I have JDK copies for all the architectures I need. The directory structure looks like this:
/var/jenkins +- .ssh +- bin | +- slave (more about this below) +- workspace (jenkins creates this file and store all data files inside) +- tools +- ant-1.5 +- ant-1.6 +- maven-1.0.2 +- maven-2.0 +- java-1.4 -> native/java-1.4 (symlink) +- java-1.5 -> native/java-1.5 (symlink) +- native -> solaris-sparcv9 (symlink; different on each computer) +- solaris-sparcv9 | +- java-1.4 | +- java-1.5 +- linux-amd64 +- java-1.4 +- java-1.5
/var/jenkins/.sshhas private/public key and
authorized_keysso that a master can execute programs on slaves through
ssh, by using public key authentication.
- On master, he had I have a little shell script that uses rsync to synchronize master's
/var/jenkinsto slaves (except
/var/jenkins/workspace). He I also used use the script to replicate tools on all slaves.
/var/jenkins/bin/launch-slaveis a shell script that Jenkins uses to execute jobs remotely. This shell script sets up
PATHand a few other things before launching
slave.jar.Below is a very simple example script.
#!/bin/bash JAVA_HOME=/opt/SUN/jdk1.6.0_04 PATH=$PATH:$JAVA_HOME/bin export PATH java -jar /var/jenkins/bin/slave.jar