jenkinsjenkins-pluginsjenkins-agent

jenkins NodeLabel Parameter Plugin default


I currently have two jobs that will run around about the same time to one another.

I have two slaves setup, so was hoping that if job #1 starts on slave #1, that when job #2 starts, it would see that slave #1 is busy and use slave #2.

I have installed the NodeLabel Parameter Plugin, set the default node to slave #1, and the possible nodes for slave #1 and #2 for each job. I have set node eligibility to "ignore offline nodes" and "run next build only if job succeeds" (only because I wasn't 100% sure what to select).

The problems I am seeing are:

I am guessing I am missing something rather simple, as I presume this must be a common use for this plugin... to dynamically choose a slave based on which one is not in use?


Solution

  • I solved this by making sure the the job that is getting called has the default and possible nodes both set to the same two slaves. (instead of the default being just #1).

    Secondly, the job that calls the slaves must set a variable inside a .properties file which the job defines as to which node should be ran. This variable is then read using the 'all nodes for label factory option' in the calling job.

    This article was very helpful, but like I say, I used the 'node for label factory' instead of the 'node label parameter' option he recommends: http://www.shaunabram.com/dynamically-set-jenkins-node/