diff options
author | mickael-caro-sonarsource <50556955+mickael-caro-sonarsource@users.noreply.github.com> | 2019-07-08 13:30:11 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2019-07-10 08:36:51 +0200 |
commit | fbcd3b7693d858542eb778baf6e85ebedea3b51a (patch) | |
tree | ef62594a7dcd744ba689556671c156f1a2bdb1b9 /server/sonar-docs | |
parent | 8d317e8bffa615d38ecc24d5715060f66f58860a (diff) | |
download | sonarqube-fbcd3b7693d858542eb778baf6e85ebedea3b51a.tar.gz sonarqube-fbcd3b7693d858542eb778baf6e85ebedea3b51a.zip |
MMF-1737 Analyze Bitbucket repositories with Azure Pipelines (#1879)
* SC-762- Tutorial for new BbC projects should mention support of Azure Pipelines
* Updated tutorial for bitbucketcloud
* SC-801 - Organization and its eventual app install related entity are now mandatory while targeting a bound project on ALMs.
* SC-801 --TEMP Added INFO logs
* SC-801 - Added back return of alm binding if no project alm is present.
* SC-801 - Fixed added log, failing unit tests before.
* SC-801 - Added extra logs (TEMP)
* SC-801 - Reverted unwanted imports.
* SC-801 - Adaptation of UT following the add of logs TO BE REVERTED ONCE OK
* SC-801 - Changed newly added log levels to debug to see if they are popping in the CE logs.
* SC-801 - Add constant for Bitbucket API Version in its REST client.
* SC-760 - Updated documentation to support Azure Pipelines.
* SC-801 - Reverted all temporary logs
* fixup! SC-760 - remove inside file links to avoid failing of unint tests.
* SC-801 - Fixes after review
* SC-760 - Splited documentation to 3 in total, with azure pipelines and bitbucket pipelines.
* SC-762 - Updated Snapshot
* SC-762 - Updated onboarding tutorial + documentation
* SC-762 - Updated formating of .tsx following yarn validate.
* SC-801 - Added unit tests + removed codesmell
* SC-760 - Updated documentation markdowns for Bitbucket.
* SC-801 - Removed unused import.
* SC-801 - Updated failing unit tests.
* SC-801 - Fix typo
* SC-801 - Resolving issues following analysis by SQ
Diffstat (limited to 'server/sonar-docs')
3 files changed, 81 insertions, 28 deletions
diff --git a/server/sonar-docs/src/pages/sonarcloud/integrations/bitbucketcloud-azurepipelines.md b/server/sonar-docs/src/pages/sonarcloud/integrations/bitbucketcloud-azurepipelines.md new file mode 100644 index 00000000000..7c27d6538ed --- /dev/null +++ b/server/sonar-docs/src/pages/sonarcloud/integrations/bitbucketcloud-azurepipelines.md @@ -0,0 +1,36 @@ +--- +title: Analyze your repository with Azure Pipelines +nav: With Azure Pipelines +url: /integrations/bitbucketcloud/azure-pipelines/ +--- + +If you are analyzing .NET applications and want to benefit from the Azure DevOps / Pipelines experience and features, you have the possibility to setup a build pipeline, targeting your Bitbucket Cloud repository, and connected to SonarCloud. + +## Analyzing branches + +Please be advised that the team where the Bitbucket Cloud repository is has to be bound to your SonarCloud organization in order to get this work. + +1. Install the SonarCloud extension for Azure DevOps in your Azure DevOps organization : [SonarCloud extension](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud). You can have a look a [this chapter](https://docs.microsoft.com/en-us/labs/devops/sonarcloudlab/index?tutorial-step=1) of the global tutorial for Azure DevOps. + +2. Configure a new build pipeline (YAML or classic editor), targeting your Bitbucket Cloud repository. You will have to create a new service connection to that repository. + +3. Configure the Prepare SonarCloud configuration task just the way you will do for a regular Azure Git Repository. + +4. Go to the triggers tab of the pipeline configuration, click on the repository below `Continuous Integration` then click on `Enable continuous integration`, add a new branch filter with following configuration : + * Type : Include + * Branch specification : master + +Want to see how it is working ? Have a look at our [sample .NET project](https://bitbucket.org/sonarsource/sample-dotnet-project-azuredevops) + +## Analyzing pull requests + +Pre-requisites : + +* Follow the initiation steps of Analyzing branches with Azure pipelines above. +* Version 1.6.4+ of the Azure DevOps extension is needed. + +As for branches, you can trigger an analysis for Pull requests with an Azure DevOps pipeline and get your PR decorated. + +1. On the Azure pipeline that will be used, click on the `Triggers` tab, then click on the repository below `Pull request validation` + +2. Click on `Enable pull request validation` then configure the proper branch filters. diff --git a/server/sonar-docs/src/pages/sonarcloud/integrations/bitbucketcloud-bitbucketpipelines.md b/server/sonar-docs/src/pages/sonarcloud/integrations/bitbucketcloud-bitbucketpipelines.md new file mode 100644 index 00000000000..e4be9b8c930 --- /dev/null +++ b/server/sonar-docs/src/pages/sonarcloud/integrations/bitbucketcloud-bitbucketpipelines.md @@ -0,0 +1,42 @@ +--- +title: Analyze your repository with Bitbucket Pipelines +nav: With Bitbucket Pipelines +url: /integrations/bitbucketcloud/bitbucket-pipelines/ +--- + +## Analyzing branches + +Once your project is created and initiated from the repository you selected: + +1. Generate a token to allow to publish analysis from Bitbucket Pipelines. To generate a token, follow the first step of the tutorial on the dashboard of the project, or go to your user security page. + +2. On Bitbucket Cloud, go to the "Settings > Pipelines > Account variables" page of your team, and add a new SONAR_TOKEN variable that contains the value of the SonarCloud token (something like `9ad01c85336b265406fa6554a9a681a4b281135f`). + * **Make sure that you click on the "Lock" icon to encrypt and hide this token.** + +3. Edit the `bitbucket-pipelines.yml` file of your repository to trigger the SonarCloud analysis. + +Once those changes are pushed, Pipelines will automatically trigger analyses on the repository. + +You can see our multiple sample projects to see how it is working : + + * [Built with Gradle](https://bitbucket.org/sonarsource/sample-gradle-project) + * [Built with Maven](https://bitbucket.org/sonarsource/sample-maven-project) + * [Javascript project](https://bitbucket.org/sonarsource/sample-nodejs-project) + +If you target a .NET application, see a [sample .NET project](https://bitbucket.org/sonarsource/sample-dotnet-project-azuredevops) built with Azure Pipelines + +## Analyzing pull requests + +In order to trigger SonarCloud analysis on each pull request update, you have to supply the same command in the `pull-requests` section of `bitbucket-pipelines.yml` (check [Configure bitbucket-pipelines.yml](https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html#Configurebitbucket-pipelines.yml-ci_pull-requests) for more details about that section). Here is a sample configuration: +``` +pipelines: + ... + pull-requests: + feature/*: + - step: + script: + - mvn sonar:sonar + ... +``` + +In order to avoid duplication between the different sections of your `bitbucket-pipelines.yml`, you can use [yaml anchors and aliases](https://confluence.atlassian.com/bitbucket/yaml-anchors-960154027.html). diff --git a/server/sonar-docs/src/pages/sonarcloud/integrations/bitbucketcloud.md b/server/sonar-docs/src/pages/sonarcloud/integrations/bitbucketcloud.md index b19cdb62fdc..84dde4116bd 100644 --- a/server/sonar-docs/src/pages/sonarcloud/integrations/bitbucketcloud.md +++ b/server/sonar-docs/src/pages/sonarcloud/integrations/bitbucketcloud.md @@ -10,35 +10,10 @@ url: /integrations/bitbucketcloud/ 3. You will be asked to install the SonarCould application on your team or user account, which will allow you to choose which repositories you want to analyze. -## Analyzing with Pipelines +## Analyzing your repository -Once your project is created and initiated from the repository you selected: - -1. Generate a token to allow to publish analysis from Bitbucket Pipelines. To generate a token, follow the first step of the tutorial on the dashboard of the project, or go to your user security page. - -2. On Bitbucket Cloud, go to the "Settings > Pipelines > Account variables" page of your team, and add a new SONAR_TOKEN variable that contains the value of the SonarCloud token (something like `9ad01c85336b265406fa6554a9a681a4b281135f`). - * **Make sure that you click on the "Lock" icon to encrypt and hide this token.** - -3. Edit the `bitbucket-pipelines.yml` file of your repository to trigger the SonarCloud analysis. See [our various example projects](https://bitbucket.org/account/user/sonarsource/projects/SAMPLES) to see how to achieve this. - * Note: if you did not activate Pipelines prior to this step, you should go to the "Pipelines" menu entry on your repository to enable it. - -Once those changes are pushed, Pipelines will automatically trigger analyses on the repository. - -## Analyzing pull requests with Pipelines - -In order to trigger SonarCloud analysis on each pull request update, you have to supply the same command in the `pull-requests` section of `bitbucket-pipelines.yml` (check [Configure bitbucket-pipelines.yml](https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html#Configurebitbucket-pipelines.yml-ci_pull-requests) for more details about that section). Here is a sample configuration: -``` -pipelines: - ... - pull-requests: - feature/*: - - step: - script: - - mvn sonar:sonar - ... -``` - -In order to avoid duplication between the different sections of your `bitbucket-pipelines.yml`, you can use [yaml anchors and aliases](https://confluence.atlassian.com/bitbucket/yaml-anchors-960154027.html). +* [With Bitbucket Pipelines](/integrations/bitbucketcloud/bitbucket-pipelines/) +* [With Azure Pipelines](/integrations/bitbucketcloud/azure-pipelines/), if you analyze .NET applications and want to benefit from Azure DevOps features. ## Quality widget |