Analyze Your Repository With Bitbucket Pipelines

Once your project is created and initiated from the repository you selected, you can follow the tutorial to configure your analysis with Bitbucket Pipelines.

Launch your analysis and check your Quality Gate

Launch analyses with the SonarCloud Scan pipe and check the quality gate with the SonarCloud Quality Gate check pipe.

Limitation: these pipes are not available for all build technologies.

More information:

Analyzing branches

In order to trigger a SonarCloud analysis on each push on a branch, you have to supply the same command in the pull-requests section of bitbucket-pipelines.yml (check Configure bitbucket-pipelines.yml for more details about that section). Here is a sample configuration:

pipelines:
  ...
  branches:
    master:
      - step:
          script:
            - mvn sonar:sonar
  ...

Make sure that your bitbucket-pipelines.yml is up to date in the branch you want to analyze.

Analyzing pull requests

In order to trigger a SonarCloud analysis on each pull request update, you have to supply the same command in the pull-requests section of bitbucket-pipelines.yml (check Configure bitbucket-pipelines.yml for more details about that section). Here is a sample configuration:

pipelines:
  ...
  pull-requests:
    feature/*:
      - step:
          script:
            - mvn sonar:sonar
  ...

Make sure that your bitbucket-pipelines.yml is up to date in the pull request you want to analyze.

Sample projects

You can see our multiple sample projects to see how it is working :

If you target a .NET application, see a sample .NET project built with Azure Pipelines.

© 2008-2022, SonarCloud by SonarSource SA. All rights reserved.