Search code examples
jenkinsvirtual-machinevsphere

One execution per Windows VMware VM as Jenkins slaves?


I am trying to run some automated acceptance tests on a windows VM but am running into some problems.

Here is what I want, a job which runs on a freshly reverted VM all the time. This job will get an MSI installer from an upstream job, install it, and then run some automated tests on it, in this case using robotframework (but that doesn't really matter in this case)

I have setup the slave in the vSphere plugin to only have one executor and to disconnect after one execution. On disconnect is shutsdown and reverts. My hope was this meant that it would run one Jenkins job and then revert, the next job would get a fresh snapshot, and so would the next and so on.

The problem is if a job is in queue waiting for the VM slave, as soon as the first job finishes the next one starts, before the VM has shutdown and reverted. The signal to shutdown and revert has however been sent, so the next job is almost immedieatly failed as the VM shuts down.

Everything works fine as long as jobs needing the VM aren't queued while another is running, but if they are I run into this problem.

Can anyone suggest a way to fix this?

Am I better off using vSphere build steps rather than setting up a build slave in this fashion, if so how exactly do I go about getting the same workflow to work using buildsteps and (i assume) pipelined builds.

Thanks


Solution

  • Turns out the version of the vSphere plugin I was using was outdated, this bug problem is fixed in the newer version