5
votes

I have 3 Jenkins slaves (=nodes) with the same label (let's call them S1,S2,S3.) When I run a job that uses this label and has 3 concurrent builds, all slaves are used. When I have only one build, Jenkins always chooses the same slave (say S1), because its name is the lowest alphabetically. This slave is actually less powerful than S2, so I would prefer that S2 would be the 1st choice. A trivial solution would be to rename the slaves, but it's a wrong solution - why should a host name affected by Jenkins?

A better way (IMHO) would be to enable Jenkins master to prioritize slaves which share the same label.

Any idea?

1
Thanks @KeepCalmAndCarryOn - it seems that the 1st answer in the mentioned thread (use Scoring Load Balancer plugin) should do it. I will check it out and update this thread.Amir Katz

1 Answers

7
votes

By default, Jenkins will try to use the node that the same job has run on previously/last.

This is on the assumption that the last run of the job (and therefore the last node it ran on) has the latest SCM checkout, thus reducing the number of files required for update, and therefore speeding up the build.

To change this behaviour, use various plugins, like the aforementioned Scoring Load Balancer plugin.