Jenkins jobs running on slaves

129 views Asked by At

I would like to restrict where a job can be run based on the job labels but also based on the job name.

Is that possible?

Or even, check if the job name matches (in same way) with the job label

Thanks in advance

P.D.: I need to do this outside the job options as I do not trust the job configuration, just the job name

3

There are 3 answers

0
Manuel On BEST ANSWER

I have found this plugin which does exactly what I wanted.

It restricts the job execution on a node base on the job name

https://wiki.jenkins-ci.org/display/JENKINS/Job+Restrictions+Plugin

Thanks for your time anycase

2
Adam Finley On

Check out the NodeLabel Parameter Plugin

You can set labels on the fly when the build itself starts, you should be able to use the job name there.

1
Vitalii Elenhaupt On

You can achieve this with a combination of few plugins: NodeLabel Parameter Plugin, Parameterized Trigger Plugin and EnvInject Plugin.

The idea is the following: use another job ("Builder", for example) to trigger other parameterized jobs with appropriate node parameter. "Builder" job will dynamically set a node parameter based on the name of the job to trigger.

Here is a good example of such approach described in pictures.