Sonar™Scanner

Configuration

  1. Configure the Sonar™Scanner as described in the SonarQube™ Wiki.

    1. See the official Sonar™Scanner example projects for inspiration

  2. Add a Sonar™ Scanner task to your Bamboo job

  3. For test coverage in SonarQube™ with Sonar™Scanner, please pass the required parameters to specify the path to the coverage reports as described in the SonarQube™ Wiki.

How to use with Docker

  1. Define a remote agent capability for the Sonar™Scanner CLI Docker image:

    1. Go to Bamboo > Agents > Shared Remote Capabilities

    2. Create a new capability of type Custom with key docker-sq-scanner and value /opt/sonar-scanner

    3. Create a new Bamboo job for the SonarQube™ analysis and use the Docker image sonarsource/sonar-scanner-cli:latest:

      d. Add the Sonar™Scanner task configuration, and choose for the field SonarQube™Scanner executable the value docker-sq-scanner

    4. Run the Bamboo job, and the analysis should work fine.

    5. If you experience any errors like JGit Failed to find all committed files , make sure you follow the troubleshooting advice below.

Tips and Troubleshooting

Remote Agents

If you use SonarScanner task on a remote agent, set the capability by either

a) adding a SonarScanner capability to your remote agent in the Bamboo UI, see above

b) or add the following key/value pair to your bamboo-agent-home/bin/bamboo-capabilities.properties file, see Bamboo docs for more details:

  • system.builder.sos.SonarScanner=/path/to/your/sonarqube-scanner/home

 

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