且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从Jenkins REST API获取所有作业的所有构建的构建详细信息

更新时间:2023-12-04 08:45:40

以防万一,其他任何人都陷入困境,我可以使用树来完成此任务:

In case, anyone else is stuck with the same, I was able to get this done using the tree:

https://<JENKINS_HOST>/api/json?tree=jobs[name,url,builds[number,result,duration,url]]

这里,可以对列名进行过滤以仅获取所需的数据,因为从中返回的数据量很大.

Here, column names can be filtered to fetch only the data you need as the amount of data returned from this is huge.

您还可以像这样限制要获取的记录数:

You can also limit the number of records to be fetched like this:

https://<JENKINS_HOST>/api/json?tree=jobs[name,url,builds[number,result,duration,url]{0,50}]

这将仅获取所有工作的最后50个版本,这正是我所需要的.

This will fetch only the last 50 builds for all the jobs, which is exactly what I needed.