From 45e5169e40b9049cb2c68e5da94ed8e7053525b8 Mon Sep 17 00:00:00 2001 From: Jacek Date: Mon, 4 Nov 2019 16:08:44 +0100 Subject: [PATCH] SONAR-12630 Add dashboard url to message exception in case QG fails --- .../org/sonar/scanner/analysis/AnalysisResultReporter.java | 2 +- .../java/org/sonar/scanner/qualitygate/QualityGateCheck.java | 4 +--- .../sonar/scanner/analysis/AnalysisResultReporterTest.java | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/AnalysisResultReporter.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/AnalysisResultReporter.java index 20c32d0b7c6..a4831961aa3 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/AnalysisResultReporter.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/AnalysisResultReporter.java @@ -47,8 +47,8 @@ public class AnalysisResultReporter { LOG.info("ANALYSIS SUCCESSFUL, you can browse {}", ceTaskReportDataHolder.getDashboardUrl()); if (!scanProperties.shouldWaitForQualityGate()) { LOG.info("Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report"); + LOG.info("More about the report processing at {}", ceTaskReportDataHolder.getCeTaskUrl()); } - LOG.info("More about the report processing at {}", ceTaskReportDataHolder.getCeTaskUrl()); } } } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/qualitygate/QualityGateCheck.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/qualitygate/QualityGateCheck.java index 52e330d1bf8..52c52bd2cb1 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/qualitygate/QualityGateCheck.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/qualitygate/QualityGateCheck.java @@ -96,9 +96,7 @@ public class QualityGateCheck implements Startable { if (Status.OK.equals(qualityGateStatus)) { LOG.info("Quality Gate - OK"); } else { - LOG.info("Quality Gate - FAILED, you can browse {}", ceTaskReportDataHolder.getDashboardUrl()); - LOG.info("More about the report processing at {}", ceTaskReportDataHolder.getCeTaskUrl()); - throw MessageException.of("Quality Gate - FAILED"); + throw MessageException.of("Quality Gate - FAILED, you can browse " + ceTaskReportDataHolder.getDashboardUrl()); } } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/AnalysisResultReporterTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/AnalysisResultReporterTest.java index f5c9d89b60e..97aa3208906 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/AnalysisResultReporterTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/AnalysisResultReporterTest.java @@ -78,8 +78,6 @@ public class AnalysisResultReporterTest { underTest.report(); assertThat(logTester.logs(LoggerLevel.INFO)) - .containsExactly( - "ANALYSIS SUCCESSFUL, you can browse " + dashboardUrl, - "More about the report processing at " + ceTaskUrl); + .containsExactly("ANALYSIS SUCCESSFUL, you can browse " + dashboardUrl); } } -- 2.39.5