Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

Plugin Information

View Exclusion on the plugin site for more information.

This plugin manages exclusion between jobs.

About this plugin

This plugin is inspired by the Port-Allocator plugin.

The purpose of this plugin is to manage conflicts between jobs.

The Exclusion plugin allows you to assign resource names to jobs on Jenkins.The plugin will ensure that jobs sharing a same resource will not be executed at the same time. The resource name is a semaphore.

With the second part of the plugin you can, in an administration panel, see the list of resources configured in each job, see when a resource is allocated and, thanks to the release button, you can release a resource currently used.


Firstly you have to activate the plugin by checking the box “Add resource to manage exclusion”. It allows you to add resources. A resource is represented by a name (String). You can add as much resources as needed.

Secondly you have to determine the critical zone, delimited by a start (Critical Block Start) and an end (Critical Block End). All build steps included in a critical zone will be managed by Exclusion plugin.

If you don’t add a start block the plugin won’t do anything. If you don’t add an end block, resources will be release after the last build step.

Administration Panel

When you are on the home page of Jenkins, you can access the Administration Panel.

In this page, you can see all resources configured. The status (Action) of a job is set to "Currently Used" when the job is running (if he has a resource configured). It means that the resource is currently allocated -> the other jobs using the same resource can’t be run at this moment.

You can release a resource by selecting a resource name in the combo box (that displays only the resources currently used) and clicking on “Release resource button”.

About me

Owner & maintainer of the project: GitHub: anthonyroux & Twitter: AnthonyRoux_

Change Log

Version 0.12 (Apr 19, 2016)

Contribution of Oleksandr Kulychok

  • Fixed Administration panel 

Version 0.11 (Oct 25, 2015)

Contribution of Emanuel Zattin

  • Add support for the Workflow plugin.

Version 0.10 (Jan 25, 2014)

Version 0.9 (Nov 18, 2013)

  • Fixed a security vulnerability that allows non-administrator users from releasing resources that are currently held (SECURITY-53)

Version 0.8 (Nov 8, 2012)

  • JENKINS-14953 Exclusion plugin sometimes reports a resource as locked when it is not. Jobs hang as a result.

Version 0.7 (July 7, 2012)

  • JENKINS-12250 Critical block can not be added into conditional step

Version 0.6 (Jun 19, 2011)


  1. Unknown User (ssplett)

    Hello, I like this semaphore approach for sychronising some critical regions of a build. But I am in need for a little bit more control over the semaphores.

    We are currently using Jenkins for data migration. We receive data from several sources and during the migration process this data has to be merged into one package. For testing purposes we need to pull intermediate packages (after only some of the sources supplied data). We identify each package by an ID. So we are in need for a kind of "parametrized semaphore" so we could protect critical regions depending on this ID.

    Example for our use-case:

    • A migration for a package with ID 123 and one for ID 456 have to be done.
    • There is a parametrized job "UploadDataForMigration" and a parametrized job "GetPackage". This two jobs have critical regions that may not run concurrently for the same migration ID.
    • We need to pull an intermediate package for ID 123 with the job "GetPackage".
    • A little bit earlier user Bob used the job "UploadDataForMigration" with ID 456 to upload his part of the data for the package 456.
    • A little bit after we started the job "GetPackage" user Alice uses the job "UploadDataForMigration" with ID 123 to upload her part of the data for the package 123.

    We now need a semaphore that protects the critical regions for ID 123 so that the job Alice started is blocked but the job Bob started can run (because "GetPackage" is not running with ID 456).

    Could you implement a new feature that takes one or more parameters for a ressource and thus generates a "parametrized semapohre"? Like I configure "$ID" and at job execution time the ID "123" is inserted and the ressource is shown as "RESSOURCE ('123')" in the Exclusion control panel?!

  2. Unknown User (mcote)

    When the resource is released, shouldn't jobs waiting for it, start executing again?  I am not seeing that happen.

  3. Unknown User (mcote)

    When the resource is released, shouldn't jobs waiting for it, start executing again?  I am not seeing that happen.

  4. Unknown User (dtka)

    Cannot bring this to work.

    Having added a first resource for one job I do not see it in the "Add" drop-down in another job. As a result, I had to add a "new" resource with the same name as in the first job, but the two jobs can still run simultaneously. So I am back using the to-be-deprecated Locks and Latches plugin.

    What am I doing wrong? 

    P.S. I did not forget to add the "critical step start" build steps and I see the resource as occupied on "Exclusion Administration".

    1. Unknown User (dtka)

      I was expecting that the blocked job won't execute at all and not execute but wait. So I guess the plugin works.

      However, as already noted by marlene cote, it seems that the waiting job is stuck in the waiting mode forever, even after the resource had become available again:

      [Exclusion] -> Allocating resource : RES1
      Waiting ressource : RES1 currently use by : Job1 #44

      This renders the plugin not very useful for my purposes. Any ideas?

      1. Unknown User (anthonyroux)

        Show me a screenshot of your configuration.

        You need to add the critical block start and the critical block end in order to release the resources (BTW resources will be released at the end of the job).

  5. Unknown User (dankirkd)

    I currently use Locks & Latches to control two or more builds from running at the same time.  Problem is the locks are released before a job is fully complete, i.e. before post-build steps complete.  That allows a lock to be freed up before I really want it to.

    Looking at what is written above regarding the "critical block start" and "critical block end" build steps, it would appear that this plugin doesn't address that need either because after the build steps are complete the block is lifted, but the post build steps are still to run.

    Please confirm.  If so, could that be a future enhancement, to end the block at the end of all post-build steps?



  6. Unknown User (wernight)

    I need to avoid two or more jobs to run at the same time on the same Jenkins node. However there I'd like them to run on another note or at least not block them when they are running on different nodes. For example: Two jobs use the same local database, or the same absolute file path.

    A way to possibly simplify this plugin would be to let users input the resources in a text field of "Critical block start" and "Critical block end" (comma separated).

    I believe "Critical block end" is actually a "Critical block earlier lock release" (or "Early lock release"), but that's more a discussion.

    1. Unknown User (nweiser1)

      did you find a solution for this? " avoid two or more jobs to run at the same time on the same Jenkins node."

  7. Unknown User (winner0911)


    set "Add resource to manage exclusion" to one parameter as "$JSON_FILE".

    It cause job can take exclusion of "$JSON_FILE", but can not releset this exclusion.

    1  one job with build parameters "JSON_FILE",

    2  job check "Add resource to manage exclusion",and set to "$JSON_FILE".

    3  add "Critical block start" and "Critical block end" into build.

    4  build first time with JSON_FILE=inp_func_18764_v2.json

    5  stop this job manually

    6  build second time with JSON_FILE=inp_func_18764_v2.json

    I find console #33 show.Exclusion -> Allocating resource : inp_func_18764_v2.json
    Waiting ressource : INP_FUNC_18764_V2.JSON currently used by : INP_FUNC_Runtime_Debuger #32

  8. Unknown User (generatz)

    1. Thanks much for this plugin - I find it very, very helpful.

    2. I would find it very useful to have the exclusion plugin print out a "." or something every minute or so - or anything that would generate regular activity. That would allow me to better tune my "Abort the build if it's stuck" timeout. Otherwise, if I "stack" up a bunch of builds that depend on the same resource, the timeout period must be overly forgiving.

  9. Unknown User (casadelgato)

    I need to setup a critical section around our Source Control handling.

    I'd like to:

    • Start Critical Section
    • Sync code from repository
    • Tag repo with build number
    • End Critical Section

    I don't see any way to put a Start tag before the Build steps - as Jenkins does the Sync before it starts the Build steps.

  10. Unknown User (shankarinece)

    When I allocate a resource using this plugin in a multi configuration job, when the job executes, one configuration in the multi configuration matrix locks the resource and all other configurations waits until the resource is released, even though all the configuration can run in parallel.

    Is there a way that within a job's configuration, the resource block can be avoided?



  11. Unknown User (ksanand)

    Excellent plugin. Just what I wanted. Thanks.