I found this: https://blog.sonarsource.com/sonarcloud-bitbucket-pipe
Unfortunately, it looks a little incomplete.
When I run it against my java project, it seems to not figure out the project key.
I presume that it’s not actually using the sensible variable choices that come from bitbucket as variables.
I notice that the docker hub file for this new sonar scanner is completely devoid of info.
As is…basically all of sonar cloud’s site. How is this actually supposed to work? Previously, I’ve done this in a step, and just used it in a maven container. Using a pipeline would definitely be nicer, especially if it kept track of all these details for me rather than forcing me to figure them out.
mvn sonar:sonar -Dsonar.login=$SONAR_CLOUD_TOKEN -Dsonar.projectKey=$BITBUCKET_REPO_SLUG -Dsonar.branch.name=$BITBUCKET_BRANCH -Dsonar.projectName=$BITBUCKET_REPO_SLUG -Dsonar.projectVersion=1.0 -Dsonar.host.url=https://sonarcloud.io
Have you read the documentation on https://sonarcloud.io/documentation/integrations/bitbucketcloud/?
There you will find a link to sample projects, where a Maven-based one is given and shows that you do not need to pass all those parameters.
Did you look at the link at the top of what I gave you?
What you linked is definitely not what I was asking about at all - or, rather, that’s exactly what I described as what I want to not do, except with a less sophisticated example than I gave (you’re only considering pushing to master, and not worrying about pull requests, etc, in that repo).
I’m not entirely sure how to rephrase so that you’ll understand; it seems like my initial description is pretty clear to me.
How am I supposed to use the new sonarcloud bitbucket pipe? I gave examples of exactly what I’m not seeing when I try to use it.
In the linked article, I cannot find mention that the SonarCloud Scan pipe currently only supports use cases where you would use the Sonar Scanner CLI (
sonar-scanner tool), which excludes typical Java projects built with Maven or Gradle. To be fair, this is mentioned in the README of the code repository of this pipe, as well as the Intro page of the pipe.
The documentation linked by Fabrice explains how to use pipelines with Maven projects, without using the scan pipe. That documentation also explains using pipelines with pull requests.
It’s not recommended to use the pipe with Java projects. (See my first paragraph.)
I hope this helps, let me know if it doesn’t!