我问了这个问题how do i get the latest build in jenkns with a specified parameter,解决方案是
http://localhost:8080/job/MyJenkinsJob/api/xml?tree=builds[actions[parameters[value]],number]&xpath=//build[action[parameter[value="MyParameterValue"]]]/number&wrapper=list
然而,这将返回多个构建号,但我只想要最新的(仅一个构建号)
<list><number>49</number><number>48</number></list>
我尝试使用xpath进行了多次修改,但它没有工作
答案 0 :(得分:0)
XPath: Select first element with a specific attribute有帮助吗?
所以:
http://localhost:8080/job/MyJenkinsJob/api/xml?tree=builds[actions[parameters[value]],number]&xpath=(//build[action[parameter[value="MyParameterValue"]]])[0]/number&wrapper=list
或者括号可能在其他地方