I'd like to have sonar comments on github pull requests. For that I set up a jenkins job which runs ./gradlew clean sonarRunner [properties]
.
I read through this:
jenkins + sonar + github integration
My setup is similar, I don't start sonar with maven but with gradle.
I use the following properties:
-Dsonar.github.login=
-Dsonar.github.repository=company/repo
-Dsonar.analysis.mode=preview
-Dsonar.issuesReport.console.enable=true
-Dsonar.github.login=gitusername
-Dsonar.github.oauth=token
As described here: http://docs.sonarqube.org/display/PLUG/GitHub+Plugin
The end of the log on jenkins is:
11:06:02.167 INFO - Sensor GitHub Plugin InputFile Cache
11:06:02.167 INFO - Sensor GitHub Plugin InputFile Cache (done) | time=0ms
11:06:02.168 INFO - Load server issues
11:06:02.532 INFO -
------------- Issues Report -------------+620 issues +2 blocking +43 critical +402 major +169 minor +4 info
11:06:02.532 INFO - Export issues to /jenkins/workspace/scheduling-sonar-pull-request/jdk/JDK8/label/Linux/build/sonar/sonar-report.json
11:06:02.611 INFO - ANALYSIS SUCCESSFULINFO: EXECUTION SUCCESS INFO:
Total time: 20.198s Final Memory: 26M/742M INFO:
BUILD SUCCESSFUL
But there are no comments appearing on github.
In order to debug changed the oauth token, which gave:
ERROR: Caused by: Unable to perform GitHub WS operation
ERROR: Caused by: Server returned HTTP response code: 401 for URL:
Why are no comments appearing on github? The github plugin is installed on sonarqube, jenkins triggers the sonarRunner, the PR id is correct (tried it hard-coded), the PR has a lot of files, a wrong oauth token gives an error.