jenkinsjenkins-job-dsl

How to configure a jenkins node to only accept jobs that specifically requested this node via it's label?


I know how to restrict by Job name on the node configuration page:

enter image description here

But now we have (multibranch pipeline) DSL job scripts that dynamically determine on which node they should run, and request it via node(label: 'NODE-LABEL') { ... }.

I would like to restrict one of our nodes (a dedicated mac mini responsible for installer signing) to only accept jobs that specifically requested to be run on that node.


Solution

  • In Node Configuration screen there is option "Usage". This dropdown can be used to set nodes to only accept jobs specifically matching the labels of that node. Node Usage option example in Jenkins UI

    The rest of it is to set labels for the node so that there are no accidentally jobs running on it due to matching the labels partially.