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

Throttling based on parameters does not work with Pipeline jobs

    • 2.2

      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.

          [JENKINS-37809] Throttling based on parameters does not work with Pipeline jobs

          Aaron Lunsford created issue -
          Aaron Lunsford made changes -
          Description Original: 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.
          New: 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.

          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: []
          

          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: []
          Aaron Lunsford made changes -
          Description Original: 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.
          New: 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.
          Aaron Lunsford made changes -
          Link New: This issue relates to JENKINS-37929 [ JENKINS-37929 ]
          Jesse Glick made changes -
          Labels New: pipeline
          Oleg Nenashev made changes -
          Issue Type Original: Bug [ 1 ] New: New Feature [ 2 ]

          Oleg Nenashev added a comment -

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

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

          Oleg Nenashev added a comment -

          Closing as a duplicate of JENKINS-31801

          Oleg Nenashev added a comment - Closing as a duplicate of JENKINS-31801
          Oleg Nenashev made changes -
          Link New: This issue duplicates JENKINS-31801 [ JENKINS-31801 ]
          Oleg Nenashev made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            basil Basil Crow
            alunsford Aaron Lunsford
            Votes:
            13 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated:
              Resolved: