0

We currently use the MSBuild Scanner for our static code analysis at build time via bamboo. The Bamboo plug-in as far as I can tell does not support the scanner at this time so I am using command line.

I want to enable it for branches so we can gather more information within the company, however when I run the following command:

msbuild-scanner begin /k:"project" /v:${bamboo.version}.${bamboo.buildNumber} /n:"project" /d:sonar.branch=${bamboo.shortPlanName}

I get the below error:

ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
    at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
    at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
    at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
    at org.sonar.runner.api.Runner.execute(Runner.java:100)
    at org.sonar.runner.Main.executeTask(Main.java:70)
    at org.sonar.runner.Main.execute(Main.java:59)
    at org.sonar.runner.Main.main(Main.java:53)
Caused by: Insufficient privileges
ERROR: 
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
The SonarQube Scanner did not complete successfully
Post-processing failed. Exit code: 1

This is caused because the project:branch combination doesn't exist. If I create the project and re-run it works.

Is there a way Sonarqube can allow project creation at the time of build?

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76
theoneandonlyak
  • 490
  • 4
  • 7

1 Answers1

1

You need to grant the technical user running analysis the Create Projects permission.

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76