Blog post

Mono-repository support for Bitbucket Cloud now available for SonarCloud!

Thomas Olivier photo

Thomas Olivier

Product Marketing Manager


  • SonarCloud
  • Bitbucket
Last September, we announced that mono-repository support was added for GitHub and Azure DevOps Services. The good news is: mono-repository support is now also available for Bitbucket Clo...

Last September, we announced that mono-repository support was added for GitHub and Azure DevOps Services. The good news is: mono-repository support is now also available for Bitbucket Cloud! See what it brings and how you can configure it in SonarCloud below.

What is a mono-repository strategy?

First, let’s define mono-repository. Traditionally, software projects have been organized so that each project is stored within a single, distinct repository of its own. As software projects have become more complex and interconnected, some organizations moved to having all their projects in a single large repository. This is called the mono-repository, or monorepo strategy.

How does it work for Bitbucket Cloud?

The monorepo configuration of SonarCloud will allow you to approach Code Quality and Code Security at the project level, as it should be, regardless of how you work with repositories.

Pull request feedback for a Bitbucket Cloud monorepo

With this configuration you'll be able to:

  • Configure one Quality Gate per project: we advise you to do so!
  • Receive multiple/per-project Quality Gate results: quickly check from the pull request if all Quality Gates passed before you merge!
  • Read project-labeled messages from SonarCloud: understand which project is relevant to SonarCloud’s feedback and act accordingly!

How to set up your Bitbucket Cloud monorepo in SonarCloud?

You can either import a mono-repository or you can convert existing projects.

Importing a monorepo
  • Go to the + (plus) menu on the top right of the SonarCloud interface and select Analyze new project.
  • This will take you to theAnalyze projects page
  • Now click Setup a monorepo (it is a small text link on the lower right of the page).

You will now be on the Import monorepo page.

  • Select the organization and then select the monorepo repository that you want to import.
  • For each project contained in your monorepo, add a corresponding SonarCloud project by clicking "Add new project". You have to choose a unique project key for each SonarCloud project. As mentioned above, these are the keys that you will use when configuring your CI service (see below) to bind each monorepo project to its corresponding SonarCloud project.
Convert a standard project to a monorepo

On the analyze projects page, you can also add one or more additional project keys to an existing standard project. This will convert that new set of projects to a monorepo configuration.

For more information on how to configure your CI service for example, please refer to the documentation page.

Monorepo support brings feedback at the right level

SonarCloud configuration for Bitbucket Cloud monorepo

You will now be able to get feedback at the project-level if you're using a mono-repository! This will bring more accuracy to your Code Quality and Code Security strategy and will increase visibility on your projects. Let us know how this works for you!