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

Throttling based on parameters does not work in Pipelines

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Configuration

      1. Pipeline job with parameters
      2. Execute concurrent builds if necessary: true
      3. Throttle Concurrent Builds: true
      4. Prevent multiple jobs with identical parameters from running concurrently: true

      Notes

      • Job parameters are defined as part of the pipeline setup with the properties command
      • This is also an issue when properties are not defined as part of the pipeline setup, and are configured through the UI directly

      Problem

      When throttling based on one of the job's parameters, the plugin does not prevent multiple builds from running concurrently when the defined parameter is the same.

        Attachments

          Issue Links

            Activity

            alunsford Aaron Lunsford created issue -
            alunsford Aaron Lunsford made changes -
            Field Original Value New Value
            Description h3. Configuration

            # Pipeline job with parameters
            # Execute concurrent builds if necessary: true
            # Throttle Concurrent Builds: true
            # Prevent multiple jobs with identical parameters from running concurrently: true
             
            h3. Notes - Job parameters are defined as part of the pipeline setup with the {{properties}} command

            h3. Problem When throttling based on one of the job's parameters, the plugin does not prevent multiple builds from running concurrently when the defined parameter is the same.
            h3. Configuration
            # Pipeline job with parameters
            # Execute concurrent builds if necessary: true
            # Throttle Concurrent Builds: true
            # Prevent multiple jobs with identical parameters from running concurrently: true
             
            h3. Notes
             - Job parameters are defined as part of the pipeline setup with the {{properties}} command

            h3. Problem
            When throttling based on one of the job's parameters, the plugin does not prevent multiple builds from running concurrently when the defined parameter is the same.
            Hide
            alunsford Aaron Lunsford added a comment - - edited

            I did some more digging on the issue and it looks like problem is in the getParametersFromWorkUnit() method. On Freestyle jobs, the conditional that checks unit.context.actions gets populated with values, but for Pipeline jobs it does not.

            The WorkUnit object that is passed to getParametersFromWorkUnit() for a normal job looks like this:

            hudson.model.queue.WorkUnit@53acb86e[work=Working]

            , where "Working" is the name of the job. For Pipeline jobs, it looks like

            hudson.model.queue.WorkUnit@496091d7[work=part of Throttle-this #11]

            , where "Throttle-this" is the name of the job and "#11" is the build number.

            To try and summarize:

            Freestyle jobs where the plugin works:

            - WorkUnit object: hudson.model.queue.WorkUnit@53acb86e[work=Working]
            - WorkUnit.context: hudson.model.queue.WorkUnitContext@14401e37
            - WorkUnit.context.actions: [hudson.model.ParametersAction@7e92e075, hudson.model.CauseAction@1d3d3d46]
            

            Pipeline jobs where the plugin does not work:

            - WorkUnit object: hudson.model.queue.WorkUnit@496091d7[work=part of Throttle-this #11]
            - WorkUnit.context: hudson.model.queue.WorkUnitContext@47a7768b
            - WorkUnit.context.actions: []
            
            Show
            alunsford Aaron Lunsford added a comment - - edited I did some more digging on the issue and it looks like problem is in the getParametersFromWorkUnit() method. On Freestyle jobs, the conditional that checks unit.context.actions gets populated with values, but for Pipeline jobs it does not. The WorkUnit object that is passed to getParametersFromWorkUnit() for a normal job looks like this: hudson.model.queue.WorkUnit@53acb86e[work=Working] , where "Working" is the name of the job. For Pipeline jobs, it looks like hudson.model.queue.WorkUnit@496091d7[work=part of Throttle-this #11] , where "Throttle-this" is the name of the job and "#11" is the build number. To try and summarize: Freestyle jobs where the plugin works: - WorkUnit object: hudson.model.queue.WorkUnit@53acb86e[work=Working] - WorkUnit.context: hudson.model.queue.WorkUnitContext@14401e37 - WorkUnit.context.actions: [hudson.model.ParametersAction@7e92e075, hudson.model.CauseAction@1d3d3d46] Pipeline jobs where the plugin does not work: - WorkUnit object: hudson.model.queue.WorkUnit@496091d7[work=part of Throttle-this #11] - WorkUnit.context: hudson.model.queue.WorkUnitContext@47a7768b - WorkUnit.context.actions: []
            alunsford Aaron Lunsford made changes -
            Description h3. Configuration
            # Pipeline job with parameters
            # Execute concurrent builds if necessary: true
            # Throttle Concurrent Builds: true
            # Prevent multiple jobs with identical parameters from running concurrently: true
             
            h3. Notes
             - Job parameters are defined as part of the pipeline setup with the {{properties}} command

            h3. Problem
            When throttling based on one of the job's parameters, the plugin does not prevent multiple builds from running concurrently when the defined parameter is the same.
            h3. Configuration
            # Pipeline job with parameters
            # Execute concurrent builds if necessary: true
            # Throttle Concurrent Builds: true
            # Prevent multiple jobs with identical parameters from running concurrently: true
             
            h3. Notes
            - Job parameters are defined as part of the pipeline setup with the {{properties}} command
            - This is also an issue when properties are not defined as part of the pipeline setup, and are configured through the UI directly

            h3. Problem
            When throttling based on one of the job's parameters, the plugin does not prevent multiple builds from running concurrently when the defined parameter is the same.
            alunsford Aaron Lunsford made changes -
            Link This issue relates to JENKINS-37929 [ JENKINS-37929 ]
            jglick Jesse Glick made changes -
            Labels pipeline
            oleg_nenashev Oleg Nenashev made changes -
            Issue Type Bug [ 1 ] New Feature [ 2 ]
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            TCB plugin is not integrated with Pipeline, so it is a New Feature.

            Show
            oleg_nenashev Oleg Nenashev added a comment - TCB plugin is not integrated with Pipeline, so it is a New Feature.
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Closing as a duplicate of JENKINS-31801

            Show
            oleg_nenashev Oleg Nenashev added a comment - Closing as a duplicate of JENKINS-31801
            oleg_nenashev Oleg Nenashev made changes -
            Link This issue duplicates JENKINS-31801 [ JENKINS-31801 ]
            oleg_nenashev Oleg Nenashev made changes -
            Resolution Duplicate [ 3 ]
            Status Open [ 1 ] Resolved [ 5 ]
            Hide
            hemanglavana HemangLavana added a comment -

            Are you sure, it is duplicate: when I looked at JENKINS-31801, it seems to be about supporting throttle feature within the pipeline. Whereas if you look at the screenshot attached to this issue, it is about using TCB and pipeline like any other normal job.

            And this specific issue is that the feature in TCB plugin "to throttle based on job parameters" for pipeline jobs does not work whereas it works for normal jobs.

            Show
            hemanglavana HemangLavana added a comment - Are you sure, it is duplicate: when I looked at JENKINS-31801 , it seems to be about supporting throttle feature within the pipeline. Whereas if you look at the screenshot attached to this issue, it is about using TCB and pipeline like any other normal job. And this specific issue is that the feature in TCB plugin "to throttle based on job parameters" for pipeline jobs does not work whereas it works for normal jobs.
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            HemangLavana I am sure. TCB plugin is not integrated with Pipeline, which is explicitly mentioned in https://github.com/jenkinsci/pipeline-plugin/blob/master/COMPATIBILITY.md . It means that any TCB plugin logic may work incorrectly with Pipeline.

            Show
            oleg_nenashev Oleg Nenashev added a comment - HemangLavana I am sure. TCB plugin is not integrated with Pipeline, which is explicitly mentioned in https://github.com/jenkinsci/pipeline-plugin/blob/master/COMPATIBILITY.md . It means that any TCB plugin logic may work incorrectly with Pipeline.
            Hide
            hemanglavana HemangLavana added a comment -

            thx for clarifying

            Show
            hemanglavana HemangLavana added a comment - thx for clarifying
            jamesdumay James Dumay made changes -
            Remote Link This issue links to "CloudBees Internal OSS-2007 (Web Link)" [ 18463 ]
            Hide
            denisharder Dennis Harder added a comment -

            Questioning why this request was closed. I have the same comment as HemangLavana, this issue seems to be asking about throttling pipelines based on parameter values. I do not see anything in the throttle concurrent build pipeline documentation related to parameter throttling. Am I looking in the wrong place?

            https://github.com/jenkinsci/throttle-concurrent-builds-plugin#throttling-in-jenkins-pipeline

             

            Show
            denisharder Dennis Harder added a comment - Questioning why this request was closed. I have the same comment as HemangLavana , this issue seems to be asking about throttling pipelines based on parameter values. I do not see anything in the throttle concurrent build pipeline documentation related to parameter throttling. Am I looking in the wrong place? https://github.com/jenkinsci/throttle-concurrent-builds-plugin#throttling-in-jenkins-pipeline  
            Hide
            gundal Leeam Dagan added a comment -

            Oleg Nenashev

            Can this bug be reopened now?

            Pipeline support of TCB was added in 2.0 and 2.01

            However parameter based throttling was not added, or does this instead need to be a new feature request?

            I am leaning towards bug because there exists no way to do parameter throttling unless using freestyle, but as referenced here

            https://github.com/jenkinsci/pipeline-plugin/blob/master/COMPATIBILITY.md

            TCB has indeed been added to pipeline support.

            Show
            gundal Leeam Dagan added a comment - Oleg Nenashev Can this bug be reopened now? Pipeline support of TCB was added in 2.0 and 2.01 However parameter based throttling was not added, or does this instead need to be a new feature request? I am leaning towards bug because there exists no way to do parameter throttling unless using freestyle, but as referenced here https://github.com/jenkinsci/pipeline-plugin/blob/master/COMPATIBILITY.md TCB has indeed been added to pipeline support.
            gundal Leeam Dagan made changes -
            Resolution Duplicate [ 3 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            vinus079 Vinay Somashekar made changes -
            Issue Type New Feature [ 2 ] Bug [ 1 ]
            Hide
            vinus079 Vinay Somashekar added a comment -

            Oleg Nenashev, Could you please look at this one? Now, this should be a bug and not Feature. 

             

            Show
            vinus079 Vinay Somashekar added a comment - Oleg Nenashev , Could you please look at this one? Now, this should be a bug and not Feature.   
            Hide
            yeluolei Rurui Ye added a comment -

            any update on this? I saw it was linked to the workUnitContext issue

            Show
            yeluolei Rurui Ye added a comment - any update on this? I saw it was linked to the workUnitContext issue
            Hide
            dannyg Danny Gueta added a comment -

            +1, any update on this ? we've used this plugin in the past but once we moved to pipelines its not working anymore, can't limit by parameters. 

            Show
            dannyg Danny Gueta added a comment - +1, any update on this ? we've used this plugin in the past but once we moved to pipelines its not working anymore, can't limit by parameters. 
            Hide
            shezaan Sherabi GuessWhat added a comment - - edited

            We are having the same issue.
            1. Uncheck "Do not allow concurrent builds"
            2. Check "Throttle concurrent builds"
                 -> Check "Prevent multiple jobs with identical parameters from running concurrently"

            Below is Pipeline as code for the above steps:

            // disableConcurrentBuilds(), --> Note concurrency is enabled since this line is commented out.
            [$class: 'ThrottleJobProperty', categories: [], limitOneJobWithMatchingParams: true, maxConcurrentPerNode: 0, maxConcurrentTotal: 0, paramsToUseForLimit: '', throttleEnabled: true, throttleOption: 'project']

            Show
            shezaan Sherabi GuessWhat added a comment - - edited We are having the same issue. 1. Uncheck "Do not allow concurrent builds" 2. Check "Throttle concurrent builds"      -> Check "Prevent multiple jobs with identical parameters from running concurrently" Below is Pipeline as code for the above steps: // disableConcurrentBuilds(), --> Note concurrency is enabled since this line is commented out. [$class: 'ThrottleJobProperty', categories: [], limitOneJobWithMatchingParams: true , maxConcurrentPerNode: 0, maxConcurrentTotal: 0, paramsToUseForLimit: '', throttleEnabled: true , throttleOption: 'project']
            francob Franco Bladilo made changes -
            Status Reopened [ 4 ] Open [ 1 ]
            Hide
            francob Franco Bladilo added a comment -

            Having the same issues not being able to throttle pipeline jobs based on parameters, has this received any attention/help/updates? This is causing a lot of pain on our internal CI. Running Jenkins jenkins-2.222.1 with latest TCB.

            Show
            francob Franco Bladilo added a comment - Having the same issues not being able to throttle pipeline jobs based on parameters, has this received any attention/help/updates? This is causing a lot of pain on our internal CI. Running Jenkins jenkins-2.222.1 with latest TCB.

              People

              Assignee:
              oleg_nenashev Oleg Nenashev
              Reporter:
              alunsford Aaron Lunsford
              Votes:
              13 Vote for this issue
              Watchers:
              17 Start watching this issue

                Dates

                Created:
                Updated: