Jenkins: how to test the slaves -
i creating list of jenkins jobs sanity test of our jenkins build environment. want create layers of jobs. first layer of jobs check environment, e.g. if slaves up, 2nd layer can check integration other tools such github, tfs, sonarqube, 3rd layer can run typical build projects. sanity test can used verify environment after major changes jenkins servers.
we have 10 slaves created on 2 servers, 1 windows , 1 linux. know can create job run on specific slave, therefore test if slave online, way need create 10 jobs test slaves. there best approach check if slaves online?
one option use jenkins groovy scripting task this. groovy plugin provides jenkins script console (a useful way experiment) , ability run groovy scripts build steps. if you're going use script console periodic maintenance, you'll want scriptler plugin allows manage scripts run.
from manage jenkins -> script console, can write groovy script iterates through slaves , checks whether online:
for (node in jenkins.instance.nodes) { println "${node.name}, ${node.numexecutors}" def computer = node.computer println "online: ${computer.online}, ${computer.connecttime} (${computer.offlinecausereason})" } once have basic checks worked out, can create either standalone script in scriptler, or special build run these checks periodically.
it takes iteration figure out right set of properties examine. describe in another answer, can write functions introspect objects available scripting. , trial , error, can develop script performs checks want run.
Comments
Post a Comment