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

Remote access API job builds list limit shouldn't be hardcoded

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Won't Fix
    • Component/s: core
    • Labels:
    • Environment:
      Operating System: Fedora 30 64bit
      JDK: openjdk 8
      Jenkins verrsion: 2.200, from official docker hub container image
    • Similar Issues:

      Description

      When using the Remote Access API to get the list of builds in a job, for example - like this:

      curl https://${AUTH}@jenkins/job/myjob/api/json -G --data-urlencode 'tree=builds[number]'

      only the last 100 jobs are returned. This seem to be hard coded in the Job model (saw it here: https://github.com/jenkinsci/jenkins/blob/11c1146d0dc30e948ade8d1636ae01345c294291/core/src/main/java/hudson/model/Job.java#L737 )

      There should be a way to override this and get at the older builds - by paging, setting the limit, etc.

      The only workaround seem to be to check if a build exists by guessing its number (shouldn't be hard as they're sequential) and query each and every build URL directly. If a job has a few thousand builds, this gets really old really fast.

        Attachments

          Activity

          Hide
          danielbeck Daniel Beck added a comment -

          that's what allBuilds is for, documented in the section titled "Retrieving all builds".

          Pagination  (well, slicing) exists as documented in the section titled "Controlling the amount of data you fetch"

          Show
          danielbeck Daniel Beck added a comment - that's what allBuilds is for, documented in the section titled "Retrieving all builds". Pagination  (well, slicing) exists as documented in the section titled "Controlling the amount of data you fetch"
          Hide
          guss77 Oded Arbel added a comment -

          `allBuilds` solved the problem for me. I'm not sure how I missed it, but thank you very much for pointing it out.

          Show
          guss77 Oded Arbel added a comment - `allBuilds` solved the problem for me. I'm not sure how I missed it, but thank you very much for pointing it out.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            guss77 Oded Arbel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: