Continuous integration/Tutorials/Instance as a Jenkins slave

This tutorial describe how to configure a labs instance so it can be added as a Jenkins slave. We can then ask Jenkins to execute jobs on the instance. That is being done when the job is very specific and is maintained out of the continuous integration generic workflow.

Preparing the instance
We are using puppet to describe all configuration changes and packages that are needed. On your instance apply the puppet class role::ci::slave::labs::common. As a summary the class does:


 * mount the instance extended disk space to /mnt using LVM
 * create the jenkins-deploy homespace at /mnt/home/jenkins-deploy
 * create /mnt/jenkins-workspace. That is where jobs will be executed and they will thus have plenty of disk space to consume
 * configure maven, pip and git for the jenkins-deploy user
 * install some java packages

Registering a new slave
This require a labs account in the wmf LDAP group

Write down your instance private address IP.

Browse to https://integration.wikimedia.org/ci/computer/new
 * Node Name: your instance name
 * Click 'Dumb Slave' then OK

On the page being shown:


 * Description: a meaningful human readable explanation of what this slave is for
 * # of executors: the maximum number of jobs Jenkins will be able to trigger on your instance. Can be the number of CPU for example or just 1.
 * Remote FS root: /mnt/jenkins-workspace (defined by Puppet above)
 * Labels: a unique label that describe the type of jobs. Must NOT be an existing labels or your instance will run jobs that are meant for different type of slaves!
 * Usage: 'Leave this machine for tied jobs only'
 * Launch Method: 'Launch slave agents on Unix machines via SSH'
 * Host: 
 * Credentials: select 'jenkins-deploy (key to connect to labs instances ...'
 * Availability: pick one. You can keep it always online

Write down the label you defined for that slave in the Labels: field.

[Save]

You should have pooled a new slave. It should appear at https://integration.wikimedia.org/ci/computer/ click on it and you will see the labels, the jobs being tied to it. On the left a few links can give you more informations, for example Log to find out whether it is connecting/processing properly.

Tieing Jenkins jobs
By using Jenkins job builder you can easily define jobs using a YAML based DSL. When defining the job, you will have to tie it to your new slave by using:

The instance name might work as well.