Skip to content

Instantly share code, notes, and snippets.

@x-cray
Created April 11, 2012 12:23
Show Gist options
  • Save x-cray/2359021 to your computer and use it in GitHub Desktop.
Save x-cray/2359021 to your computer and use it in GitHub Desktop.
Display high-priority warnings from the Jenkins Warnings Plugin on the build summary page
if (manager.build.result == hudson.model.Result.FAILURE) {
warningsResultActions = manager.build.actions.findAll { it.class.simpleName == "WarningsResultAction" }
if (warningsResultActions.size() > 0) {
summary = null
warningsResultActions.each {
newWarnings = it.result.newWarnings
if (newWarnings.size() > 0) {
if (!summary) {
summary = manager.createSummary("error.gif")
summary.appendText("<p><b>Build errors:</b></p><ul>", false)
}
newWarnings.each {
if (it.priority.toString() == "HIGH") {
summary.appendText("<li>In <b>${it.fileName}</b> at line ${it.primaryLineNumber}: ${it.message}</li>", false, false, false, "#A33")
}
}
}
}
if (summary)
summary.appendText("</ul>", false)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment