I am using Jenkins xml api with tree. Here is the url I am using for my locally hosted Jenkins server.
http://localhost:8080/api/xml?
tree=jobs[name,description,color,healthReport[score,description]]
The above url shows me xml output as:
<hudson>
<job>
<description/>
<name>build1</name>
<color>disabled</color>
<healthReport>
<description>Build stability: 2 out of the last 5 builds failed.</description>
<score>60</score>
</healthReport>
</job>
<job>
<description>test job description check.</description>
<name>Build2</name>
<color>blue</color>
<healthReport>
<description>Build stability: No recent builds failed.</description>
<score>100</score>
</healthReport>
</job>
<job>
<description/>
<name>Build3</name>
<color>blue</color>
<healthReport>
<description>Build stability: 3 out of the last 4 builds failed.</description>
<score>25</score>
</healthReport>
</job>
</hudson>
Now I would like to parse the xml output in such a way that further I can process the tag values.
ex:
foreach job
if color=blue
print jobname : color
if score = 100
etc
How could I do this in perl, which perl module should I use?
Start with:
foreach job
if color=blu
print jobname : color
if score = 100