My goal is to get the latest Jenkins job (jobname hanna) with a specific parameter.
The only reason why I'm doing this is Jenkins do not return a build number when I trigger from my script, so I have to pass in a parameter, but I have to be able to query against that parameter later.
Rigth now I have this, which doesn't return the build ID:
curl -X POST 'http://server:8080/api/xml?tree=jobs[name,builds[actions[parameters[name,value]]]]&xpath=/hudson/job[build/action/parameter[name="snapshot"][value="bb"]]&pretty=true'
and I get a list of jobs like this:
<job><name>hanna</name><build><action><parameter><name>snapshot</name><value>bb</value></parameter></action><action/><action/><action/><action/></build><build><action><parameter><name>snapshot</name><value>bb</value></parameter></action><action/><action/><action/><action/></build><build><action><parameter><name>snapshot</name><value>aa</value></parameter></action><action/><action/><action/><action/><action/></build><build><action/><action/><action/><action/></build></job>⏎
which is not exactly what I want, because I want the latest instance of the job hanna with parameter snapshot=bb
, this return snap=aa
as well, and also I cannot figure out where the build ID is stored on Jenkins. Can someone tell me?