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

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

    Details

    • Similar Issues:

      Description

      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)

       

        Attachments

          Activity

          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          Unfortunately I was unable to find time to work on plugin over last year. I decided to step down as maintainer and to mark the plugin for adoption.

          If anybody is interested, let me know

          Show
          oleg_nenashev Oleg Nenashev added a comment - Unfortunately I was unable to find time to work on plugin over last year. I decided to step down as maintainer and to mark the plugin for adoption. If anybody is interested, let me know

            People

            • Assignee:
              Unassigned
              Reporter:
              fho Fabian Holler
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: