sonar runner authorization error
Asked Answered
E

2

6

I'm trying to send a job to sonarqube from jenkins. However I'm getting an error saying te following when I run the job

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: Not authorized. Please check the properties sonar.login and sonar.password.

The system I'm using is as follows. I have jenkins 2.7.1, SonarQube 5.6 and SonarQube Runner 2.4 is installed on my server as well.

To log in to jenkins and sonarqube I'm using a ldap that only holds ldap users, no local users exists.

In my jenkins settings I set up SonarQube as follows enter image description here

the token was created in a admin account in SonarQube enter image description here

When I created the job I made a new build step for a sonarqube scanner. Inside my project I created a sonar-project.properties file that holds the following information

sonar.projectKey=org.sonarqube:php-ut-sq-scanner
sonar.projectName=vanbenthem :: PHPUnit :: SonarQube Scanner
sonar.projectVersion=1.0

sonar.sources=src
sonar.tests=tests

sonar.language=php

sonar.sourceEncoding=UTF-8

# Reusing PHPUnit reports
sonar.php.coverage.reportPath=reports/phpunit.coverage.xml
sonar.php.tests.reportPath=reports/phpunit.xml

enter image description here

Can anyone tell me what I'm doing wrong? To my understanding I shouldn't be giving a login and password since SonarQube 5.4 Hope someone will be able to help me out

per nicloas' request

Here are the console output from jenkins and my sonar settings regarding my ldap.

enter image description here enter image description here

Eras answered 21/7, 2016 at 9:5 Comment(3)
The sonar-runner command executed should be printed in the console output, please add it to your question. Also paste the LDAP-related part of you sonar.properties (server side) as it might interfere with how permissions are managed in SonarQube.Decoupage
@Nicolas I updated my question with screenshots from bothEras
Have you specified the token value as the sonar.login property?Orian
N
2

Well, I faced the same issue with Bitbucket pipelines and Sonarqube. It turned out that the Sonarqube authentication token I was using was incorrect. It is configured as SONAR_TOKEN in Bitbucket's repository variables and correcting it solved the issue.

Please make sure to double check the Server authentication token you are entering here.

Naples answered 16/8, 2021 at 17:52 Comment(0)
M
0

Make sure the token provided by Sonarqube and stored in Jenkins is correct

Malpighiaceous answered 20/11, 2022 at 21:19 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Dedradedric

© 2022 - 2025 — McMap. All rights reserved.