This plugin uses JClouds to provide slave launching on most of the currently usable Cloud infrastructures.

JClouds Jenkins plugin provides option to launch jenkins slaves on any Cloud provider supported by JClouds, or on a cloud provider implementing one of the APIs JClouds supports.

(Old CI) (New CI)

Important information for upgrading from versions < 2.9 of this plugin

Due to the fact that all credentals ar now handled by the credentials plugin, the config data must be converted during upgrade and therefore, a rollback can not be performed easily.If you want to presevere config data, just in case you want to switch back to 2.8.1 you must backup config.xml and credentials.xml from your jenkins' home before performing the update. Then in case of rollback do the following:

Adding a new Cloud Provider

Click on the `Add a new cloud` pop-up menu button which should have an option - `Cloud (JClouds)`

Click on `Cloud (JClouds)`

Fill in the configuration options

Profile : the name of the profile e.g, aws-slave-profile

Provider Name: Select from the supported providers

End Point URL: if your provider API needs an endpoint configuration, add it here, otherwise leave this empty.

Max Number of Instances: The maximum number of instances to run from this cloud at one time.

Retention Time: How long, in minutes, to wait for a slave to remain idle before disconnecting and terminating it. Defaults to 30.

Credentials: Depending on your provider, you either need a username/password pair or a username/privatekey pair. The first one is covered by the "Username with password" credentials of jenkins and for the second one, you simply can use the "SSH Username with private key" credentials which - despite of what their name suggests - can store any kind of PEM-encoded private key. For GCE, select the "JClouds Username with key" credential type and then click the Browse button in order to upload your JSON key from google. (In case of openstack-nova, the username is to be specified in the form tenantName:userName)

RSA Private Key/Public Key: Like with the credentials, simply use a "SSH Username with private key" credential. The public key is derived automatically from that.

Click on `Test Connection` to validate the cloud settings.

Add Cloud Instance Template by clicking on the Add button

Fill in configuration options:

Name : the name of the instance template e.g. aws-jenkins-slave

Number of Executors: How many executors each slave created from this template should have.

Description: notes/comments for your reference.

Image ID: Use one of the following options:

Image ID to use for this slave template, such as EC2 AMIs. Note that EC2 AMIs must include the region as well, e.g., us-east-1/ami-00000. If unshure, you can enter a partial string and the hit the "Check Image Id" button. This searches for matching images and if there are ambiguties, a message is shown like: "Did you mean "....exact-image-id..."?or

OSFamily: Specify the OSFamily - leave empty for default for a cloud provider

OS Version : Specify the OSVersion - leave empty for default for a cloud provider

Hardware ID: Use one of the following options:

Hardware ID on provider for this slave template, such as t1.micro on AWS EC2.or

RAM : in MB

No. of Cores: number of virtual processor cores.

Location ID: Location ID where this slave will be deployed. If none is selected jclouds will automatically choose an available one.

Labels: (space-separated) labels/tags that you can use to attach a build to this slave template.

Init Script: A shell script to be run when the slave is created. A rather simple method for provisioning. If supported by your provider, you should prefer the variant using User-Data and cloud-init.

Stop on Terminate: If true, suspend slaves rather than terminating them.

Click Save to save the configuration changes.

Goto Jenkins' home page, click on `Build Executor Status` link on the sidebar.

Verify that you have a button with `Provision via JClouds - (YOUR PROFILE NAME) drop down with the slave template name you configured.

Click on the slave and see if your slave launched successfully (please wait until the operation completes).

Executing build on the slave

To run your build on the newly configured slave computer, just enable the `Restrict where this project can be run` option in the build configuration page.

Enter the label which you choose for the instance template in the `Label Expression` text field. This should auto-complete labels for you.

Click save to save the configuration options.

Schedule the build to check whether the build is executed on the selected slave template.

If your cloud provider is charging by the minute (GCE for example), you can enable the checkbox "JClouds Single-use-slave" which destroys the provisioned VM after the build job has finished (with a small delay of ~ 1min).

Adding a Blobstore Profile for storing build artifacts

The plugin also provides a way to store your build artifacts on JClouds supported cloud storage providers. You can configure multiple blobstore profiles and configure the build to copy different files/artifacts to the specified container. Here's how you configure the same.

Goto Jenkins Configuration Page

Click Ad under the section `JClouds Cloud Storage Settings`

Provide the configuration Options:

Profile Name: name of the profile e.g. aws-storage

Provider Name: Select one of the supported providers.

Credentials: Just like the cloud credentials.

You can add multiple providers by clicking on Add.

Click Save on the bottom of the page, to save the settings.

Publishing artifacts after a build

After you configure a cloudstorage provider, you can enable the publishing file by enabling it under `Post-build Actions` in the build job configuration page.

Click on the checkbox `Publish artifacts to JClouds Clouds Storage`

You should now see a dropdown with configured storage profiles. Select the one you want to use for this build.

Click on Add button next to `Files to upload`.

Add the sourced file path (relative to workspace)

Add the destination container name.

Repeat to add more files if you want to copy.

Click save.

When the build is complete and successful, the configured files will be published to the configured blobstore.

Merged cloud-init YAML definitions

When using cloud-init you can provide multiple config data snippets. If you select YAML snippets, thos get merged. E.g:

If snippet 1 contains:

packages:
- screen
- openjdk-8-jdk-headless

and snippet 2 contains:

packages:
- gcc

Then the resulting YAML on the cloud-init (server) side becomes:

packages:
- gcc
- screen
- openjdk-8-jdk-headless

Using the new phone-home feature

When provisioning slaves, there might be too much work on a slave for it to get ready (listening on port 22) in time for jenkins. Therefore, the plugin provides a new webhook, which is designed to be invoked by a http POST request using cloud-init within the slave when everything is ready to use. When enabled, the usual slave connection setup is delayed until the http POST is received.

Version 2.12 (released December 16, 2016)

Use gzip compression of userData on supporting cloud providers; (currently: aws-ec2, openstack-nova and openstack-nova-ec2) In the logs, the userData is shown as binary "garbage" if compression is in effect. Since that particular log entry is generated from within jclouds, that cannot be changed and works as designed.

Version 2.11 (released December 5, 2016)

Upgrade to jclouds-2.0 (Among many improvents, this adds official support for GCE (Google) and DigitalOcean2)