Having issue to run Sonarqube report using Jenkies

Dear SonarQube Community,
I’m going to “On-board” SonarQube in our DevOps process inside our team - Below are the steps that I have followed and still I’m getting permission error:
1 ) In Gitgub , same repository I have created test branch for SonarQube and placed my Pipeline script there.
2 ) Inside the pipline script I have created a step to call SonarQube as below:

stage(“Sonarqube Analysis & Quality Gate”) {
steps {
script {
bat “mvn sonar:sonar -Dsonar.login=SONAR_TOKEN”
}

3 ) Sonar_Token above is created in SonarQube for tmy service ID and placed properly
4 ) I have checked my service ID has sufficient access while it’s assigned to correct AD group
5 ) I have setup my Jenkins configuration Global Pipeline Libraries section

When I tried to build I got below error:

Are you able to help me ?
Thanks!
Saeid

Hi,

Welcome to the community!

Is that your pipeline script verbatim? I’m not seeing the $ on the SONAR_TOKEN variable that would cause it to be interpolated. Also, I’m not seeing withSonarQubeEnv that would reference back to your Global SonarQube server configuration. Ideally, you’re going to put your token in that global configuration & then it’s filled in for you when you reference that configuration. The SonarScanner for Jenkins docs should help.

 
HTH,
Ann

Hi Ann,
Thanks for your reply, Actually with the same Jenkins setting and same pipeline worked for other user in our ORG. just not sure what is missing with my service ID.

Hi,

Can you double-check that the user who issued the token has permissions to run analysis on that particular project?

 
Ann