Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins - How to reserve an executor for (a) specific job(s)

We have a Jenkins server with 8 executors and 20 jobs. 15 of those jobs take approximately 2 hours to finish while the remaining 5 take only 15 minutes. I would like to reserve 1 executor (or 2) to run those 5 small jobs only and restrict other jobs to run on the other executors. Note: I don't have any slaves, just 8 executors on master Jenkins process.

I'm new to Jenkins so I just wonder is it any way that I can do that? Thank you.

like image 700
Kiddo Avatar asked May 25 '17 17:05

Kiddo


People also ask

What does of executors indicate for Jenkins configuration?

Resolution. A Jenkins executor is one of the basic building blocks which allow a build to run on a node/agent (e.g. build server). Think of an executor as a single "process ID", or as the basic unit of resource that Jenkins executes on your machine to run a build.

How do I execute one Jenkins job after the other?

Select a job that triggers a remote one and then go to Job Configuration > Build section > Add Build Step > Trigger builds on remote/local projects option. This configuration allows you to trigger another exciting job on a different CM (remote). The downstream job name part will autocomplete.


2 Answers

Adding to @StephenKing answer, you also have to specify the label name for each job while configuring it, as shown in the below image:

enter image description here

like image 183
Arpit Aggarwal Avatar answered Sep 20 '22 07:09

Arpit Aggarwal


I'm a bit late but I think it would be much easier to restrict how many concurrent "slow" jobs can run than trying to reserve executors. This is simple to do with the Lockable Resources plugin: https://wiki.jenkins.io/display/JENKINS/Lockable+Resources+Plugin

Simply add as many resources as the number of slow jobs you want to allow (6 or 7) and give them all the same label. Modify the job configurations to lock a resource (by label with quantity 1) before it can execute. If all the resources are already locked, then the job will wait until one is freed.

like image 33
dcendents Avatar answered Sep 19 '22 07:09

dcendents