Adam McMurchie
Adam McMurchie

Reputation: 31

Extracting SonarQube Report (preferably for Jenkins)

apologies if this has been covered, there have been a couple similar questions on SE - but struggling to find an explicit solution:

Does anyone know how to access the reports from SonarQube? I want to put some logic in Jenkins that will only proceed to do more stuff if quality gates are passed. This is something I wish to automate, and not login to sonarqube manually.

I have seen references to a possible, Gerrit plugin solution or using a curl step to use the API but neither explained how to replicate that approach.

Upvotes: 0

Views: 5419

Answers (2)

Latika
Latika

Reputation: 1

sonarqube reports can be extracted using webapi for example : http://sonarserver:9010/api/issues/search?componentKeys=sonarProject&severities=BLOCKER,CRITICAL,MAJOR,MINOR,INFO&s=SEVERITY&asc=false&ps=100 convert the json output to csv and to xls using online tools http://convertcsv.com/json-to-csv.htm

Upvotes: 0

You've got to use the SonarQube Scanner for Jenkins.

Specifically, check the "Analyzing in a Jenkins pipeline" section: it allows you to run a SonarQube analysis, and wait for the Quality Gate to be available so that you can decide (in your pipeline script) what to do based on the status of the quality gate.

Upvotes: 1

Related Questions