XML路径从Jenkins REST API获得构建结果



当我访问 http://jenkins-url/job/argus_deploy_service/27/api/xml/?xpath=/freeStyleBuild/result时,我得到 <result>SUCCESS</result>

有什么方法可以直接获得SUCCESS?我尝试过xpath=/freeStyleBuild/result/textxpath=/freeStyleBuild/result/value,但没有运气。

text()函数在Jenkins中通过版本1.5.x的安全原因禁用。您可以使用sed获取内容:

curl http://jenkins-url/job/argus_deploy_service/27/api/xml/?xpath=/freeStyleBuild/result | sed -r 's/<[^>]+>//g'

您是否尝试过text()

xpath=/freeStyleBuild/result/text()

最新更新