What location is sonarscan report saved during gerrit pullbranch analysis?


We have enterprise license and sonar pull branch analysis is working as expected and we are posting comments to gerrit using sonar2gerrit jenkins plugin. does team at sonarqube know where is the scan report location on jenkins pod because plugin is posting comments to gerrit but not posting code coverage percentage. so we want to manually do that by parsing number.

or is there sonar api that can helpp us fetch the scan and coverage results file from server? if yes, can you point to it exactly?


The analysis report that’s submitted to the server isn’t in a parsable form. If you’re pulling the Quality Gate status back to Jenkins after analysis, you may be able to get your coverage % value from it. IIRC that payload includes the values of all the Quality Gate metrics.

Beyond that, it’s certainly possible to pull the coverage value directly from SonarQube using Web APIs.

The best way to master the API is to perform the desired action via the UI (i.e. look at a page where the coverage % is reported) and eavesdrop to see which calls the UI made to accomplish the action.

You may also find this guide helpful.


1 Like

i followed and hit this issue bash - api call with curl -u with token works on Mac and fails on linux - Stack Overflow

any hint if you guys have answer?