We have script that use vSphere to do revert-snapshot to machine and turn on.
And then we check if agent available like this:
def checkAgentAvalability(agName, tolerance) {
try {
int sleepTime = 5
def jenkinsObj = Jenkins.instance.getNode(agName)
printLogger("INFO", "checkAgentAvalability() Agent: " + agName + ", tolerance: " + tolerance)
handleSlaveMode(agName, false)
sleep (5000)
for (int i = 0; i < tolerance; i++) {
if (jenkinsObj.toComputer().isOnline()) {
if (jenkinsObj.getRootPath() != null && !jenkinsObj.getComputer().getLog().contains('error'))
{
return true
} else {
sleep (5000)
}
}
sleep (5000)
}
return false
}
catch (err)
{
return false
}
}
We use this scripts to get up 30 machines and prepare them for tests.
We are getting failures with random machines with this exception:
java.io.NotSerializableException: hudson.slaves.JNLPLauncher
How its possible to fix this issue? I can't find the root cause in internet.
How its possible to check if agent that created automatically is up? We also sometimes have disconnects after agent is up
Thanks