VMware ESXi/vSphere Auto-Scaling Plugin

Challenge: 

You have builds starved for slave machines, while elsewhere within your VMware vSphere/ESXi installation you have multiple machines that may be running idle. You would like to “rent” the excess capacity of these unused VMs for your build jobs.

Solution: 

The VMware vCenter Auto-Scaling plugin, available with Jenkins Enterprise by CloudBees, allows you to create slave machines that are VMware ESXi/vCenter VMs. You assign a virtual machine from VMware ESXi/vCenter to your build, allowing your build to interact with that VM.

This offers better resource utilization of your machines and substantial savings to organizations as they reuse machines instead of buying new machines to fill the demand for resources.

The basic idea of this plugin is as follows. On one side, you configure pools of VMs. Each pool consists of multiple, identical VMs —- that is, those VMs in the same pool are exchangeable for the sake of builds/tests that you run. On the other side, you have Jenkins jobs that require a virtual machine. What this plugin essentially does is to rent a VM to a build that requires resources while it’s building. Jenkins keeps track of which VM is used where, and makes sure two builds don’t end up colliding on the same VM at the same time.

In addition to this basic bookkeeping, Jenkins can perform setup/teardown actions to VMs, when a VM is assigned to a build and returned to the pool, respectively.

The actions include:

  • Power on
  • Power off/suspend
  • Revert to the last snapshot

A very typical example of this functionality is to have Jenkins revert the VM to the golden snapshot and power on in the beginning of the build, then have Jenkins shut down the VM at the end of it. This allows you to always run your tests in a consistently clean state.

The VMware vCenter plugin allows you to use folders in vCenter to simplify managing large numbers of VMs. You only have to point to a vapp folder and all machines are automatically picked up - allowing users to dynamically add/remove machines without changing configurations.

This plugin is very complementary in combination with the Label Throttle plugin.