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

Snippet generator: Wrong snippet for Throttle Build

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • structs-plugin
    • None
    • Jenkins LTS 2.32.2
      branch-api:1.11.1 'Branch API Plugin'
      workflow-aggregator:2.4 'Pipeline'

      In the snippet generator, the following configuration... 

       

       

      ... returns:

       

      properties([[$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false], 
      [$class: 'ThrottleJobProperty', categories: [], limitOneJobWithMatchingParams: false, maxConcurrentPerNode: 0, maxConcurrentTotal: 0, paramsToUseForLimit: '', throttleEnabled: false, throttleOption: 'project'], 
      [$class: 'JobPropertyImpl', throttle: [count: 1, durationName: 'hour']],
      pipelineTriggers([])])

       

      In the console output after running that snippet, it returns:

       

      ... Caused by: java.lang.UnsupportedOperationException: JobPropertyImpl as a class hudson.model.JobProperty could mean either jenkins.branch.RateLimitBranchProperty$JobPropertyImpl or com.cloudbees.hudson.plugins.modeling.impl.jobTemplate.JobPropertyImpl ... Finished: FAILURE

       

      It is failing in recognized JobPropertyImpl 

      Workaround: change the above snippet for the following one which works:

      properties([[$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false], 
      [$class: 'ThrottleJobProperty', categories: [], limitOneJobWithMatchingParams: false, maxConcurrentPerNode: 0, maxConcurrentTotal: 0, paramsToUseForLimit: '', throttleEnabled: false, throttleOption: 'project'], 
      [$class: 'jenkins.branch.RateLimitBranchProperty$JobPropertyImpl', throttle: [count: 2, durationName: 'day']],
      pipelineTriggers([])])

       

            abayer Andrew Bayer
            carlosrodlop Carlos Rodríguez López
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: