Vololodymyr
Vololodymyr

Reputation: 2288

How to get stacktrace from Jenkins using WebService API?

Is there any way to get stacktrace from jenkins in case of build fail (for the specific job) ?

Even simple maven output will be ok.

Upvotes: 0

Views: 1075

Answers (2)

StyrianDev
StyrianDev

Reputation: 239

Don't know if it is relevant anymore, but it is possible. First you ahve to get the link to a single job which can be achieved by http://[jenkinjs_server]/job/[jobname]/lastCompletedBuild/testReport/api/xml. As a result you are going to get something that consists

<child>
<url>
https://ci.infonova.at/job/ProductCore/view/ALL/job/smoke-tests-gf-libs/com.infonova.product.jtf$end2end-tests/3/
</url>
</child>

Here you need to take that url and add /testReport/api/xml?tree=suites[cases[className,errorStackTrace]].

With that tree you can add a filter, so that you get only the errorStackTrace together with the class name.

Upvotes: 1

Aaron Digulla
Aaron Digulla

Reputation: 328614

No, since you won't get an exception for every kind of build failure.

I think the closest thing is getting the latest build console output which you can find under http://[jenkins_server]/job/[job-name]/lastBuild/console (replace the [...] parts with the actual values).

Upvotes: 1

Related Questions