Skip to content

Instantly share code, notes, and snippets.

@kohsuke
Created April 14, 2018 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kohsuke/19bb7ee6198970bd45876077cc356182 to your computer and use it in GitHub Desktop.
Save kohsuke/19bb7ee6198970bd45876077cc356182 to your computer and use it in GitHub Desktop.
import java.util.concurrent.TimeUnit;
def c = 0;
def w = TimeUnit.DAYS.toMillis(3)
def threshold = new Date().time - w
Jenkins.instance.getAllItems(Job.class).each { j ->
for (b=j.lastBuild; b!=null; b=b.previousBuild) {
if (b.timeInMillis<threshold) break;
c += b.duration;
// println "${j.displayName} ${b.displayName}";
}
}
println c/w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment