Hello, I am running sonar-scanner for .net core in a Bitbucket pipeline.
I’ve also installed the SonarCloud for Bitbucket cloud and configured the right sonar project in Bitbucket under “Repository->SONARCLOUD->Settings” in the drop down.
Whenever such a build is completed successfully, I can see the new analysis in the right project at sonarcloud.io, but it is always under master branch, even if the change was done in a forked branch and also the pipeline runs it in this forked branch. I guess this is also the reason why my PRs are not decorated. In other words, no other branch than master, has ever been created on SonarCloud.io
Can you please help? Do you need the pipeline build log for that?
BTW, lately I added this parameter: /d:sonar.branch.name=$BITBUCKET_BRANCH and it does create a branch in sonarcloud, and when I create a pull request in bitbucket, from a new branch to master, I do see the Code Quality section in the pull request being filled
(see image attached), but when I click on the “See all issues on Sonar Cloud”, I’m being redirected to SonarCloud.io and I get the message “Component ‘MyHDP’ of pull request ‘hdp_test2’ not found”
it looks like some environment variables might be missing from the Docker image you are using - which would prevent the auto-detection to work properly. Can you add those 2 following lines to your YML file (right after the last “sudo dotnet” command) and send us the logs:
Julien, as I told you in the previous reply, your solution works. Nonetheless, the behavior I see is weird: When I create a pull request in Bitbucket, a corresponding PR is not being created on SonarCloud. Only after I do another commit and push to that PR, a corresponding PR is being created on SonarCloud.
Basically, let say you have an analysis of your master branch on SonarCloud. Locally you create a feature branch feature/foo and add a few commits. Then you push the branch on Bitbucket Cloud. It will trigger a pipelines build of the branch, and our integration will configure a branch analysis.
Then you open a new PR in BBC UI. Nothing happens (no build is triggered).
Then you push more commits to your feature branch. A pipelines build is triggered. Our integration will detect that there is an open PR for this branch, and so configure a PR analysis. As a consequence your branch analysis will stop being updated.
GitHub alone doesn’t have any build feature. But if you add travis-ci (using our integration) it works better indeed.
travis-ci will triger one build as soon as you create a PR. And each time you push to your branch, it will trigger two builds (one of the branch, and one of the PR “virtual” merge commit).