Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-48010

Throttling a steps{} or stage{} block has no effect in declarative syntax


    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins 2.89
      Throttle Concurrent Builds Plug-in 2.0.1

      It seems not to work to throttle stage{} or steps{} blocks  in a declarative Jenkinsfile.

      When throttle is used outside of a steps block I get an syntax error.
      When I use throttle inside a steps block it doesn't have any effect.

      I have a throttle category named build configured to run max. 4 jobs per Node, max. total concurrent builds is 0.
      It works when I'm using throttle() in the scripted syntax.

      With the following job the throttling category has no effect:


      pipeline {
      agent any
        stages {
          stage("sleep") {
            steps {
              throttle(["build"]) {
                sh 'echo sleeping; sleep 120;'


      When using a node inside throttle, throttling works but the declarative syntax requires a label parameter for node().
      That has the disadvantages:

      • It's not possible to run the step on any node and throttle it, except you tag all jenkins machines with the same label.
      • a new node uses a different workspace
      • an executor is consumed for the node block, if it's throttled the executor will be only waiting for being allowed to run
      steps {
        throttle(["build"]) {
          node(label: "master") {
            sh 'echo sleeping; sleep 120;'



      (I also couldn't find any documentation about how to use it in declarative syntax)


            Unassigned Unassigned
            fho Fabian Holler
            2 Vote for this issue
            5 Start watching this issue