sonar-gitlab-plugin icon indicating copy to clipboard operation
sonar-gitlab-plugin copied to clipboard

Why is Sonar GitLab Plugin not sending analyze results to gitlab as a comments while using default templates?

Open Veranicus opened this issue 7 years ago • 12 comments

Hi there, I currently have a jenkins job that is triggered when push or commit is made within a gitlab project with the use of a configurated webhooks. Everything works fine and projects are analyzed when they're supposed to with SonarQube scanner for maven method, the problem is I want to then push SonarQube to analyze results to a given project in form of global or inline comments. So I have installed on my sonarQube server Sonar Gitlab plugin. Problem is it's not making those comments with results.

I have used default templates for global and inline comments as are stated in plugin documentation.

I haven't added any other configuration in connection with this except the ones I have stated in my post, thanks.

I'm linking images to each part of my gitlab configuration in SonarQube Server:

SonarQubeConfig1 - The gitlab name is direct https link directly to a repository : config1

SonarQubeConfig2 - FreeMarker syntax configuration in global and inline comments is directly from the default template which you can find in Sonar Gitlab Plugin documentation:

config2

SonarQubeConfig3 config3

Thank you.

Veranicus avatar Feb 22 '18 08:02 Veranicus

Hi, Have you a log and command line ? Thanks

gabrie-allaigre avatar Feb 22 '18 09:02 gabrie-allaigre

Hi there, I'm doing everything inside Jenkins with SonarQube scanner for Jenkins plugin installed and then on a server where is SonarQube installed in options as I have posted in images before.

Veranicus avatar Feb 22 '18 09:02 Veranicus

I don't know what do you mean by log and a command line exactly ?

Veranicus avatar Feb 22 '18 10:02 Veranicus

log for mvn sonar:sonar ....

gabrie-allaigre avatar Feb 22 '18 12:02 gabrie-allaigre

I don't know where to find a log for mvn sonar:sonar. The way I have it configured is that I have a job in jenkins that is analysing my repositories on gitlab with sonarqube, this job is triggered by a webhooks for push and merge events. It works perfectly, now I want to put analyse results in form of a comments to a gitlab, so I have your plugin installed, everything configured like inside of your documentation. I have already posted my gitlab config to you, now I have also enabled and added CI pipeline to my gitlab repo, it looks excatly as in your documentation:

ciconfg

Now it started several times, hovewer not in a times it should have, not after push or merge event but right after I added the pipeline and then it was just pending all the time and was saying it needs gitlab runner to start the pipeline... I don't know what I'm doing wrong. The only thing I want is after the job in jenkins is triggered, it analyse the project and after this analysis it posts the outcome of analysis to a gitlab, thank you.

Veranicus avatar Mar 02 '18 14:03 Veranicus

Hi, If use gitlab-ci, log in pipeline job.

gabrie-allaigre avatar Mar 05 '18 07:03 gabrie-allaigre

Can I somehow do it without using gitlab-ci ? Perhaps somehow only with a jenkins ? I don't want to be using another slave for gitlab-ci. Thank you.

Veranicus avatar Mar 06 '18 09:03 Veranicus

And by the way, do I need gitlab enterprise edition to do anything with this plugin ?

Veranicus avatar Mar 09 '18 10:03 Veranicus

I use gitlab ce and sonarqube ce only. Plugin work. Plugin work with gitlab-ci, jenkins and others

gabrie-allaigre avatar Mar 10 '18 11:03 gabrie-allaigre

Could you please post me some screenshots of how exactly can you configure it with gitlab ce and sonarqube ce only ? Thank you very much.

Veranicus avatar Mar 12 '18 17:03 Veranicus

Hi Guys, Further to this discussion. I am only using Gitlabs for Repo management and SonarQube for result analysis. Can someone guide me how do I send/see these results on Gitlabs (without using much different tools). Is there a proper procedure to configure seeing Sonarqube analysis results? Will if I add/delete/push a file on Gitlabs, will it then run Sonarqube analysis on its own and results will follow? Thanks, Nikhil

nikhilsobti avatar Aug 04 '18 23:08 nikhilsobti

Hi, all, @gabrie-allaigre The same issue to me, i have read the documentation, but I didn't find out how to integrate it with jenkins. Is there an example use with Jenkins pipeline? Now i use sonar with jenkins pipeline code as following(dont know how to use this plugin with jenkins、mvn sonar scaner):

 withSonarQubeEnv('SonarQube') {
           withCredentials([string(credentialsId: 'sonarToken', variable: 'sonarToken')]) {
             sh "cd ${buildScriptPath} && mvn sonar:sonar -Dsonar.host.url=$sonarHost -Dsonar.login=$sonarToken"
           }
  }

qhh0205 avatar Dec 22 '18 03:12 qhh0205