KBEC-00003 - Ensuring only one step at a time runs a process

Article ID:360033195271
1 minute readKnowledge base
On this page


Make sure only one job at a time can run a particular process while allowing concurrency for other processes on the same machine.

Some processes can be run in a single instance at a time only. For example, you might have a particular machine set up to run a process to build an installer. The install builder could be implemented so it cannot build more than one installer at the same time, but you may have several jobs running that need to use the installer, and you cannot control when these jobs might run.

The approach is to set up a resource that represents a serialized resource and set the "Step limit" to 1. Set the first job to use the resource, when it gets to the step that builds the installer, it will run on the resource. If a second job hits that point in its own build before the first job is finished, it will be blocked until the the first job is finished with the step using the resource. As soon as the first job is finished, the second job is unblocked.


Create a resource with a Step Limit of 1

Create a resource that points to the machine containing the install builder program. Note: Other CloudBees CD (CloudBees Flow) resources can be defined to point to the same machine, but those resources should not be used to access the install builder. This solution is not meant to control access or the processing load on the machine, but instead, only to serialize access to the install builder.


Resource name: InstallBuilder

    Host name: localhost

   Step limit: 1