Request the last successful build number in Jenkins with a change

Example:

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

I want the query to return 30


So far I have received:

To request the latest stable build number:

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

This returns 31 . Not quite what I need.

To check if this assembly has changes, the only way I know:

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

Then I need to go inside the huge JSON and check if any element is found in the changeSet> file.


Is there an easier way to request the latest stable build with changes (30)?

+5
source share
1 answer

Jenkins Remote Access API using:

 http://jenkins/job/<your job>/<build no>/api/xml 

also supports XPath:

XPath choice

The XML API supports XPath selection using the "xpath" query parameter. This is useful for retrieving information in environments where XML processing is tedious (such as a shell script.) See Question # 626 for an example of how to use this.
See .... / api / on your Jenkins server for more up to date information.

+3
source

Source: https://habr.com/ru/post/1234404/


All Articles