Created
April 3, 2014 23:02
-
-
Save cyrille-leclerc/9964594 to your computer and use it in GitHub Desktop.
Jenkins Builds Duration over the last month
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def summarize(t) { | |
def minutes = 0; | |
def now = System.currentTimeMillis(); | |
def month = 30L*24*60*60*1000; | |
t.items.each { job -> | |
if (job instanceof Job) { | |
def b = job.lastBuild; | |
while (b!=null && (now-b.timeInMillis<month)) { | |
minutes += b.duration; | |
b = b.previousBuild; | |
} | |
} else | |
if (job instanceof ItemGroup) { | |
minutes += summarize(job); | |
} | |
} | |
return minutes; | |
} | |
println (summarize(Jenkins.instance) / (60*1000)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment