-
Improvement
-
Resolution: Won't Fix
-
Minor
-
Operating System: Fedora 30 64bit
JDK: openjdk 8
Jenkins verrsion: 2.200, from official docker hub container image
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.
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"