Skip to content

Instantly share code, notes, and snippets.

@aetos382
Last active November 16, 2020 23:30
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 aetos382/9739e1ccd826f362fc05d5ce6dfc877f to your computer and use it in GitHub Desktop.
Save aetos382/9739e1ccd826f362fc05d5ce6dfc877f to your computer and use it in GitHub Desktop.
Jenkins.get().allItems.findAll {
it instanceof hudson.model.Job<?, ?>
}.each {
def build = it.lastBuild
while (true) {
if (build == null) { break }
if (build.timestamp.get(Calendar.MONTH) <= Calendar.MARCH) { break }
build = build.previousBuild
}
def duration = 0;
while (true) {
if (build == null) { break }
if (build.timestamp.get(Calendar.MONTH) <= Calendar.FEBRUARY) { break }
duration += build.duration
build = build.previousBuild
}
println(new Tuple(it.fullName, duration))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment