-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
Unfortunately the pluign documentation is a bit short and should cover more use cases. One of them is the assignment of a default label and, in case all hosts with that label are busy, a fallback label so that the job only has to wait if all hosts with both labels are busy. This would allow to specify a preference for faster hosts and fall back to slower ones if all fast hosts are busy.
Here's what I've tried so far:
import jenkins.model.Jenkins Jenkins.instance.getLabel('FastHost').getNodes().each { agent -> def executors = agent.getComputer().numExecutors def busy = agent.getComputer().countBusy() if (busy < executors) { return "FastHost" } } return "SlowHost"
But this always returns "SlowHost", no matter how many executors are free on "FastHost" hosts.