Kick off analysis from Bitrise, PR decoration in Gitlab

We run most of our pipelines for our Android app in Bitrise, but for Sonarcloud we have one pipeline in Gitlab.

The problem is the pipeline in Gitlab is much slower, slowing down our overall builds.
It can also not benefit from the caches we already have in Bitrise.
By moving the Sonarcloud pipeline to Bitrise as well, the build time goes down, but then we lose the nice Pull Request Decoration in Gitlab.

Is there a way to kick off the analysis from somewhere else (Bitrise) and still get the PR decoration in Gitlab?

Hey there.

Since Bitrise isn’t supported out of the box, this will require some additional configuration for Pull Request analysis (only running the SonarScanner with sonar.pullrequest.* parameters when a PR build is being run, and deriving the values from environment variables.

1 Like

Thanks for the very quick answer :slight_smile:
I think you put me on the right path. Almost got it working now.

@Colin we almost got it working, the analysis shows up in Sonarcloud and the Pull request decoration is working, but it always shows 0 new lines of code and we can’t see the coverage or code or anything in Sonarcloud:

We are using the Sonarqube Scanner step (GitHub - DroidsOnRoids/bitrise-step-sonarqube-scanner: Step for running SonarQube Scanner CLI) from Bitrise and the logs in Bitrise all look good. We see the Jacoco report being imported and files being analysed etc.

Any ideas what we might be missing?

Some relevant parts of the logs from Bitrise:

13:27:29.327 INFO: Sensor JaCoCo XML Report Importer [jacoco]
13:27:29.335 INFO: Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
13:27:29.335 DEBUG: Reading report '/bitrise/src/app/build/reports/jacoco/jacocoUnitTestReport/jacocoUnitTestReport.xml'
13:27:29.655 INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=328ms
13:27:29.656 INFO: Sensor Kotlin Sensor [kotlin]
13:27:29.663 WARN: Access to the multi-values/property set property 'sonar.java.binaries' should be made using 'getStringArray' method. The SonarQube plugin using this property should be updated.
13:27:29.679 WARN: Access to the multi-values/property set property 'sonar.java.libraries' should be made using 'getStringArray' method. The SonarQube plugin using this property should be updated.
13:28:08.146 INFO: 529 source files to be analyzed
...
13:28:15.188 INFO: 529/529 source files have been analyzed
13:28:15.189 INFO: Sensor Kotlin Sensor [kotlin] (done) | time=45533ms

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.