stronk7

Untitled

Feb 12th, 2021 (edited)
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.87 KB | None | 0 0
  1. // For all the jobs in the Summary view.
  2. hudson.model.Hudson.instance.getView('All - Summary').items.each() {
  3.   def build = it.getLastBuild()
  4.   // If they are failed and haven't any description.
  5.   if (build.result == Result.FAILURE && !build.description) {
  6.     println "Job: " + it.fullDisplayName
  7.     // Look for detected annotations
  8.     def BFA = build.actions.find{ it instanceof com.sonyericsson.jenkins.plugins.bfa.model.FailureCauseBuildAction };
  9.     if (BFA != null) {
  10.       // Join all the indications into string.
  11.       def indicationsList = BFA.getFoundFailureCauses().collect{ it.getName() }
  12.       def indications = indicationsList.join(' + ')
  13.       println("  Failure causes: " + indications)
  14.       // Failure causes found, set the description to them.
  15.       if (indications) {
  16.         build.description = indications
  17.         println "  Set!"
  18.       }
  19.     }
  20.   }
  21. }
Add Comment
Please, Sign In to add comment