Skip to content

Commit

Permalink
Merge pull request #176 from jenkinsci/JENKINS-54559
Browse files Browse the repository at this point in the history
JENKINS-54559 Build result regression since pipeline-maven 3.5.15 for failing tests (UNSTABLE)
  • Loading branch information
Cyrille Le Clerc authored Nov 11, 2018
2 parents f8060e2 + c355a75 commit 2f4ab4a
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,23 @@ private void executeReporter(StepContext context, TaskListener listener, List<El

TestResultAction testResultAction = JUnitResultArchiver.parseAndAttach(archiver, pipelineTestDetails, run, workspace, launcher, listener);

if (testResultAction != null && testResultAction.getResult().getFailCount() > 0) {
context.setResult(Result.UNSTABLE);
if (testResultAction == null) {
// no unit test results found
if (LOGGER.isLoggable(Level.FINE)) {
listener.getLogger().println("[withMaven] junitPublisher - no unit test results found, ignore");
}
} else if (testResultAction.getResult().getFailCount() == 0) {
// unit tests are all successful
if (LOGGER.isLoggable(Level.FINE)) {
listener.getLogger().println("[withMaven] junitPublisher - unit tests are all successful");
}
} else {
if (LOGGER.isLoggable(Level.FINE)) {
listener.getLogger().println("[withMaven] junitPublisher - " + testResultAction.getResult().getFailCount() + " unit test failure(s) found, mark job as unstable");
}
// TODO: Once JENKINS-43995 lands, update this to set the step status instead of the entire build.
// context.setResult(Result.UNSTABLE);
run.setResult(Result.UNSTABLE);
}
} catch (Exception e) {
listener.error("[withMaven] junitPublisher - Silently ignore exception archiving JUnit results for Maven artifact " + mavenArtifact.toString() + " generated by " + pluginInvocation + ": " + e);
Expand Down

0 comments on commit 2f4ab4a

Please sign in to comment.