查询Jenkins中最后一次成功的内部版本号并进行更改 [英] Query for last successful build number in Jenkins with change

查看:159
本文介绍了查询Jenkins中最后一次成功的内部版本号并进行更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例:

32 - fail
31 - stable no change (triggered by parent)
30 - stable with changes
29 - fail 
...

我希望查询返回30

到目前为止,我得到了什么:

So far what I got:

要查询最后一个稳定的内部版本号:

http://jenkins/job/project_name/lastStableBuild/buildNumber

http://jenkins/job/project_name/lastStableBuild/buildNumber

这将返回31.并不是我所需要的.

This returns 31. Not exactly what I need.

要检查此版本是否有更改,我知道的唯一方法是:

http://jenkins/job/project_name/31/api/json

然后,我需要进入巨大的JSON并检查changeSet>项目中是否有任何项目.

Then I need to go inside the huge JSON and check if any item in changeSet > items.

有没有更简单的方法来查询具有更改的最新稳定版本(30)?

Is there a easier way to query for the latest stable build with changes (30) ?

推荐答案

Jenkins的也支持XPath:

XPath选择

XML API支持使用查询参数'xpath'通过XPath进行选择.这对于在XML操作繁琐的环境(例如shell脚本)中提取信息非常方便.请参见问题#626 有关如何使用它的示例.
有关更多最新信息,请参见Jenkins服务器上的.../api/.

XPath selection

The XML API supports a selection by XPath by using the query parameter 'xpath'. This is convenient for extracting information in environments where XML manipulation is tedious (such as shell script.) See issue #626 for an example of how to use this.
See .../api/ on your Jenkins server for more up-to-date details.

这篇关于查询Jenkins中最后一次成功的内部版本号并进行更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆