Treat missing files as a warning

This commit is contained in:
Šesták Vít
2016-05-06 17:27:47 +02:00
parent 2291ded9bc
commit 42d4dc365d
3 changed files with 2 additions and 10 deletions

View File

@@ -130,10 +130,11 @@ final class BambooDownloader @Inject()(@Named("bamboo-server-url") val server: S
}
resultsFuture.map{ originalResults =>
val buildFailureFilteredResults = originalResults.map{case (name, resultTry) =>
name -> resultTry.flatMap{ case result @ (build, _, _) =>
name -> resultTry.flatMap{ case result @ (build, reportFiles, _) =>
// Note that this is triggered only if the artifact directory exists.
// If it does not, it will throw “java.util.NoSuchElementException: key not found: Report results-XML” instead.
if (build.state != "Successful" || build.buildState != "Successful") Failure(new RuntimeException("failed build"))
else if (reportFiles.flatFiles.isEmpty) Failure(new RuntimeException("no output files"))
else Success(result)
}
}

View File

@@ -75,10 +75,6 @@ final class DependencyCheckReportsProcessor @Inject() (
val unknownIdentifierTypes = allDependencies.flatMap(_._1.identifiers.map(_.identifierType)).toSet -- Set("maven", "cpe")
val extraWarnings = Seq[Option[Warning]](
if(unknownIdentifierTypes.size > 0) Some(IdentifiedWarning("unknown-identifier-types", views.html.warnings.unknownIdentifierType(unknownIdentifierTypes), WarningSeverity.Info)) else None,
{
val emptyResults = successfulResults.filter{case (k, (_, dir, _)) => dir.flatFiles.size < 1}
if(emptyResults.nonEmpty) Some(IdentifiedWarning("empty-results", views.html.warnings.emptyResults(emptyResults.values.map{case (build, _, _) => build}.toSeq, server), WarningSeverity.Warning)) else None
},
{
val resultsWithErrorMessages = successfulResults.filter{case (k, (_, _, log)) => log.dataString.lines.exists(l => (l.toLowerCase startsWith "error") || (l.toLowerCase contains "[error]"))}
if(resultsWithErrorMessages.nonEmpty) Some(IdentifiedWarning("results-with-error-messages", views.html.warnings.resultsWithErrorMessages(resultsWithErrorMessages.values.map{case (build, _, _) => build}.toSeq, server), WarningSeverity.Error)) else None

View File

@@ -1,5 +0,0 @@
@(emptyReports: Seq[Build], urlBase: String)
<strong>Following projects have produced no results:</strong>
@for(build <- emptyReports.toSeq.sortBy(_.projectName)){
<li>@secureLink(build.resultLink(urlBase)){@build.projectName}</li>
}