I have a few Jenkins slaves, some of them are labeled by "X", and others with "Y" label. I'd like to choose group of slaves, based on their label, when I starting this job from its upstream job. I.e. I want to pass a value for a label (for NodeLabelParameter plugin) as a parameter.
I already played with a NodeLabelParameter and Parameterized Trigger plugins, reviewed http://www.shaunabram.com/dynamically-set-jenkins-node/ and similar articles, but still wasn't able to implement a flow I need.
Solved by using NodeLabelParameter and Parameterized Trigger plugins. For some reason I missed that I need to use BuildParameterFactory in order to run on all slaves with chosen label.
It is good to use
Label nodes
when you want a node to be reserved for certain kinds of jobs, while preventing all other jobs from using that machine.Lets say you want the slave run jobs which are labelled as slave and the master node to only run jobs which are labelled as master.
Manage Jenkins -> mange nodes -> configure -> Usage -> "only build job with label expression matching this node" , then in the label input box put slave and save.
Next configure the master machine under nodes, Usage -> "only build job with label expression matching this node" , then in the label input box put master and save.
Next label the job -> restrict when this project can run - in the label input box put master so the job can only run on master node and click save.
and so on... hope you understand the concept.