How to get sonar report from Jenkins pipeline?

1,188 views
Skip to first unread message

Вадим Самойленко

unread,
Feb 26, 2017, 2:47:37 AM2/26/17
to SonarQube
Hello! 
I would like to see sonar report in Jenkins. (How many bugs, code smells etc were found via sonar)
For example:

Sonar analize report:
10 code smells 
2 bugs 
were found.

//// Get QualityGate(Failed) from Jenkins pipeline and STOP Jenkins build. At the moment with QualityGate = (failed), I can see in Jenkins console that "ANALYSIS SUCCESSFUL" and Jenkins continue building.

I'm trying to get the info using curl request from Jenkins pipeline. (curl -X POST "http://localhost:9000/api/qualitygates/project_status?projectKey=my:project") but I can't find request about issues (types, names, count)... and this way look pretty ugly in Jenkins console. in addition I get a lot of excess info like date, comparator, periodIndex....
Could you tell me the best way to get info about project problems? and info about quality gate status for stoping Jenkins. Thank you!

G. Ann Campbell

unread,
Feb 28, 2017, 8:30:38 AM2/28/17
to SonarQube
Hi,

If you're hoping to see the counts of new issues raised during the analysis, you're out of luck; that information's not calculated today. However, we hope to add this as part of the Project Activity Stream which is first introduced in SonarQube 6.3 (currently in RC).

If you're hoping to get issue totals, then the issues web services are what you need. The responses will be in JSON, and you'll probably to parse and pretty them up before making them visible in Jenkins.

For Quality Gate status, it's again a JSON web service that's what you want.


Ann
Reply all
Reply to author
Forward
0 new messages