Browse Source

SONAR-14818 Document use of Pipes for Bitbucket Pipes

tags/9.0.0.45539
michaelbirnstiehl 3 years ago
parent
commit
3b1e2236ac

+ 1
- 1
server/sonar-docs/src/pages/analysis/analysis-parameters.md View File

@@ -97,7 +97,7 @@ Key | Description | Default
### 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.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/ci-integration-overview/) page for more information. |
`sonar.qualitygate.timeout` | Sets the number of seconds that the scanner should wait for a report to be processed. | 300

### Deprecated

+ 38
- 34
server/sonar-docs/src/pages/analysis/bitbucket-cloud-integration.md View File

@@ -166,48 +166,52 @@ Click the scanner you're using below to expand the example configuration:
[[collapse]]
| ## SonarScanner CLI
|
| **Note:** A project key has to be provided through a `sonar-project.properties` file, or through the command line parameter. For more information, see the [SonarScanner](/analysis/scan/sonarscanner/) documentation.
| You can set up the SonarScanner CLI configuration the following ways:
|
| Write the following in your `bitbucket-pipelines.yml`:
| - **SonarQube Scan Bitbucket Pipe** – Using the SonarQube Scan Bitbucket Pipe is an easy way to set up a basic configuration. You'll find the Bitbucket Pipe and configuration instructions on the [SonarQube Scan Bitbucket Pipe](https://bitbucket.org/sonarsource/sonarqube-scan/) page.
|
| ```
| clone:
| depth: full
| - **Advanced Configuration** – If you need an advanced setup that allows for scanner caching, you can add the following to your `bitbucket-pipelines.yml` file:
|
| pipelines:
| branches:
| '{master,develop}':
| - step:
| name: SonarQube analysis
| image: sonarsource/sonar-scanner-cli:latest
| caches:
| - sonar
| script:
| - sonar-scanner
| [[info]]
| | This configuration is an alternative to the SonarQube Scan Bitbucket Pipe. If you do not need a setup that allows for scanner caching, we recommend using the Bitbucket Pipe.
|
| pull-requests:
| '**':
| - step:
| name: SonarQube analysis
| image: sonarsource/sonar-scanner-cli:latest
| caches:
| - sonar
| script:
| - sonar-scanner
| ```
| clone:
| depth: full
|
| definitions:
| caches:
| sonar: /opt/sonar-scanner/.sonar
| ```
| pipelines:
| branches:
| '{master,develop}':
| - step:
| name: SonarQube analysis
| image: sonarsource/sonar-scanner-cli:latest
| caches:
| - sonar
| script:
| - sonar-scanner
|
| pull-requests:
| '**':
| - step:
| name: SonarQube analysis
| image: sonarsource/sonar-scanner-cli:latest
| caches:
| - sonar
| script:
| - sonar-scanner
|
| definitions:
| caches:
| sonar: /opt/sonar-scanner/.sonar
| ```
|
| [[info]]
| | A project key has to be provided through a `sonar-project.properties` file, or through the command line parameter. For more information, see the [SonarScanner](/analysis/scan/sonarscanner/) documentation.

#### **Failing the pipeline job when the Quality Gate fails**
In order for the Quality Gate to fail the pipeline when it is red on the SonarQube side, the scanner needs to wait for the SonarQube Quality Gate status. To enable this, pass the `-Dsonar.qualitygate.wait=true` parameter to the scanner in the `bitbucket-pipelines.yml` file.

Example:
You can use the [SonarQube Quality Gate Check Bitbucket Pipe](https://bitbucket.org/sonarsource/sonarqube-quality-gate) to ensure your code meets your quality standards by failing your pipeline job when your [Quality Gate](/user-guide/quality-gates/) fails.

```
mvn verify sonar:sonar -Dsonar.qualitygate.wait=true
```
If you do not want to use the SonarQube Quality Gate Check Pipe, you can instruct the scanner to wait for the SonarQube Quality Gate status at the end of the analysis. To enable this, pass the `-Dsonar.qualitygate.wait=true` parameter to the scanner in the `bitbucket-pipelines.yml` file.

This will make the analysis step poll SonarQube regularly until the Quality Gate is computed. This will increase your pipeline duration. Note that, if the Quality Gate is red, this will make the analysis step fail, even if the actual analysis itself is successful. We advise only using this parameter when necessary (for example, to block a deployment pipeline if the Quality Gate is red). It should not be used to report the Quality Gate status in a pull request, as this is already done with pull request decoration.


server/sonar-docs/src/pages/analysis/branch-pr-analysis-overview.md → server/sonar-docs/src/pages/analysis/ci-integration-overview.md View File

@@ -1,6 +1,6 @@
---
title: Overview
url: /analysis/branch-pr-analysis-overview/
url: /analysis/ci-integration-overview/
---

_Merge and Pull Request analysis is available as part of [Developer Edition](https://redirect.sonarsource.com/editions/developer.html) and [above](https://www.sonarsource.com/plans-and-pricing/)._
@@ -11,14 +11,23 @@ SonarScanners running in GitLab CI/CD, Azure Pipelines, Cirrus CI, Bitbucket Pip
| 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, you can suspend pipeline execution until the analysis' Quality Gate status is known. See the [Jenkins](/analysis/jenkins/) integration page.
You can ensure your code meets your quality standards by failing your pipeline job when your [Quality Gate](/user-guide/quality-gates/) fails.

With Jenkins, you can suspend pipeline execution until the analysis' Quality Gate status is known. See the [Jenkins](/analysis/jenkins/) integration page.

With GitHub Actions, you can fail the pipeline job when the Quality Gate fails using the [SonarQube Quality Gate Check Action](https://github.com/marketplace/actions/sonarqube-quality-gate-check).

With Bitbucket Pipelines, you can fail the pipeline job when the Quality Gate fails using the [SonarQube Quality Gate Check Pipe](https://bitbucket.org/sonarsource/sonarqube-quality-gate).

For other CIs, you can use the `sonar.qualitygate.wait=true` analysis parameter in your configuration file. Setting `sonar.qualitygate.wait` to true forces the analysis step to poll your SonarQube instance until the Quality Gate status is available. This increases the pipeline duration and causes the analysis step to fail any time the Quality Gate fails, 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 the number of 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.
For GitLab CI/CD configuration, see the [GitLab integration](/analysis/gitlab-integration/) page.

## GitHub Actions
For GitHub Actions configuration, see the [GitHub integration](/analysis/github-integration/) page.

## Azure Pipelines
For Azure Pipelines configuration, see the [Azure DevOps integration](/analysis/azuredevops-integration/) page.

+ 8
- 3
server/sonar-docs/static/SonarQubeNavigationTree.json View File

@@ -74,7 +74,7 @@
{
"title": "CI Integration",
"children": [
"/analysis/branch-pr-analysis-overview/",
"/analysis/ci-integration-overview/",
"/analysis/jenkins/"
]
},
@@ -88,8 +88,13 @@
"children": [
"/analysis/github-integration/",
"/analysis/gitlab-integration/",
"/analysis/bitbucket-integration/",
"/analysis/bitbucket-cloud-integration/",
{
"title": "Bitbucket Integration",
"children": [
"/analysis/bitbucket-integration/",
"/analysis/bitbucket-cloud-integration/"
]
},
"/analysis/azuredevops-integration/"
]
},

+ 8
- 3
server/sonar-docs/static/StaticNavigationTree.json View File

@@ -97,7 +97,7 @@
{
"title": "CI Integration",
"children": [
"/analysis/branch-pr-analysis-overview/",
"/analysis/ci-integration-overview/",
"/analysis/jenkins/"
]
},
@@ -111,8 +111,13 @@
"children": [
"/analysis/github-integration/",
"/analysis/gitlab-integration/",
"/analysis/bitbucket-integration/",
"/analysis/bitbucket-cloud-integration/",
{
"title": "Bitbucket Integration",
"children": [
"/analysis/bitbucket-integration/",
"/analysis/bitbucket-cloud-integration/"
]
},
"/analysis/azuredevops-integration/"
]
},

Loading…
Cancel
Save