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

Snippet generator: Wrong snippet for Throttle Build

    • 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([])])

       

          [JENKINS-43337] Snippet generator: Wrong snippet for Throttle Build

          Andrew Bayer added a comment -

          Andrew Bayer added a comment - PR up at  https://github.com/jenkinsci/structs-plugin/pull/17

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          plugin/src/main/java/org/jenkinsci/plugins/structs/describable/DescribableParameter.java
          plugin/src/test/java/org/jenkinsci/plugins/structs/describable/AmbiguousContainer.java
          plugin/src/test/java/org/jenkinsci/plugins/structs/describable/DescribableModelTest.java
          plugin/src/test/java/org/jenkinsci/plugins/structs/describable/FirstAmbiguous.java
          plugin/src/test/java/org/jenkinsci/plugins/structs/describable/SecondAmbiguous.java
          plugin/src/test/java/org/jenkinsci/plugins/structs/describable/UnambiguousClassName.java
          http://jenkins-ci.org/commit/structs-plugin/fcf14af17e33f56e9f3629432b7e51ab6fe3f1e0
          Log:
          [FIXED JENKINS-43337] Get FQN for ambiguous parameter classes

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: plugin/src/main/java/org/jenkinsci/plugins/structs/describable/DescribableParameter.java plugin/src/test/java/org/jenkinsci/plugins/structs/describable/AmbiguousContainer.java plugin/src/test/java/org/jenkinsci/plugins/structs/describable/DescribableModelTest.java plugin/src/test/java/org/jenkinsci/plugins/structs/describable/FirstAmbiguous.java plugin/src/test/java/org/jenkinsci/plugins/structs/describable/SecondAmbiguous.java plugin/src/test/java/org/jenkinsci/plugins/structs/describable/UnambiguousClassName.java http://jenkins-ci.org/commit/structs-plugin/fcf14af17e33f56e9f3629432b7e51ab6fe3f1e0 Log: [FIXED JENKINS-43337] Get FQN for ambiguous parameter classes

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

              Created:
              Updated:
              Resolved: