curl -d 'script=println Jenkins.instance.getItem(jobName).builds.each{
println "${it.number}:${it.startTimeInMillis}:${it.duration}:${it.result}"
};' http://localhost:8080/scriptText
On Wednesday, July 3, 2013 6:55:17 AM UTC-5, Dirk Heinrichs wrote:
>
> Hi,
>
>
>
> I’ve got a small Groovy script to get some data for all builds of a given
> project:
>
>
>
> *import* hudson.model.*
>
>
>
> *def* jobName = args[0]
>
>
>
> *def* job = Hudson.instance.getItem(jobName)
>
> *def* builds = job.getBuilds()
>
> builds.each
>
> {
>
> println (it.getNumber()+":"+it.getStartTimeInMillis()+":"+it
> .getDuration()+":"+it.getResult().toString())
>
> }
>
>
>
> This one works as expected. However, I only call this script from within a
> Perl script because I can’t get all the data using either XML or JSON api,
> which only gives me the data for the last N builds instead of all builds,
> using an URL like ‘http://server/job/MyJob/api/xml?tree=builds[number,url]’.
> How do I get the data for ALL builds using either JSON or XML?
>
>
>
> Possible workaround: use ‘?tree=firstBuild[number],lastBuild[number]’ and
> construct the URL for each build myself.
>
>
>
> Thanks...
>
>
>
> Dirk
>
>
>
> [image: cid:[email protected]]
>
> *Dirk Heinrichs*, Senior Systems Engineer, Infrastructure
>
> Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
>
> *Tel:* +49 2226 1596666 1149
>
> *Email:* [email protected] <javascript:>
>
> *Skype:* dirk.heinrichs.recommind
>
> *www.recommind.com* <http://www.recommind.com/>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.