From: Wouter Admiraal Date: Wed, 5 Jan 2022 09:22:49 +0000 (+0100) Subject: [NO JIRA] Use YAML anchors to make Bitbucket Pipelines examples DRYer X-Git-Tag: 9.3.0.51899~72 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c3ab9ef193d6e006fc821cf771850656146c0199;p=sonarqube.git [NO JIRA] Use YAML anchors to make Bitbucket Pipelines examples DRYer --- 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 e663286cb37..272d5e0e106 100644 --- a/server/sonar-docs/src/pages/analysis/bitbucket-cloud-integration.md +++ b/server/sonar-docs/src/pages/analysis/bitbucket-cloud-integration.md @@ -96,33 +96,29 @@ Click the scanner you're using below to expand the example configuration: | ``` | image: openjdk:8 | +| definitions: +| steps: +| - step: &build-step +| name: SonarQube analysis +| caches: +| - gradle +| - sonar +| script: +| - bash ./gradlew sonarqube +| caches: +| sonar: ~/.sonar +| | clone: | depth: full | | pipelines: | branches: | '{master,main,develop}': -| - step: -| name: SonarQube analysis -| caches: -| - gradle -| - sonar -| script: -| - bash ./gradlew sonarqube +| - step: *build-step | | pull-requests: | '**': -| - step: -| name: SonarQube analysis -| caches: -| - gradle -| - sonar -| script: -| - bash ./gradlew sonarqube -| -| definitions: -| caches: -| sonar: ~/.sonar +| - step: *build-step | ``` [[collapse]] @@ -135,33 +131,29 @@ Click the scanner you're using below to expand the example configuration: | ``` | image: maven:3.3.9 | +| definitions: +| steps: +| - step: &build-step +| name: SonarQube analysis +| caches: +| - maven +| - sonar +| script: +| - mvn verify sonar:sonar +| caches: +| sonar: ~/.sonar +| | clone: | depth: full | | pipelines: | branches: | '{master,main,develop}': -| - step: -| name: SonarQube analysis -| caches: -| - maven -| - sonar -| script: -| - mvn verify sonar:sonar +| - step: *build-step | | pull-requests: | '**': -| - step: -| name: SonarQube analysis -| caches: -| - maven -| - sonar -| script: -| - mvn verify sonar:sonar -| -| definitions: -| caches: -| sonar: ~/.sonar +| - step: *build-step | ``` [[collapse]] @@ -171,41 +163,36 @@ Click the scanner you're using below to expand the example configuration: | | ``` | image: mcr.microsoft.com/dotnet/core/sdk:latest +| +| definitions: +| steps: +| - step: &build-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}" +| caches: +| sonar: ~/.sonar +| +| clone: +| depth: full +| | pipelines: | branches: | '{master,main,develop}': -| - 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}" +| - step: *build-step | 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 -|``` +| - step: *build-step +| ``` [[collapse]] | ## SonarScanner CLI @@ -219,35 +206,33 @@ Click the scanner you're using below to expand the example configuration: | [[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. | -| ``` -| clone: -| depth: full -| -| pipelines: -| branches: -| '{master,main,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 -| ``` +| ``` +| image: maven:3.3.9 +| +| definitions: +| steps: &build-step +| - step: +| name: SonarQube analysis +| image: sonarsource/sonar-scanner-cli:latest +| caches: +| - sonar +| script: +| - sonar-scanner +| caches: +| sonar: /opt/sonar-scanner/.sonar +| +| clone: +| depth: full +| +| pipelines: +| branches: +| '{master,main,develop}': +| - step: *build-step +| +| pull-requests: +| '**': +| - step: *build-step +| ``` | | [[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. diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap index 7384d2d1b4e..697363c2ecc 100644 --- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap @@ -31,28 +31,31 @@ exports[`should render correctly for cfamily 1`] = ` yamlFileName="bitbucket-pipelines.yml" yamlTemplate="image: +definitions: + steps: + - step: &build-step + name: Download and install the build wrapper, build the project + script: + - mkdir $HOME/.sonar + - curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip + - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ + - $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output + - pipe: sonarsource/sonarqube-scan:1.0.0 + variables: + EXTRA_ARGS: -Dsonar.cfamily.build-wrapper-output=bw-output + SONAR_HOST_URL: \${SONAR_HOST_URL} + SONAR_TOKEN: \${SONAR_TOKEN} + caches: + sonar: ~/.sonar + clone: depth: full pipelines: branches: '{master}': # or the name of your main branch - - step: - name: Download and install the build wrapper, build the project - script: - - mkdir $HOME/.sonar - - curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip - - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ - - $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output - - pipe: sonarsource/sonarqube-scan:1.0.0 - variables: - EXTRA_ARGS: -Dsonar.cfamily.build-wrapper-output=bw-output - SONAR_HOST_URL: \${SONAR_HOST_URL} - SONAR_TOKEN: \${SONAR_TOKEN} - -definitions: - caches: - sonar: ~/.sonar" + - step: *build-step +" /> `; @@ -219,43 +217,33 @@ exports[`should render correctly for dotnet: with branch enabled 1`] = ` `; @@ -291,23 +279,26 @@ exports[`should render correctly for gradle 1`] = ` yamlFileName="bitbucket-pipelines.yml" yamlTemplate="image: openjdk:8 +definitions: + steps: + - step: &build-step + name: SonarQube analysis + caches: + - gradle + - sonar + script: + - bash ./gradlew sonarqube + caches: + sonar: ~/.sonar + clone: depth: full pipelines: branches: '{master}': # or the name of your main branch - - step: - name: SonarQube analysis - caches: - - gradle - - sonar - script: - - bash ./gradlew sonarqube - -definitions: - caches: - sonar: ~/.sonar" + - step: *build-step +" /> `; @@ -343,33 +334,29 @@ exports[`should render correctly for gradle: with branch enabled 1`] = ` yamlFileName="bitbucket-pipelines.yml" yamlTemplate="image: openjdk:8 +definitions: + steps: + - step: &build-step + name: SonarQube analysis + caches: + - gradle + - sonar + script: + - bash ./gradlew sonarqube + caches: + sonar: ~/.sonar + clone: depth: full pipelines: branches: '{master}': # or the name of your main branch - - step: - name: SonarQube analysis - caches: - - gradle - - sonar - script: - - bash ./gradlew sonarqube + - step: *build-step pull-requests: '**': - - step: - name: SonarQube analysis - caches: - - gradle - - sonar - script: - - bash ./gradlew sonarqube - -definitions: - caches: - sonar: ~/.sonar" + - step: *build-step" /> `; @@ -405,23 +392,26 @@ exports[`should render correctly for maven 1`] = ` yamlFileName="bitbucket-pipelines.yml" yamlTemplate="image: maven:3-openjdk-11 +definitions: + steps: + - step: &build-step + name: SonarQube analysis + caches: + - maven + - sonar + script: + - mvn verify sonar:sonar -Dsonar.projectKey=my-project + caches: + sonar: ~/.sonar + clone: depth: full pipelines: branches: '{master}': # or the name of your main branch - - step: - name: SonarQube analysis - caches: - - maven - - sonar - script: - - mvn verify sonar:sonar -Dsonar.projectKey=my-project - -definitions: - caches: - sonar: ~/.sonar" + - step: *build-step +" /> `; @@ -457,33 +447,29 @@ exports[`should render correctly for maven: with branch enabled 1`] = ` yamlFileName="bitbucket-pipelines.yml" yamlTemplate="image: maven:3-openjdk-11 +definitions: + steps: + - step: &build-step + name: SonarQube analysis + caches: + - maven + - sonar + script: + - mvn verify sonar:sonar -Dsonar.projectKey=my-project + caches: + sonar: ~/.sonar + clone: depth: full pipelines: branches: '{master}': # or the name of your main branch - - step: - name: SonarQube analysis - caches: - - maven - - sonar - script: - - mvn verify sonar:sonar -Dsonar.projectKey=my-project + - step: *build-step pull-requests: '**': - - step: - name: SonarQube analysis - caches: - - maven - - sonar - script: - - mvn verify sonar:sonar -Dsonar.projectKey=my-project - -definitions: - caches: - sonar: ~/.sonar" + - step: *build-step" /> `; @@ -519,23 +505,26 @@ exports[`should render correctly for other 1`] = ` yamlFileName="bitbucket-pipelines.yml" yamlTemplate="image: maven:3.3.9 +definitions: + steps: + - step: &build-step + name: SonarQube analysis + script: + - pipe: sonarsource/sonarqube-scan:1.0.0 + variables: + SONAR_HOST_URL: \${SONAR_HOST_URL} # Get the value from the repository/workspace variable. + SONAR_TOKEN: \${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here. + caches: + sonar: ~/.sonar + clone: depth: full pipelines: branches: '{master}': # or the name of your main branch - - step: - name: SonarQube analysis - script: - - pipe: sonarsource/sonarqube-scan:1.0.0 - variables: - SONAR_HOST_URL: \${SONAR_HOST_URL} # Get the value from the repository/workspace variable. - SONAR_TOKEN: \${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here. - -definitions: - caches: - sonar: ~/.sonar" + - step: *build-step +" /> `; @@ -571,33 +560,30 @@ exports[`should render correctly for other: with branch enabled 1`] = ` yamlFileName="bitbucket-pipelines.yml" yamlTemplate="image: maven:3.3.9 +definitions: + steps: + - step: &build-step + name: SonarQube analysis + script: + - pipe: sonarsource/sonarqube-scan:1.0.0 + variables: + SONAR_HOST_URL: \${SONAR_HOST_URL} # Get the value from the repository/workspace variable. + SONAR_TOKEN: \${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here. + caches: + sonar: ~/.sonar + clone: depth: full pipelines: branches: '{master}': # or the name of your main branch - - step: - name: SonarQube analysis - script: - - pipe: sonarsource/sonarqube-scan:1.0.0 - variables: - SONAR_HOST_URL: \${SONAR_HOST_URL} # Get the value from the repository/workspace variable. - SONAR_TOKEN: \${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here. + - step: *build-step pull-requests: '**': - - step: - name: SonarQube analysis - script: - - pipe: sonarsource/sonarqube-scan:1.0.0 - variables: - SONAR_HOST_URL: \${SONAR_HOST_URL} # Get the value from the repository/workspace variable. - SONAR_TOKEN: \${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here. - -definitions: - caches: - sonar: ~/.sonar" + - step: *build-step +" /> `; diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/CFamily.ts b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/CFamily.ts index bea52d0f861..3aa24a50cb3 100644 --- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/CFamily.ts +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/CFamily.ts @@ -21,44 +21,36 @@ export default function cFamilyExample(branchesEnabled: boolean) { return `image: +definitions: + steps: + - step: &build-step + name: Download and install the build wrapper, build the project + script: + - mkdir $HOME/.sonar + - curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip + - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ + - $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output + - pipe: sonarsource/sonarqube-scan:1.0.0 + variables: + EXTRA_ARGS: -Dsonar.cfamily.build-wrapper-output=bw-output + SONAR_HOST_URL: \${SONAR_HOST_URL} + SONAR_TOKEN: \${SONAR_TOKEN} + caches: + sonar: ~/.sonar + clone: depth: full pipelines: branches: '{master}': # or the name of your main branch - - step: - name: Download and install the build wrapper, build the project - script: - - mkdir $HOME/.sonar - - curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip - - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ - - $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output - - pipe: sonarsource/sonarqube-scan:1.0.0 - variables: - EXTRA_ARGS: -Dsonar.cfamily.build-wrapper-output=bw-output - SONAR_HOST_URL: \${SONAR_HOST_URL} - SONAR_TOKEN: \${SONAR_TOKEN} + - step: *build-step ${ branchesEnabled ? ` pull-requests: '**': - - step: - name: Download and install the build wrapper, build the project - script: - - mkdir $HOME/.sonar - - curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip - - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ - - $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output - - pipe: sonarsource/sonarqube-scan:1.0.0 - variables: - EXTRA_ARGS: -Dsonar.cfamily.build-wrapper-output=bw-output - SONAR_HOST_URL: \${SONAR_HOST_URL} - SONAR_TOKEN: \${SONAR_TOKEN}` + - step: *build-step` : '' -} -definitions: - caches: - sonar: ~/.sonar`; +}`; } diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/DotNet.ts b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/DotNet.ts index 1cda1d0a7fd..a2e7f9d5b9d 100644 --- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/DotNet.ts +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/DotNet.ts @@ -20,45 +20,35 @@ export default function dotNetExample(branchesEnabled: boolean, projectKey: string) { return `image: mcr.microsoft.com/dotnet/core/sdk:latest - + +definitions: + steps: + - step: &build-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:"${projectKey}" /d:"sonar.login=\${SONAR_TOKEN}" /d:"sonar.host.url=\${SONAR_HOST_URL}" + - dotnet build + - dotnet sonarscanner end /d:"sonar.login=\${SONAR_TOKEN}" + caches: + sonar: ~/.sonar + pipelines: branches: '{master}': # or the name of your main branch - - 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:"${projectKey}" /d:"sonar.login=\${SONAR_TOKEN}" /d:"sonar.host.url=\${SONAR_HOST_URL}" - - dotnet build - - dotnet sonarscanner end /d:"sonar.login=\${SONAR_TOKEN}" - ${ - branchesEnabled - ? ` + - step: *build-step +${ + branchesEnabled + ? ` 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:"${projectKey}" /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`; + - step: *build-step` + : '' +}`; } diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/Gradle.ts b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/Gradle.ts index 35afb573797..8360c1d6c6f 100644 --- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/Gradle.ts +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/Gradle.ts @@ -21,35 +21,31 @@ export default function gradleExample(branchesEnabled: boolean) { return `image: openjdk:8 +definitions: + steps: + - step: &build-step + name: SonarQube analysis + caches: + - gradle + - sonar + script: + - bash ./gradlew sonarqube + caches: + sonar: ~/.sonar + clone: depth: full pipelines: branches: '{master}': # or the name of your main branch - - step: - name: SonarQube analysis - caches: - - gradle - - sonar - script: - - bash ./gradlew sonarqube + - step: *build-step ${ branchesEnabled ? ` pull-requests: '**': - - step: - name: SonarQube analysis - caches: - - gradle - - sonar - script: - - bash ./gradlew sonarqube -` + - step: *build-step` : '' -} -definitions: - caches: - sonar: ~/.sonar`; +}`; } diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/Maven.ts b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/Maven.ts index 9e63d9c4c62..f45ad31efa7 100644 --- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/Maven.ts +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/Maven.ts @@ -21,35 +21,31 @@ export default function mavenExample(branchesEnabled: boolean, projectKey: string) { return `image: maven:3-openjdk-11 +definitions: + steps: + - step: &build-step + name: SonarQube analysis + caches: + - maven + - sonar + script: + - mvn verify sonar:sonar -Dsonar.projectKey=${projectKey} + caches: + sonar: ~/.sonar + clone: depth: full pipelines: branches: '{master}': # or the name of your main branch - - step: - name: SonarQube analysis - caches: - - maven - - sonar - script: - - mvn verify sonar:sonar -Dsonar.projectKey=${projectKey} + - step: *build-step ${ branchesEnabled ? ` pull-requests: '**': - - step: - name: SonarQube analysis - caches: - - maven - - sonar - script: - - mvn verify sonar:sonar -Dsonar.projectKey=${projectKey} -` + - step: *build-step` : '' -} -definitions: - caches: - sonar: ~/.sonar`; +}`; } diff --git a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/Others.ts b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/Others.ts index d06403f8b8c..3a918d36883 100644 --- a/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/Others.ts +++ b/server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/Others.ts @@ -21,35 +21,32 @@ export default function othersExample(branchesEnabled: boolean) { return `image: maven:3.3.9 +definitions: + steps: + - step: &build-step + name: SonarQube analysis + script: + - pipe: sonarsource/sonarqube-scan:1.0.0 + variables: + SONAR_HOST_URL: \${SONAR_HOST_URL} # Get the value from the repository/workspace variable. + SONAR_TOKEN: \${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here. + caches: + sonar: ~/.sonar + clone: depth: full pipelines: branches: '{master}': # or the name of your main branch - - step: - name: SonarQube analysis - script: - - pipe: sonarsource/sonarqube-scan:1.0.0 - variables: - SONAR_HOST_URL: \${SONAR_HOST_URL} # Get the value from the repository/workspace variable. - SONAR_TOKEN: \${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here. + - step: *build-step ${ branchesEnabled ? ` pull-requests: '**': - - step: - name: SonarQube analysis - script: - - pipe: sonarsource/sonarqube-scan:1.0.0 - variables: - SONAR_HOST_URL: \${SONAR_HOST_URL} # Get the value from the repository/workspace variable. - SONAR_TOKEN: \${SONAR_TOKEN} # Get the value from the repository/workspace variable. You shouldn't set secret in clear text here. + - step: *build-step ` : '' -} -definitions: - caches: - sonar: ~/.sonar`; +}`; }