Getting started

Steps necessary to get Include Code Quality for Bamboo up and running.

When using it together with Include Code Quality for Bitbucket, also check the Include Code Quality for Bitbucket getting started guide.

SonarQube™ scanners need access to the full git repository. If you encounter issues, e.g. in a containerized build, ensure that you

  • uncheck "Use shallow clones" option (Fetches the shallowest commit history possible. Do not use if your build depends on full repository history)

  • check "Fetch whole repository" option (Fetches whole repository instead of only one branch)

1.

Latest Include Code Quality for Bamboo supports SonarQube™:

  • versions newer or equal to 6.7

  • Community and all Commercial editions of SonarQube™ as well as SonarCloud.io

2.

Install Include Code Quality for Bamboo app on your Bamboo server

3.

Setup the SonarQube™ server configuration (Bamboo Administration > Apps > Include Code Quality for Bamboo):

4.

Add a task to your build plan

  1. Select type compatible to your build tool

  2. For the Sonar™ Scanner task types, you need to install the scanners separately on Bamboo server or use the provided Docker images instead.

If you want to run your analysis in Docker, follow the Sonar™Scanner Docker instructions.

 

 

 

 

 

 

5.

Select SonarQube™ server configuration

  1. Select one of the configured servers from Step 3 above

  2. (Alternative) From environment variables or build files

    1. Set the correct SonarQube™ Edition of your server

 

SonarQube™ Community Edition

SonarQube™ Developer Edition or higher, SonarCloud™

6.

Include Code Quality for Bamboo replaces characters in the <branchName> part that are not allowed in SonarQube™ project keys.

A dash - is used by default. You can override the replacement character:

 

You can disable the automatic SonarQube™ project creation by selecting “Disable … per branch creation”. Every time the task runs, the analysis result will add analysis to the same SonarQube™ project.

 

  1. Use Pull Request Analysis if your build plan is triggered by a pull request.

    1. This setting work best if Bamboo is used with Bitbucket and branch plans are created automatically.
      Set “When pull request is created” as plan branch creation trigger in Bamboo to enable automatic branch creation.

2. Use Branch Analysis if you are not using pull requests.

 

3. If you migrated SonarQube™ from Community to Developer Edition or higher, you can keep the “project per branch” style by checking the “Create … Project per Branch” option.

7.

Trigger a new build of your build plan and you should see the SonarQube™ Quality gate status on the build results page:

To break the build when the Sonar Quality™ Gates are failing, enable the option Show and break build on broken quality gates in the task's configuration:

8. (optional)

If your project takes too long to analyze for short-living branches like feature branches, consider using incremental mode to only analyze the changed/new files in your pull requests instead of the complete project:

9.

Congratulation, you finished the Include Code Quality for Bamboo setup.
Need support? Please contact us, we at Mibex Software are happy to help you.







SONAR™, SONARQUBE™ and SONARCLOUD™ are independent and trademarked products and services of SonarSource SA: see sonarsource.com, sonarqube.org, sonarcloud.io.