Getting the build description from a URL

204 views
Skip to first unread message

grayaii

unread,
Jan 19, 2012, 11:41:35 AM1/19/12
to jenkins...@googlegroups.com
I'm trying to get the build description of the lastSuccessfulBuild.

This usually works:
http://localhost:8080/jenkins/view/All/job/MyJob/lastSuccessfulBuild/api/xml?xpath=*/description/text()

The problem is that people sometimes put html tags in their descriptions.
For instance:
9.0.0.10027 <BR> Uploaded to Gold Master Server

When that happens, the xpath fails with the message:
XPath "*/description/text()" matched 5 nodes. Create XPath that only matches
one, or use the "wrapper" query parameter to wrap them all under a root
element.

I use the "wrapper query parameter" to return raw xml, but then I have to
parse it out, and parsing it out is getting more tricky than it should.

Is there an easy way to get the *description* of the lastSuccessfulBuild
from a URL?

Thanks!


--
View this message in context: http://jenkins.361315.n4.nabble.com/Getting-the-build-description-from-a-URL-tp4310567p4310567.html
Sent from the Jenkins users mailing list archive at Nabble.com.

graya2

unread,
Sep 5, 2017, 1:35:18 PM9/5/17
to jenkins...@googlegroups.com
LOL. I ran across my own post from 5 years ago. I can answer it myself now:

from jenkinsapi.jenkins import Jenkins
import jenkinsapi
J = Jenkins('http://myjenkins:8080/', username='user', password='password')
job = J['my-job']
b = job.get_build(383)
b.get_description()



--
Sent from: http://jenkins-ci.361315.n4.nabble.com/Jenkins-users-f361316.html
Reply all
Reply to author
Forward
0 new messages