Hey,
I am trying to setup PR decorations with Bitbucket cloud, but the documentation doesn’t fully explain how this can be done. How can I pass the “sonar.pullrequest.bitbucketcloud.repository” + “sonar.pullrequest.bitbucketcloud.owner” values to the Bitbucket pipeline job?
https://sonarcloud.io/documentation/analysis/pull-request/
Bitbucket Cloud PR Decoration
To add PR decoration on Bitbucket Cloud, you need to update some settings.
Updating Your Bitbucket Cloud Settings
Setting Name | Description | Example value |
---|---|---|
sonar.pullrequest.bitbucketcloud.repository |
UUID of the Bitbucket Cloud Repo | {d2615dd4-550d-43e5-80c4-665f951e5d6e} |
sonar.pullrequest.bitbucketcloud.owner |
UUID of the Bitbucket Cloud Owner | {4f9fd128-1b08-49ec-bf2c-f094163cff4d} |
My guess Bitbucket pipeline yml file that runs correctly but doesn’t decorate the PR:
image: maven:3.3.9
clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- maven
- sonar
script:
- mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -D sonar.pullrequest.bitbucketcloud.owner={XYZ} -D sonar.pullrequest.bitbucketcloud.repository={ABC}
artifacts:
- target/**
pipelines:
branches:
master:
- step: *build-test-sonarcloud
pull-requests:
'**':
- step: *build-test-sonarcloud