• Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • core
    • None

      The fix for JENKINS-15583 restricted the number of recent builds returned by the JSON API to 100:
      http://jenkins-ci.org/commit/jenkins/fe9f676028773df181f0b9ec823b3cdd08d5cf3d

      In that commit, it was mentioned that a pagination API should be added to allow retrieval of more results.
      As far as I can see, this hasn't yet been added. It would be a useful addition to the API, as we would like to be able to retrieve all builds.

      JENKINS-21600 seems possibly related?

          [JENKINS-22977] Add results paging to the Jenkins API

          Daniel Beck added a comment -

          Just query for allBuilds explicitly (xpath/tree argument). Due to the cost of build loading, it's hidden by default from the output.

          https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Job.java#L642

          Daniel Beck added a comment - Just query for allBuilds explicitly (xpath/tree argument). Due to the cost of build loading, it's hidden by default from the output. https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Job.java#L642

          I think this is a more general issue, not related to just build info, that should be implemented.

          I discussed this "allBuilds" endpoint with my colleague who is building front-end apps with the Jenkins API and, while it does work, they still maintained it would be useful to have paging with limit/offset parameters.

          Mainly because loading all builds takes a long time, but also because semantically it doesn't make sense that you must switch from "builds" to "allBuilds" just to retrieve a larger result set.

          Christopher Orr added a comment - I think this is a more general issue, not related to just build info, that should be implemented. I discussed this "allBuilds" endpoint with my colleague who is building front-end apps with the Jenkins API and, while it does work, they still maintained it would be useful to have paging with limit/offset parameters. Mainly because loading all builds takes a long time, but also because semantically it doesn't make sense that you must switch from "builds" to "allBuilds" just to retrieve a larger result set.

          Daniel Beck added a comment -

          semantically it doesn't make sense that you must switch from "builds" to "allBuilds" just to retrieve a larger result set.

          Returning all builds used to be essentially free. As of 1.485, it's insanely expensive. What would be a better solution, breaking backwards compatibility? There's a lot of things weird in Jenkins, but caused by the desire to remain backward compatible.


          Pagination API already exists, it's called XPath.

          https://builds.apache.org/job/PDFBox-ant/api/xml?tree=allBuilds[number]&xpath=//allBuild[position%28%29%3C=10]&wrapper=builds
          https://builds.apache.org/job/PDFBox-ant/api/xml?tree=allBuilds[number]&xpath=//allBuild[position%28%29%3E10%20and%20position%28%29%3C=20]&wrapper=builds

          Daniel Beck added a comment - semantically it doesn't make sense that you must switch from "builds" to "allBuilds" just to retrieve a larger result set. Returning all builds used to be essentially free. As of 1.485, it's insanely expensive. What would be a better solution, breaking backwards compatibility? There's a lot of things weird in Jenkins, but caused by the desire to remain backward compatible. Pagination API already exists, it's called XPath. https://builds.apache.org/job/PDFBox-ant/api/xml?tree=allBuilds[number]&xpath=//allBuild[position%28%29%3C=10]&wrapper=builds https://builds.apache.org/job/PDFBox-ant/api/xml?tree=allBuilds[number]&xpath=//allBuild[position%28%29%3E10%20and%20position%28%29%3C=20]&wrapper=builds

          Jesse Glick added a comment -

          Pagination API already exists, it's called XPath.

          Not really viable, since it requires the server to precompute all the data, then throw most of it away. JENKINS-23228 is more what we had in mind.

          Jesse Glick added a comment - Pagination API already exists, it's called XPath. Not really viable, since it requires the server to precompute all the data, then throw most of it away. JENKINS-23228 is more what we had in mind.

            Unassigned Unassigned
            orrc Christopher Orr
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: