SonaQube is great tool for monitoring quality of source code.

Gradle projects can be easily integrated with SonarQube by Sonar Runner Plugin.

You can start analysis by command:

gradle sonarRunner

This works perfectly on command line, but execution by Bamboo CI terminates with following error:

ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Missing commit 4a3e...237f

The problem is that Bamboo creates shallow git clones by default. You can find this options under Repositories tab – Advanced options.

Solution: disable “Use shallow clones” options and start job again.

Correct configuration:

stash-shallow-clone

Result: 🙂

build-success