Integrating SonarQube Developer Edition with Bitbucket Cloud

I am using SonarQube 8.2 (not: SonarCloud) with plans to upgrade to 8.3.

So far my company bought the Developer Edition of SonarQube. Now I would like to integrate it with BitBucket Cloud, but I don’t know what steps are required. Does our on-premise SonarQube work with the SonarCloud Add-on for Bitbucket?

So far I could not find any documentation, everything else is pointing to Bitbucket Server (which is not Cloud).

Hi @tbekps,

Welcome to our community!

SonarQube doesn’t integrate yet with BitbucketCloud, and we don’t have a plugin for that. It’s in our roadmap, but no ETA right now.

Out of curiosity, as your code is hosted on a Cloud ALM, what restrain you to go on SonarCloud?

Thanks.

1 Like

Actually I did not know that before we were buying the license and to me the information available can be a bit misleading.

I skimmed through the SonarQube Website and was more than happy to see that “SonarQube integrates with Bitbucket” and the Screenshots looked quite promising… The difference between Bitbucket Server and Bitbucket cloud is not obvious if you take a look at https://www.sonarqube.org/developer-edition/.
Also I’d wish a an alert box on “https://www.sonarqube.org/atlassian-bitbucket-integration/”, something along the lines of “Using Bitbucket Cloud? Take a look at SonarCloud instead! Using a hybrid approach? Get in touch with us.”.

Your support also did not ask me which version of Bitbucket we are using during the sales process.

Our scenario is as follows:
Developers work with Bitbucket Cloud. The changes get picked up by a on-premise TeamCity for CI/CD and results are reported to the on-premise SonarQube. Now one important selling point for me was that the SonarQube reports also appear during code review in Bitbucket (Cloud).
Does SonarCloud support this scenario? If that is the case, is it possible to switch the SonarQube License for a SonarCloud Subscription? We did not redeem it yet in the server.

Thanks a lot for your help and your quick response!

Hi @tbekps,

Thanks for the feedback, I will circle back with the team.

You will be able to launch the PR analysis with TeamCity the same way as you do with SonarQube.

As for the reports appear during code review in BitbucketCloud, it’s a bit different from what we show on BitBucket Server, ie. there are no annotations in line for the issues in the diff.
You can have a look at this PR in BitbucketCloud to see how SonarCloud decorates PR.

I suggest to get in touch with the sales representative who sold you the licence, they will be able to handle it from there, if you are interested.

Cheers,

1 Like

Thanks a lot! Your example project was very helpful!

That seems quite a turn-off. Are there any plans to change this in the near future? As a developer I would love to see all problems in one place without having to switch between multiple services.

Hi @tbekps,

Yes, we are currently working with Atlassian to bring those annotations inline. I cannot give you a hard estimate though, I’ll keep you posted here.

Stay tuned !

1 Like

I was looking into your example pull request today and I’m very pleased to see that there are inline issue reports included now :smiley:
However this only works when enabling the “Pull request annoations” flag in Account -> Labs.

However SonarQube requests permissions to my account to read team memberships and such. I guess for a public repository that is not really necessary? It should work even if I click “Deny” due to compliance rules.

It’s just that the “Code Quality” section keeps spinning and when clicking “Deny” it says that “Not analyzed on SonarCloud yet.”

Hi @tbekps ,
just to let you know that the latest flavor of SonarQube, the 8.7, is now compatible with Bitbucket Pipelines. You will be able to import your project, decorate Pull Requests and fail them if the quality gate is failed.
It is supposed to be released within the next few days :slight_smile:

Hope to help.
Regards,
Christophe

Currently we are not using Bitbucket Pipelines and we are not planning to do so. We are using Bitbucket for Git and TeamCity with SonarScanner for reporting to SonarCloud, as back when I wrote this issue the PR annotations were only possible with Bitbucket Cloud.

SonarCloud is linked to Bitbucket Cloud, so it has the projects and access to the source code.

Is there any way to achive Pull Request annotations?