Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Putting a wildcard/regex expression in node/label restriction in Jenkins

In job configuration, there is a checkbox "Restrict where this project can be run". If you select it, there is an input field about Label Expression. Is there a way to insert of regex there, and not the exact name? If yes, could you provide an example of this? The whole concept behind this, is that I want to assign restrict jobs to slaves that are created automatically, with similar names

like image 207
gandalf_the_cool Avatar asked Sep 12 '25 21:09

gandalf_the_cool


1 Answers

I don't believe that field can handle regular expressions, but you don't have to specify the name of the slave; you can specify a label associated with the slave.

When you create the slave, assign a label (or labels) to it. Assign the same label to all of the slaves that are suitable for that job. In the job, restrict it to run only on that label. A slave that has label can run that job.

like image 56
Jason Swager Avatar answered Sep 15 '25 23:09

Jason Swager