As part of my precheckin workflow in Gerrit I want to configure sonarqube to perform scan on the submitted patch, I am using sonar-gerrit plugin in my Jenkins and configured gerrit-trigger to run this analysis job. This job is configured with preview mode and runs analysis but the the analysis happens on the repository which doesn’t include the submitted patchset. How can i ensure to run the analysis on the patchset?
Asked
Active
Viewed 408 times
4
-
Hello @raghavendra, can you post the details steps how you achieved this? i need to configure scan only on changed files on gerrit patchset. thanks. did you do it with pipeline or did you do without pipeline just following jenkins gui? need detail answer please. – AhmFM Feb 19 '23 at 02:52
1 Answers
3

Marcelo Ávila de Oliveira
- 19,950
- 3
- 39
- 50
-
1Now that I was able to run the scan on the gerrit patch, Can i also report these issues on gerrit. I enabled 'Post sonarqube issues as Gerrit comments' and also configured the gerrit REST API but still i dont see comments on the gerrit. Here's the logs from the job `INFO: Export issues to .scannerwork/sonar-report.json INFO:ANALYSIS SUCCESSFUL INFO:EXECUTION SUCCESS Getting Sonar Report from: .scannerwork/sonar-report.json Report has loaded and contains 19 issues Connected to Gerrit:server name: gerrit4. Change Number: 14, PatchSetNumber:1 Review has been sent Finished: SUCCESS` – Raghavendra Pathi Apr 14 '17 at 06:57
-
Some things to check: REST is correctly configured? Have you used the "Test REST Connection" button at the "Gerrit Trigger" configuration? The Gerrit change is not closed, is it? Did you check if the Jenkins user has Gerrit permission to comment? How did you configure the "Filter Settings" of the Sonar-Gerrit plugin (See these options: Report issues having severity level higher or equal to, Report new issues only?, Add comments to changed lines only)? Is everything correct? – Marcelo Ávila de Oliveira Apr 14 '17 at 20:02