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.properties
81
INFO: Project root configuration file: NONE
82
INFO: SonarScanner 5.0.1.3006
83
INFO: Java 17.0.8 Amazon.com Inc. (64-bit)
84
INFO: Linux 5.15.0-1040-aws amd64
85
INFO: Bitbucket Cloud Pipelines detected, no host variable set. Defaulting to sonarcloud.io.
86
INFO: User cache: /root/.sonar/cache
87
INFO: Analyzing on SonarQube server 8.0.0.46037
88
INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)
89
INFO: Load global settings
90
INFO: Load global settings (done) | time=284ms
91
INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
92
INFO: User cache: /root/.sonar/cache
93
INFO: Load/download plugins
94
INFO: Load plugins index
95
INFO: Load plugins index (done) | time=253ms
96
INFO: Load/download plugins (done) | time=2535ms
97
INFO: Loaded core extensions: developer-scanner
98
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 settings
101
INFO: Load global settings (done) | time=207ms
102
INFO: Process project properties
103
INFO: ------------------------------------------------------------------------
104
INFO: EXECUTION FAILURE
105
INFO: ------------------------------------------------------------------------
106
INFO: Total time: 8.257s
107
INFO: Final Memory: 8M/76M
108
INFO: ------------------------------------------------------------------------
109
ERROR: Error during SonarScanner execution
110
ERROR: You must define the following mandatory properties for 'Unknown': sonar.projectKey, sonar.organization
111
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?