Sonar-scanner
Latest, v4.0.1 (sonarqube-scanner - npm), installed via NPM. Note: GitHub says that 4.1.0 is the latest, but it is not published, yet.
How is SonarQube deployed
Podman (no volume) podman run -d -p 9000:9000 --name sonar10 sonarqube:community
What are you trying to achieve
Run analysis
What have you tried so far to achieve this
v10.5 worked fine. This happened when upgrading to v10.6 (clean install, new pod/container).
Running ./mvnw sonar:sonar on a Java project works fine on this new instance, so in theory it’s a sonar-scanner specific issue.
> npm run sonar:local -- -X
[INFO] Bootstrapper: Retrieving info from "package.json" file
[DEBUG] Bootstrapper: Setting the log level to DEBUG due to verbose mode
[DEBUG] Bootstrapper: Properties: { <redacted> }
[INFO] Bootstrapper: Platform: win32 x64
[DEBUG] Bootstrapper: Detecting proxy: No proxy detected
[INFO] Bootstrapper: Server URL: http://localhost:9000
[INFO] Bootstrapper: Version: 4.0.1
[DEBUG] Bootstrapper: Check if Server supports JRE provisioning
[DEBUG] Bootstrapper: Detecting SonarQube server version
[DEBUG] Bootstrapper: Fetching API V2 /analysis/version
[DEBUG] Bootstrapper: Unable to fetch API V2 /analysis/version: AxiosError: Request failed with status code 401. Falling back on /api/server/version
[DEBUG] Bootstrapper: Not using axios instance for http://localhost:9000/api/server/version
[INFO] Bootstrapper: SonarQube server version: 10.6.0
[DEBUG] Bootstrapper: SonarQube Server v10.6.0 supports JRE provisioning: true
[INFO] Bootstrapper: JRE provisioning is supported
[DEBUG] Bootstrapper: Detecting latest version of JRE
[DEBUG] Bootstrapper: Downloading JRE information for win32 x64 from /analysis/jres
[ERROR] Bootstrapper: An error occurred: AxiosError: Request failed with status code 401
For the sake of testing, I even tried giving permissions (creation and execution) to “anyone”.and disabling " Force user authentication".
When accessing http://localhost:9000/api/v2/analysis/version on incognito mode, I get 10.6.0.92116, so it’s not a permission issue.
Off-topic question: If I have Java available, why it tries to download it?
Where are you providing the authentication details, and what type of token are you using (project-specific token, global analysis token, user token…)?
I believe the 401 is coming from this API endpoint. Something is funky with a new feature we added to download the JRE from the SonarQube server instead of relying on it being in the user’s environment.
Now – sonar.login is depcreated, but it isn’t removed yet, so something is fishy. I’m going to flag this for attention.
And while we don’t like “Anyone” being granted Execute Analysis permissions… I would have expected it to work if that’s what is configured.
This seems to be a valid bug; the npm scanner is not handling the deprecated sonar.login correctly (it should inform the user of the deprecation and map it to the new value sonar.token)
I’ve created a ticket to address this, stay tuned for an update