jenkins job on two slaves? jenkins job on two slaves? jenkins jenkins

jenkins job on two slaves?


I just learned from that the simultaneous allocation of multiple slaves can be done nicely in a pipeline job, by nesting node clauses:

node('label1') {    node('label2') {        // your code here        [...]    }}

See this question where Mateusz suggested that solution for a similar problem.


Let me see if I understood the problem.

  1. You want to have dynamically choose a slave and start the App Server on it.

  2. When the App server is running on a Slave you do not want it to run any other job.

  3. But when the App server is not running, you want to use that Slave as any other Slave for other jobs.

One way out will be to label the Slaves. And use "Restrict where this project can be run" to make the App Server and the Test Suite run on the machines with Slave label.

Then in the slave nodes, put " # of executors" to 1. This will make sure that at anytime only one Job will run.

Next step will be to create a job to start the App Server and then kick off the Test job once the App Server start job is successful..

If your test job needs to know the server details of the machine where your App server is running then it becomes interesting.