I’ve setup SonarCloud on our Bitbucket Cloud instance and it’s working well on the branches. On our repository pull requests, the Sonar plugin displays “Not analyzed on SonarCloud yet”.
I’ve configured the Sonar analysis on the default pipeline as follows:
default: - step: caches: - maven - docker script: - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify sonar:sonar -Dsonar.host.url=https://sonarcloud.io \ -Dsonar.projectKey=myproject -Dsonar.pullrequest.bitbucketcloud.repository=myrepo \ -Dsonar.pullrequest.bitbucketcloud.owner=myorg -Dsonar.organization=myorg -Dsonar.login=$SONAR_TOKEN services: - docker
What else do I need to do to get the pull request analysis working?
I also added an equivalent build step for default pull-request build. But it looks like these don’t run in Bitbucket if the pull request originated from a fork? Is there another way to make SonarCloud analyse pull requests?
Looks like the pull-request analysis is done after merging