From 81a898084f609739dd2dacd5af01e35c4954483d Mon Sep 17 00:00:00 2001 From: michaelbirnstiehl Date: Tue, 16 Mar 2021 14:57:05 -0500 Subject: [PATCH] SONAR-14596 Add sonar.qualitygate.wait to CI integration Overview page --- .../sonar-docs/src/pages/analysis/analysis-parameters.md | 6 ++++++ .../src/pages/analysis/branch-pr-analysis-overview.md | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/server/sonar-docs/src/pages/analysis/analysis-parameters.md b/server/sonar-docs/src/pages/analysis/analysis-parameters.md index d7c2207297c..8366802bc9d 100644 --- a/server/sonar-docs/src/pages/analysis/analysis-parameters.md +++ b/server/sonar-docs/src/pages/analysis/analysis-parameters.md @@ -91,6 +91,12 @@ Key | Description | Default `sonar.scanner.dumpToFile` | Outputs to the specified file the full list of properties passed to the scanner API as a means to debug analysis. | `sonar.scanner.metadataFilePath` | Set the location where the scanner writes the `report-task.txt` file containing among other things the `ceTaskId`. | value of `sonar.working.directory` +### Quality Gate +Key | Description | Default +---|----|--- +`sonar.qualitygate.wait` | Forces the analysis step to poll the SonarQube instance and wait for the Quality Gate status. If there are no other options, you can use this to fail a pipeline build when the Quality Gate is failing. See the [CI Integration](/analysis/branch-pr-analysis-overview/) page for more information. | +`sonar.qualitygate.timeout` | Sets the amount of time (in seconds) that the scanner should wait for a report to be processed. | 300 + ### Deprecated [[danger]] | These parameters are listed for completeness, but are deprecated and should not be used in new analyses. diff --git a/server/sonar-docs/src/pages/analysis/branch-pr-analysis-overview.md b/server/sonar-docs/src/pages/analysis/branch-pr-analysis-overview.md index 942d4416b01..fb4164179cf 100644 --- a/server/sonar-docs/src/pages/analysis/branch-pr-analysis-overview.md +++ b/server/sonar-docs/src/pages/analysis/branch-pr-analysis-overview.md @@ -10,6 +10,13 @@ SonarScanners running in GitLab CI/CD, Azure Pipelines, Cirrus CI, and Jenkins w [[warning]] | Automatic configuration is disabled if any branch or pull request properties have been set manually. +## Failing a pipeline job when the Quality Gate fails +If you're using Jenkins or Azure Pipelines, there are specific ways to fail the pipeline when your Quality Gate is failing for your CI tool. For more information, see the corresponding section below. + +For other CIs, you can use the `sonar.qualitygate.wait=true` analysis parameter in your configuration file. Using the `sonar.qualitygate.wait` parameter forces the analysis step to poll the SonarQube instance and wait for the Quality Gate status. This increases the pipeline duration and causes the analysis step to fail any time the Quality Gate is failing, even if the actual analysis is successful. You should only use this parameter if it's necessary. + +You can set the `sonar.qualitygate.timeout` property to an amount of time (in seconds) that the scanner should wait for a report to be processed. The default is 300 seconds. + ## GitLab CI/CD For GitLab CI/CD configuration, see the [GitLab ALM integration](/analysis/gitlab-integration/) page. -- 2.39.5