We migrated to sonarcloud from sonarqube. And now our PR decorations no longer work. It seems, that the problem is our local runners for bitbucket pipelines. I’ve tried following documentation and adding these steps:
pipelines:
pull-requests:
"**":
- step:
name: 🔍 SonarQube Online
script:
- pipe: sonarsource/sonarcloud-scan:2.0.0
variables:
SONAR_TOKEN: $SONAR_TOKEN
- pipe: sonarsource/sonarcloud-quality-gate:0.1.6
variables:
SONAR_TOKEN: $SONAR_TOKEN
The problem with this is that I get following error:
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties81
INFO: Project root configuration file: NONE82
INFO: SonarScanner 5.0.1.300683
INFO: Java 17.0.8 Amazon.com Inc. (64-bit)84
INFO: Linux 5.15.0-1040-aws amd6485
INFO: Bitbucket Cloud Pipelines detected, no host variable set. Defaulting to sonarcloud.io.86
INFO: User cache: /root/.sonar/cache87
INFO: Analyzing on SonarQube server 8.0.0.4603788
INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)89
INFO: Load global settings90
INFO: Load global settings (done) | time=284ms91
INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu92
INFO: User cache: /root/.sonar/cache93
INFO: Load/download plugins94
INFO: Load plugins index95
INFO: Load plugins index (done) | time=253ms96
INFO: Load/download plugins (done) | time=2535ms97
INFO: Loaded core extensions: developer-scanner98
INFO: Found an active CI vendor: 'Bitbucket Pipelines'99
WARN: The project has not been created on SonarCloud. Please go to https://sonarcloud.io/projects/create to set up the project.100
INFO: Load global settings101
INFO: Load global settings (done) | time=207ms102
INFO: Process project properties103
INFO: ------------------------------------------------------------------------104
INFO: EXECUTION FAILURE105
INFO: ------------------------------------------------------------------------106
INFO: Total time: 8.257s107
INFO: Final Memory: 8M/76M108
INFO: ------------------------------------------------------------------------109
ERROR: Error during SonarScanner execution110
ERROR: You must define the following mandatory properties for 'Unknown': sonar.projectKey, sonar.organization111
ERROR:112
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
It seems, that this is no longer using my gradle scanner, which has all the required properties in build.gradle file.
Before this I would just run ./gradlew sonar on my bitbucket runner, but after moving to sonarcloud it no longer adds PR decorations.
How to fix PR decorations?



