wiki:WikiStart/BuildServer/Chroots

The Rock jenkins build scripts expect all chroots to be stored under the same directory. Let's assume that it is called /data/chroots (for instance).

First thing you need to do is created chroots for the builds. The setup of schroot, a tool that allows to manage chroots in a safe and (relatively) easy way is common to all chroot types. It is presented after this list.

Setting schroot up

The user under which jenkins runs needs to be allowed to log in without password, and should therefore be listed as users= in the schroot configuration file, e.g.:

[13.04_amd64]
description=Ubuntu 13.04 Raring Ringtail on amd64
type=directory
directory=/data/chroots/13.04_amd64
users=jenkins

This file should be copied under /etc/schroot/chroot.d, a good name would follow the <distrib>_<arch> convention, e.g. /etc/schroot/chroot.d/13.04_amd64

When the chroot is Debian and the host not, it happens that the 'staff' group does not exist in the chroot (you get an error when installing some packages). Creating the group in the chroot is of no use as schroot copies this file each time you log in. Either add the group to the host, or disable copying

Common chroot setup

Decide where to set up all builds (in jenkins, this is the jenkins workspace directory, usually $JENKINS_HOME/workspace, and can be configured in Manage Jenkins/Configure System). Then, checkout the build scripts. Note that, since we are mounting this directory on the slave, this operation can be done on the master.

cd /data/jenkins
git clone git://gitorious.org/rock/build_scripts.git
chown -R jenkins:jenkins build_scripts

TODO: find how to do this properly

This script directory should be mounted on all slaves for the Rock build scripts to function properly. This is done by editing (TODO: find the proper way) /etc/schroot/default/fstab and add

/data/jenkins/build_scripts /data/jenkins/build_scripts rw,bind 0 0

Single chroot setup

The workspace directory must also be created this time in the chroot

First install a minimal system, like in

mkdir /data/jenkins/workspace
chown -R jenkins:jenkins /data/jenkins/workspace

In the chroot, the 'jenkins' user is setup to run without password. Log in as root using schroot and run visudo. Then, add the following line to the sudoers file:

jenkins ALL=NOPASSWD: ALL

You also need to install jenkins-slave, ruby, and ruby-dev ubuntu packages inside the schroot

In case a package is not found, proceed with creating a Debian/Ubuntu chroot first

Some basic but useful JenkinsPlugins

Last modified 4 years ago Last modified on 04/27/15 09:14:45