Hi Eric, I recommend you to use another approach via Groovy API then you can run your script easily via your jenkins script console url: /script (https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console)
Important javadoc references: - http://javadoc.jenkins-ci.org/hudson/model/Job.html - http://javadoc.jenkins-ci.org/hudson/model/Run.html Your script might be something like import jenkins.model.* println "JOB_NAME,BUILD_ID,DURATION(ms),DATE" Jenkins.instance?.items.each { job -> if ( job.getLastBuild() != null ) { println "${job.name},${job.getLastBuild().getNumber()},${job.getLastBuild().getDuration()},${job.getLastBuild().getTime()}" } else { println "${job.name},na,na,na" } } println "done" I hope it helps Cheers On Wednesday, 30 September 2015 22:42:29 UTC+2, benjamin.a.lau wrote: > > This formula isn't perfect but it'll convert a jenkins duration into a > human readable time[1]. > =IF(INT(1/86400000*A3)=0, "",INT(1/86400000*A3) &" day, ") & > IF(INT(MOD(A3,86400000)/3600000)=0,"", INT(MOD(A3,86400000)/3600000) & > " hr, ") & IF(INT(MOD(A3,3600000)/60000)=0,"", > INT(MOD(A3,3600000)/60000) &" min, ") & > IF(INT(MOD(A3,60000)/1000)=0,"", INT(MOD(A3,60000)/1000) &" sec") > > This might need some formatting improvements... and maybe some > additional logic for whether to show different fields. But it's > probably a good starting point. > > Cheers, > Ben > [1] Adapted from this post I found: > > http://www.mrexcel.com/forum/excel-questions/73152-converting-seconds-hours-minutes-seconds.html#post351958 > > and then adjusted to work from miliseconds instead of seconds and to > allow for conditional display of the fields (eg if there are no > hours... the field isn't shown) > > On Wed, Sep 30, 2015 at 12:35 PM, Eric Naitove <[email protected] > <javascript:>> wrote: > > Using something like > > > > /api/xml?tree=jobs[name,url]&pretty=true OR > > > /api/xml?tree=jobs[name,builds[number,actions[parameters[name,value]]]]&pretty=true > > > > ETC. > > > > Can I get an out put of jobs with lastBuild duration in HOURS/MINUTES > > > > I can convert in Excel BUT it doesn't match with Jenkins > > > > AND management being management..... :) > > > > > > On Wednesday, September 30, 2015 at 2:02:47 PM UTC-4, Eric Naitove > wrote: > >> > >> I at some time via Groovy or the API obtained a list of all my jabos > and > >> the run tines as follows > >> > >> GwInt202DeployTomcatCc 8 min 54 sec - #1352 > >> > >> It was a large list that I cleaned up grabbing the last build (meaning > the > >> entry above had several hundred lines. I kept the last one in an Excel > >> spreadsheet) > >> > >> Any help would be appreciated > > > > -- > > 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] <javascript:>. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/jenkinsci-users/309d1ec5-7b5b-47a7-bc9e-c133fae7916d%40googlegroups.com. > > > > > > For more options, visit https://groups.google.com/d/optout. > -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/228e7056-0871-4fb0-8428-2dbbab5f81b3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
