Created
April 11, 2012 12:23
-
-
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
This file contains hidden or 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
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