I have a number of different jobs in Jenkins, partitioned out into projects with their own "pipelines" of build/test/analysis. Most of these jobs are actually remote commands instead of on-box-builds.
However, Jenkins out of the box only supports one queue for all builds. I want to define one queue per project (or view).
How would I accomplish this?
Yes it's possible. Doc: If this option is checked, Jenkins will schedule and execute multiple builds concurrently (provided that you have sufficient executors and incoming build requests.)
It uses 4 Build Executors and puts 1 build into the queue.
Jenkins supports several different types of build jobs. The two most commonly-used are the freestyle builds and the Maven 2/3 builds.
It lets you create node and label parameter in the job configuration. Node parameter contains all the nodes present in your Jenkins including master, you can select the nodes you want. When you run the job with parameters you can select the desired node and the job will get executed in that particular node.
As far as I know this is not possible without changing the Jenkins code, but I think you could achieve the same goal with minimal maintenance using build slaves. Different builds can run concurrently on the slaves, or even on the same slave if you define multiple executors (if the slave machine has >1 CPU). You can label the slaves to control which jobs get executed on each one, so you could have a separate set of slaves for each of your pipelines.
Apart from the overhead of making sure the basic slave machines stay running, the Jenkins specific overhead for running a slave is minimal. You can use a process on the master to keep the slave JAR file and the build tools you need updated; at my shop we use a simple rsync script that runs every time the master or slave is restarted to copy the latest tools from the master to the slave and restart the slave process.
This approach also reduces the extent to which the Jenkins master is a single point of failure.
First of all, I'd like to point out that, like other answers describe, pegging the different build queues to different slaves would be the recommended solution, however there's a way to accomplish the same effect with just the master node.
There's a plugin called Throttle Concurrent Builds. It allows setting the build concurrency level either on a per-job basis, or across jobs.
The documentation was a bit vague, so these are the steps that worked for me:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With