2
votes

I am getting this error after running SONAR analysis in Jenkins with SonarQube. After the build is running a while and analysing I am getting the error. I have to mention that I've created the token in Sonar and put it in Jenkins configuration.

Somehow, I think it's due to the missing rights on Sonar to create a project or something.

Can you please help me with a solution?

Here are the latest logs from the Jenkins build.

WARN: This may lead to missing/broken features in SonarQube
INFO: 328 files had no CPD blocks
INFO: Calculating CPD for 868 files
INFO: CPD calculation finished
INFO: Analysis report generated in 818ms, dir size=42 MB
INFO: Analysis report compressed in 2897ms, zip size=6 MB
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2:36.346s
INFO: Final Memory: 30M/313M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: You're not authorized to run analysis. Please contact the project administrator.
2

2 Answers

2
votes

It's not a connection issue, it's a permission issue (Authorization).

The posted message indicated ERROR: You're not authorized to run analysis.

Check if your user has Execute Analysis permission (see Global or Project permissions).

If this is a new project (does not yet exist SonarQube), then users will also need "Create Projects" to create the initial project inside SonarQube. This can be done in advance via the UI (or by an Admin) or on first run, depending on permission model.

Review the SonarQube Security page and provide only what's needed.

See special note on Creators permission under Permission Templates for Default Permissions | Creators permissions.

-1
votes

Update: The issue was regarding to the Sonar rights. After having admin rights, the build passed.