0

I'm trying to reset-and-launch a Windows VM (in vsphere) during a Jenkins job. I successfully installed the vSphere Cloud Plugin. I've followed instructions to setup the Windows machine as a jenkins-mvn-slave, and have it setup to run as a service.

If I click on the button in Jenkins for Launch Slave Agent, I can see (in vsphere) that the VM does a revert snapshot, and then it does a power on virtual machine. If I attach to the machine, I can see that the Jenkins service starts automatically. However, back in Jenkins, it tells me that the Slave did not come online in allowed time.

Some key settings for my slave: Force VM launch: Checked Wait for VMTools: Not checked Delay between launch and boot complete: 120 Secondary launch method: Launch slave agents view Java Web Start

Versions: Jenkins: 1.596.2 vSphere: 5.5.0 Windows: Server 2012 R2 Standard, Build 9600 vSphere plugin: 2.7

What am I missing?

user3550496
  • 333
  • 5
  • 14

1 Answers1

1

I've done a lot of messing around since I posted, but I think the following is what I was doing wrong. I first got the VM working as a normal slave agent. Once I had that working, then I tried to setup the same as a vsphere-cloud-slave-agent. I wasn't realizing that setting up a host as a slave agent is "agent-name specific".

So, I uninstalled the Jenkins service, launched the "vsphere cloud slave agent", logged into the machine, and ran javaws (as specified in the previously mentioned instructions.

A couple of other gotchas that I encountered (not relevant to the initial post, but maybe relevant to someone who reads this):

  1. I originally installed git with a password manager. Unfortunately, since jenkins jobs aren't interactive, it was hanging on the git clone command. I tried uninstalling and re-installing git, but it didn't fix the problem for whatever user the jenkins slave was running as. I ended up having to revert to a previous slave image and install git from there. (I probably could have also figured out what user was running the jenkins slave, and entered the desired password there.)

  2. I wanted to run a clean VM for each job. I never figured out this one. If I set Availability to Take this slave on-line when in demand and off-line when idle, that was a good start. However, if I set the times to 0 and 0, then the machine was constantly rebooting. If I set the times to 1 and 1, then the machine does mostly what I want, unless there are back-to-back jobs queued to run.

user3550496
  • 333
  • 5
  • 14
  • The hanging on the git clone is likely this: https://stackoverflow.com/questions/36479201/stuck-at-fetch-due-to-authentication-issue/37753202#37753202 – Nick Jones Jun 21 '19 at 11:22