gandalf_the_cool
gandalf_the_cool

Reputation: 718

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

Upvotes: 4

Views: 5481

Answers (1)

Jason Swager
Jason Swager

Reputation: 6501

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.

Upvotes: 7

Related Questions