How can we analyze feature branches in SonarCloud?

Hello Team,
We are using Bitbucket for code repository and AWS codepipeline as CICD.
We have successfully integrated SonarCloud with Bitbucket and AWS Codepiepline.

My code is written in Dotnet.

I have separate pipeline created in every aws environment (dev, test, qa, prod) and i am using different feature branches for deployment but now I need to know that how can i analyze my feature branches in SonarCloud ?

Can you please help me on it.

Hello Team,
Your reply is highly appreciated !

Can someone please let me know that how will i analyze my all feature branches in different different environment of AWS codepipeline.

Hi @vtotare

Please be patient, this is a public forum and we reply here on a best effort basis, in the middle of the month of holidays… :wink:
Have you tried applying the Branch analysis setup documentation for the non-integrated build environment? Setting the sonar.branch.name and sonar.branch.target analysis parameters should work.
If you are analyzing pull requests and if your SonarCloud project is bound to the Bitbucket project, setting the sonar.pullrequest.key should also work and provide pull request decoration on Bitbucket. The Other CIs documentation gives further details about the configuration of non-integrated CIs.

Ohh Sorry -:slight_smile:

My project is in rush so looking quick help from the team, henceforth will take care of it.

Regards,
-Vishal

@Claire_Villard : I used this parameter sonar.branch.name to analyze my feature branches and i am successfully able to analyze them but i still need to understand that what’s the use of this parameter sonar.branch.target and do i also need to configure in CI script ?

Regards,
-Vishal

Hi,

The sonar.branch.target parameter is the name of the branch the feature branch will be merged into. If it is not set, then the default branch of your project will be used.

If you use Bitbucket Pull Requests to merge the feature branches onto your main branch, I think the best setup is to use import the organization and the project on SonarCloud, as described here.
If you do that, you will be able to just mention the pull request number on your build, with the sonar.pullrequest.key parameter, and benefit from the pull request decoration: the analysis results will be posted directly into the BitBucket pull request, making the development process quicker for the team.
You can read this doc to learn more about the difference between short branches and pull requests on SonarCloud.