From f6e85467d1fbf00236dfd242cbcbcedc5e03de63 Mon Sep 17 00:00:00 2001 From: michaelbirnstiehl Date: Mon, 7 Jun 2021 13:29:13 -0500 Subject: [PATCH] SONAR-14895 Add dot net example to Bitbucket Pipelines documentation --- .../analysis/bitbucket-cloud-integration.md | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/server/sonar-docs/src/pages/analysis/bitbucket-cloud-integration.md b/server/sonar-docs/src/pages/analysis/bitbucket-cloud-integration.md index 6fb8dbe3aae..a118300108f 100644 --- a/server/sonar-docs/src/pages/analysis/bitbucket-cloud-integration.md +++ b/server/sonar-docs/src/pages/analysis/bitbucket-cloud-integration.md @@ -175,6 +175,49 @@ Click the scanner you're using below to expand the example configuration: | sonar: ~/.sonar | ``` +[[collapse]] +| ## SonarScanner for .NET +| +| Write the following in your `bitbucket-pipelines.yml`: +| +| ``` +| image: mcr.microsoft.com/dotnet/core/sdk:latest +| pipelines: +| branches: +| '{master}': +| - step: +| name: SonarQube analysis +| caches: +| - dotnetcore +| - sonar +| script: +| - apt-get update +| - apt-get install --yes openjdk-11-jre +| - dotnet tool install --global dotnet-sonarscanner +| - export PATH="$PATH:/root/.dotnet/tools" +| - dotnet sonarscanner begin /k:"*YOUR PROJECT KEY*" /d:"sonar.login=${SONAR_TOKEN}" /d:"sonar.host.url=${SONAR_HOST_URL}" +| - dotnet build +| - dotnet sonarscanner end /d:"sonar.login=${SONAR_TOKEN}" +| pull-requests: +| '**': +| - step: +| name: SonarQube analysis +| caches: +| - dotnetcore +| - sonar +| script: +| - apt-get update +| - apt-get install --yes openjdk-11-jre +| - dotnet tool install --global dotnet-sonarscanner +| - export PATH="$PATH:/root/.dotnet/tools" +| - dotnet sonarscanner begin /k:"*YOUR PROJECT KEY*" /d:"sonar.login=${SONAR_TOKEN}" /d:"sonar.host.url=${SONAR_HOST_URL}" +| - dotnet build +| - dotnet sonarscanner end /d:"sonar.login=${SONAR_TOKEN}" +| definitions: +| caches: +| sonar: ~/.sonar +|``` + [[collapse]] | ## SonarScanner CLI | -- 2.39.5