The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing


External Resources

More Info

Page tree
Skip to end of metadata
Go to start of metadata

One of the most helpful features of Jenkins CI is automatic job queuing. If there are more build jobs requested than there are resources to execute those jobs, Jenkins can queue your tests, executing them in the order they were requested as resources become available.

By assigning labels to nodes, you can specify the resources you want to use for specific jobs, and set up graceful queuing for your tests. This topic explains how queuing works in Jenkins, how to set up nodes and jobs, and how to use use labels. It assumes you have access to an admin user account in Jenkins, or the appropriate administrative rights.

Default Queuing

Here's a basic example of how a Jenkins queue works with a single master node (the machine that runs jobs):

On the Jenkins administration page, The Build Queue and Build Executor Status panels show the node's capacity for running jobs.

On a node with two executors, up to two jobs can be executed at once. If three jobs are started, then the first two will execute and the third will be added to the Build Queue.

Adding and Labeling Nodes for Resource Assignment

Adding multiple nodes on Jenkins is straightforward. You can use different nodes to test on multiple OSs/platforms, as well as for load balancing and other functions. When you add a label to a node, you can control which jobs run on it.

To add a node or label:

  1. Add a node by clicking Manage Jenkins in the admin page menu, then click Manage Nodes > Add New Node.
  2. Add configuration information, like a name for the node and the number of executors for it to use. 
  3. In the Labels field, enter a label like sauceJobs.
  4. Navigate to the configuration pages for the jobs that you want to run on this node and select the General tab.
  5. Select Restrict where this project can be run.
  6. In the Label Expression field, enter the label for the node where you want the job to run. 

To update labels on an existing node, navigate to Manage Jenkins > Manage Nodes >  Select Node > Configure.

Once you have configured your jobs to run on specific nodes, they will queue to run on that node based on the number of available executors, as described in the example.