hudson - What URL will get the status code (result) of the last Jenkins job? -


i wondering if knows url required (as or post) status code (result) of last jenkins job (when build# not known client calling request)? want able detect if result red or green/blue .

i have code sample, need adjust works jenkins, purpose (as stated above):

public class main {     public static void main(string[] args) throws exception {         url url = new url("http://localhost/jenkins/api/xml");         document dom = new saxreader().read(url);         for( element job : (list<element>)dom.getrootelement().elements("job")) {             system.out.println(string.format("name:%s\tstatus:%s",                 job.elementtext("name"), job.elementtext("color")));         }     } } 

once figure out answer, share full example of how used it. want create job collects information on test suite of 20+ jobs , reports on of them email.

you can use symbolic descriptor lastbuild:

http://localhost/jenkins/job/<jobname>/lastbuild/api/xml 

the result element contains string describing outcome of build.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -