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

Incorrect usage of rateLimit.count in multibranchPipelineJob

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • branch-api-plugin
    • None
    • Jenkins version: 2.330
      Branch API plugin: 2.7.0
      Job DSL plugin: 1.78.3
      GitLab plugin: 1.5.26

      There is a multibranchPipelineJob DSL configured with rateLimit to throttle builds:

      multibranchPipelineJob('testJob') {
      ...
          branchSources {
              branchSource {
                  strategy {
                      allBranchesSame {
                          props {
                              rateLimit {
                                  // The maximum number of builds allowed within the specified time period.
                                  count(5)
                                  // The time period within which the maximum number of builds will be enforced.
                                  durationName('hour')
                                  // Enable this option to permit user triggered builds to skip the rate limit.
                                  userBoost(true)
                              }
                          }
                      }
                  }
              }
          }
      ...
      }
      

      The job's config.xml and also the branch jobs' config.xml shows the correct settings:

      <jenkins.branch.RateLimitBranchProperty>
          <durationName>hour</durationName>
          <count>5</count>
          <userBoost>true</userBoost>
      </jenkins.branch.RateLimitBranchProperty>
      

      After changing the value of count in DSL, the jenkins.branch.RateLimitBranchProperty shows the new, correct settings in config.xml.

      But when running the new builds, it uses the previous count as logged:

      Feb 08, 2022 11:20:40 AM FINER jenkins.branch.RateLimitBranchProperty
      test-job/test-branch has a rate limit of 5 builds per hour
      

      What is suspicious, is that the branch job's config.xml contains duplicated sections of <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl:

      ...
      <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
          <durationName>hour</durationName>
          <count>5</count>
          <userBoost>true</userBoost>
      </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
      <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
          <durationName>hour</durationName>
          <count>12</count>
          <userBoost>true</userBoost>
      </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
      ...
      

      I can see the previous and current settings in the branch job's config.xml, but when I start a new build again, this section duplicates again and still uses the older, incorrect count setting (maybe the first in order):

      ...
      <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
          <durationName>hour</durationName>
          <count>5</count>
          <userBoost>true</userBoost>
      </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
      <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
          <durationName>hour</durationName>
          <count>12</count>
          <userBoost>true</userBoost>
      </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
      <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
          <durationName>hour</durationName>
          <count>12</count>
          <userBoost>true</userBoost>
      </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
      ...
      

          [JENKINS-67754] Incorrect usage of rateLimit.count in multibranchPipelineJob

          Attila Drubits created issue -
          Attila Drubits made changes -
          Description Original: There is a multibranchPipelineJob DSL configured with rateLimit to throttle builds:

          {code}
          multibranchPipelineJob('testJob') {
          ...
              branchSources {
                  branchSource {
                      strategy {
                          allBranchesSame {
                              props {
                                  rateLimit {
                                      // The maximum number of builds allowed within the specified time period.
                                      count(5)
                                      // The time period within which the maximum number of builds will be enforced.
                                      durationName('hour')
                                      // Enable this option to permit user triggered builds to skip the rate limit.
                                      userBoost(true)
                                  }
                              }
                          }
                      }
                  }
              }
          ...
          }
          {code}

          The job's {{config.xml}} and also the branch jobs' {{config.xml}} shows the correct settings:

          {code:xml}
          <jenkins.branch.RateLimitBranchProperty>
              <durationName>hour</durationName>
              <count>5</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty>
          {code}

          After changing the value of count in DSL, the {{jenkins.branch.RateLimitBranchProperty}} shows the new, correct settings in {{config.xml}}s.

          But when running the new builds, it uses the previous count as logged:

          {code}
          Feb 08, 2022 11:20:40 AM FINER jenkins.branch.RateLimitBranchProperty
          test-job/test-branch has a rate limit of 5 builds per hour
          {code}

          What is suspicious, is that the branch job's {{config.xml}} contains duplicated sections of {{<jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl}}:
          {code:xml}
          ...
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>5</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl><jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>12</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          ...
          {code}

          I can see the previous and current settings in the branch job's {{config.xml}}, but when I start a new build again, this section duplicates again and still uses the older, incorrect count setting (maybe the first in order):
          {code:xml}
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>5</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl><jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>12</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>12</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          {code}
          New: There is a multibranchPipelineJob DSL configured with rateLimit to throttle builds:

          {code}
          multibranchPipelineJob('testJob') {
          ...
              branchSources {
                  branchSource {
                      strategy {
                          allBranchesSame {
                              props {
                                  rateLimit {
                                      // The maximum number of builds allowed within the specified time period.
                                      count(5)
                                      // The time period within which the maximum number of builds will be enforced.
                                      durationName('hour')
                                      // Enable this option to permit user triggered builds to skip the rate limit.
                                      userBoost(true)
                                  }
                              }
                          }
                      }
                  }
              }
          ...
          }
          {code}

          The job's {{config.xml}} and also the branch jobs' {{config.xml}} shows the correct settings:

          {code:xml}
          <jenkins.branch.RateLimitBranchProperty>
              <durationName>hour</durationName>
              <count>5</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty>
          {code}

          After changing the value of count in DSL, the {{jenkins.branch.RateLimitBranchProperty}} shows the new, correct settings in {{config.xml}}s.

          But when running the new builds, it uses the previous count as logged:

          {code}
          Feb 08, 2022 11:20:40 AM FINER jenkins.branch.RateLimitBranchProperty
          test-job/test-branch has a rate limit of 5 builds per hour
          {code}

          What is suspicious, is that the branch job's {{config.xml}} contains duplicated sections of {{<jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl}}:
          {code:xml}
          ...
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>5</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl><jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>12</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          ...
          {code}

          I can see the previous and current settings in the branch job's {{config.xml}}, but when I start a new build again, this section duplicates again and still uses the older, incorrect count setting (maybe the first in order):
          {code:xml}
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>5</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>12</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>12</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          {code}
          Attila Drubits made changes -
          Description Original: There is a multibranchPipelineJob DSL configured with rateLimit to throttle builds:

          {code}
          multibranchPipelineJob('testJob') {
          ...
              branchSources {
                  branchSource {
                      strategy {
                          allBranchesSame {
                              props {
                                  rateLimit {
                                      // The maximum number of builds allowed within the specified time period.
                                      count(5)
                                      // The time period within which the maximum number of builds will be enforced.
                                      durationName('hour')
                                      // Enable this option to permit user triggered builds to skip the rate limit.
                                      userBoost(true)
                                  }
                              }
                          }
                      }
                  }
              }
          ...
          }
          {code}

          The job's {{config.xml}} and also the branch jobs' {{config.xml}} shows the correct settings:

          {code:xml}
          <jenkins.branch.RateLimitBranchProperty>
              <durationName>hour</durationName>
              <count>5</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty>
          {code}

          After changing the value of count in DSL, the {{jenkins.branch.RateLimitBranchProperty}} shows the new, correct settings in {{config.xml}}s.

          But when running the new builds, it uses the previous count as logged:

          {code}
          Feb 08, 2022 11:20:40 AM FINER jenkins.branch.RateLimitBranchProperty
          test-job/test-branch has a rate limit of 5 builds per hour
          {code}

          What is suspicious, is that the branch job's {{config.xml}} contains duplicated sections of {{<jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl}}:
          {code:xml}
          ...
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>5</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl><jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>12</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          ...
          {code}

          I can see the previous and current settings in the branch job's {{config.xml}}, but when I start a new build again, this section duplicates again and still uses the older, incorrect count setting (maybe the first in order):
          {code:xml}
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>5</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>12</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>12</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          {code}
          New: There is a multibranchPipelineJob DSL configured with rateLimit to throttle builds:

          {code}
          multibranchPipelineJob('testJob') {
          ...
              branchSources {
                  branchSource {
                      strategy {
                          allBranchesSame {
                              props {
                                  rateLimit {
                                      // The maximum number of builds allowed within the specified time period.
                                      count(5)
                                      // The time period within which the maximum number of builds will be enforced.
                                      durationName('hour')
                                      // Enable this option to permit user triggered builds to skip the rate limit.
                                      userBoost(true)
                                  }
                              }
                          }
                      }
                  }
              }
          ...
          }
          {code}

          The job's {{config.xml}} and also the branch jobs' {{config.xml}} shows the correct settings:

          {code:xml}
          <jenkins.branch.RateLimitBranchProperty>
              <durationName>hour</durationName>
              <count>5</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty>
          {code}

          After changing the value of count in DSL, the {{jenkins.branch.RateLimitBranchProperty}} shows the new, correct settings in {{config.xml}}.

          But when running the new builds, it uses the previous count as logged:

          {code}
          Feb 08, 2022 11:20:40 AM FINER jenkins.branch.RateLimitBranchProperty
          test-job/test-branch has a rate limit of 5 builds per hour
          {code}

          What is suspicious, is that the branch job's {{config.xml}} contains duplicated sections of {{<jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl}}:
          {code:xml}
          ...
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>5</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>12</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          ...
          {code}

          I can see the previous and current settings in the branch job's {{config.xml}}, but when I start a new build again, this section duplicates again and still uses the older, incorrect count setting (maybe the first in order):
          {code:xml}
          ...
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>5</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>12</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          <jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl plugin="branch-api@2.7.0">
              <durationName>hour</durationName>
              <count>12</count>
              <userBoost>true</userBoost>
          </jenkins.branch.RateLimitBranchProperty_-JobPropertyImpl>
          ...
          {code}

            Unassigned Unassigned
            drubitsa Attila Drubits
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: