Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

Info

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

Excerpt
namegit_info
Info

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):

Image Modified

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.

Info

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

Image Modified

5.

Select SonarQube™ server configuration

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

    Image Modified
  2. (Alternative) From environment variables or build files

    1. Set the correct SonarQube™ Edition of your server

      Image Modified

SonarQube™ Community Edition

SonarQube™ Developer Edition or higher, SonarCloud™

6.

Info

The SonarQube™ Community Edition does not know about branches and pull requests. A separate SonarQube™ project for each branch is used to show SonarQube™ information for pull requests and branches.

Include Code Quality for Bamboo uses Sonar™ project keys in the format <projectKey>:<branchName> More details can be found in our Sonar™ Analysis Configuration guide

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:

Image Modified

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.

Image Modified

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

    1. Image Modified

      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.

Image Modified

2. Use Branch Analysisif you are not using pull requests.

Image Modified

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:

Image Modified

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:

Image Modified

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:

Image Removed
Image Added

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.