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)

       

          [JENKINS-48010] Throttling a steps{} or stage{} block has no effect in declarative syntax

          Fabian Holler created issue -
          Fabian Holler made changes -
          Description Original: 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. It works when I'm using throttle() in the scripted syntax.

          With the following job the throttling category has no effect:

           
          {code:java}
          pipeline {
            agent any

            stages {
              stage {
                steps {
                  throttle(["build"]) {
                    sh 'sleep 120'
                  }
                }
              }
            }
          }{code}
          (I also couldn't find any documentation about how to use it in declarative syntax)

           
          New: 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. It works when I'm using throttle() in the scripted syntax.

          With the following job the throttling category has no effect:

           
          {code:java}
          pipeline {
            agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'sleep 120'
                  }
                }
              }
            }
          }{code}
          (I also couldn't find any documentation about how to use it in declarative syntax)

           
          Fabian Holler made changes -
          Description Original: 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. It works when I'm using throttle() in the scripted syntax.

          With the following job the throttling category has no effect:

           
          {code:java}
          pipeline {
            agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'sleep 120'
                  }
                }
              }
            }
          }{code}
          (I also couldn't find any documentation about how to use it in declarative syntax)

           
          New: 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. It works when I'm using throttle() in the scripted syntax.

          With the following job the throttling category has no effect:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
          (I also couldn't find any documentation about how to use it in declarative syntax)

           
          Fabian Holler made changes -
          Description Original: 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. It works when I'm using throttle() in the scripted syntax.

          With the following job the throttling category has no effect:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
          (I also couldn't find any documentation about how to use it in declarative syntax)

           
          New: 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:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
           

          It also doesn't work when I'm using {{node()}} inside {{steps\{}}} like:
          {code:java}
          steps {
           throttle(["build"]) {
           node(label: "master") {
           sh 'echo sleeping; sleep 120;'
           }
           }
           }{code}
           

           

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

           
          Fabian Holler made changes -
          Description Original: 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:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
           

          It also doesn't work when I'm using {{node()}} inside {{steps\{}}} like:
          {code:java}
          steps {
           throttle(["build"]) {
           node(label: "master") {
           sh 'echo sleeping; sleep 120;'
           }
           }
           }{code}
           

           

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

           
          New: 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:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
           

          It also doesn't work when I'm using {{node()}} inside {{steps}} like:
          {code:java}
          steps {
            throttle(["build"]) {
              node(label: "master") {
                sh 'echo sleeping; sleep 120;'
              }
            }
          }{code}
           

           

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

           
          Fabian Holler made changes -
          Description Original: 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:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
           

          It also doesn't work when I'm using {{node()}} inside {{steps}} like:
          {code:java}
          steps {
            throttle(["build"]) {
              node(label: "master") {
                sh 'echo sleeping; sleep 120;'
              }
            }
          }{code}
           

           

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

           
          New: 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:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
           

          It also doesn't work when I'm using {{node()}} inside {{steps\{}}}  (and it's not what I want) like:
          {code:java}
          steps {
            throttle(["build"]) {
              node(label: "master") {
                sh 'echo sleeping; sleep 120;'
              }
            }
          }{code}
           

           

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

           
          Fabian Holler made changes -
          Description Original: 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:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
           

          It also doesn't work when I'm using {{node()}} inside {{steps\{}}}  (and it's not what I want) like:
          {code:java}
          steps {
            throttle(["build"]) {
              node(label: "master") {
                sh 'echo sleeping; sleep 120;'
              }
            }
          }{code}
           

           

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

           
          New: 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:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
           

          When using a node inside throttle, throttling works but the declarative syntax requires a parameter
          {code:java}
          steps {
            throttle(["build"]) {
              node(label: "master") {
                sh 'echo sleeping; sleep 120;'
              }
            }
          }{code}
           

           

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

           
          Fabian Holler made changes -
          Description Original: 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:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
           

          When using a node inside throttle, throttling works but the declarative syntax requires a parameter
          {code:java}
          steps {
            throttle(["build"]) {
              node(label: "master") {
                sh 'echo sleeping; sleep 120;'
              }
            }
          }{code}
           

           

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

           
          New: 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:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
           

          When using a node inside throttle, throttling works but the declarative syntax requires a label parameter for {{node()}}. It's not possible to run the step on any node and throttle it, except you tag all jenkins machines with the same label.
          {code:java}
          steps {
            throttle(["build"]) {
              node(label: "master") {
                sh 'echo sleeping; sleep 120;'
              }
            }
          }{code}
           

           

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

           
          Fabian Holler made changes -
          Description Original: 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:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
           

          When using a node inside throttle, throttling works but the declarative syntax requires a label parameter for {{node()}}. It's not possible to run the step on any node and throttle it, except you tag all jenkins machines with the same label.
          {code:java}
          steps {
            throttle(["build"]) {
              node(label: "master") {
                sh 'echo sleeping; sleep 120;'
              }
            }
          }{code}
           

           

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

           
          New: 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:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
           

          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

          {code:java}
          steps {
            throttle(["build"]) {
              node(label: "master") {
                sh 'echo sleeping; sleep 120;'
              }
            }
          }{code}
           

           

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

           
          Fabian Holler made changes -
          Description Original: 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:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
           

          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

          {code:java}
          steps {
            throttle(["build"]) {
              node(label: "master") {
                sh 'echo sleeping; sleep 120;'
              }
            }
          }{code}
           

           

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

           
          New: 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:

           
          {code:java}
          pipeline {
          agent any

            stages {
              stage("sleep") {
                steps {
                  throttle(["build"]) {
                    sh 'echo sleeping; sleep 120;'
                  }
                }
              }
            }
          }{code}
           

          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

          {code:java}
          steps {
            throttle(["build"]) {
              node(label: "master") {
                sh 'echo sleeping; sleep 120;'
              }
            }
          }{code}
           

           

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

           
          Oleg Nenashev made changes -
          Assignee Original: Oleg Nenashev [ oleg_nenashev ]

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

              Created:
              Updated: