Created
March 13, 2018 06:51
-
-
Save ansig/7b49cab240bfaa06c83577852c734196 to your computer and use it in GitHub Desktop.
List failing branches of failing builds in a Jenkins Pipeline
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
jobs = Jenkins.instance.allItems(hudson.model.Job).findAll { it.fullName == ("<JOBNAME>") } | |
jobs.each { job -> | |
job.builds.findAll { !it.building }.each { build -> | |
finished = new Date(build.timestamp.timeInMillis + build.duration) | |
println "${build} - ${build.result} (${finished})" | |
action = build.getAction(org.jenkinsci.plugins.workflow.job.views.FlowGraphAction) | |
action.getNodes().findAll { it.displayName.startsWith("") }.each { | |
if (it.displayName.startsWith("Building") && it.getError() != null) { | |
println "\t${it.displayName}" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment