Skip to content
Giuseppe Landolfi edited this page Jul 2, 2016 · 8 revisions

Deprecated

This project has been merged into the Jenkins Slave setup plugin

What is this project for?

First of all, welcome.

This is a plugin for Jenkins that is meant to simplify your life in a particular use case:

  • you use Jenkins to run distributed builds on slave nodes
  • some of the slave machines can be started/stopped programmatically by the master (virtual machines, instances in the cloud, ...)
  • you want these machines to be off when idle (i.e. if you use slaves on Amazon EC2, you are billed for the time the machine is on)

If this is your use case, then this plugin is for you.

What it does is really simple: when Jenkins needs to connect to a slave node, it will execute a shell script of your choice before attempting to connect. On the other hand, after disconnecting, it will execute another script of your choice

Similar plugins that can help you as well are:

How to install it

Right now, you cannot directly select this plugin from Jenkins as it's not an official plugin. You need therefore to:

  • set up a build environment with Maven (as described here, section "Setting Up Environment")
  • download the sources of this plugin (git clone https://github.com/peppelan/on-demand-slave.git or just get the zip)
  • run mvn clean install to build the plugin
  • save the ".hpi" file that has been created in the "target" folder into the $JENKINS_HOME/plugins folder. You will need to restart Jenkins afterwards

How to use it

Now you are good to go, and all you need to do is to specify the "Start" and "Stop" scripts to be executed for your node.

Create a new slave, or edit yours if you already have one.

You will have a "Launch method" (1) specific for on-demand slaves: this one lets you specify the "Start" (2) and "Stop" (3) scripts, and on top of that you will be able to specify the "conventional" connection (4) method for reaching the slave after it has been started.

You will likely also want to specify that you want this node to be online only when Jenkins needs it (5).

(enlarge this image)

Clone this wiki locally