Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to publish sonar result in jenkins server, or do we have sonar-report jenkins plugin

There is a sonar plugin for jenkins, it triggers the sonar build inside CI (jenkins), it is useful.

While now I want to see the sonar result inside jenkins without jumping to sonar websites, it is useful if I just want to see some key data for this job.

It could be sonar-report plugin in jenkins.

Do you have similar needs ?

like image 883
Larry Cai Avatar asked Oct 13 '12 13:10

Larry Cai


People also ask

How do I get SonarQube report in Jenkins?

Log into Jenkins as an administrator and go to Manage Jenkins > Configure System. Scroll down to the SonarQube configuration section, click Add SonarQube, and add the values you're prompted for. The server authentication token should be created as a 'Secret Text' credential.

How do I publish a sonar report?

You will see how to publish code coverage to SonarQube in 2 simple steps. Enable “xml” parameter in rktracer configuration file to generate SonarQube xml file. Set reports path in sonar properties file to SonarQube xml file in project .

How does SonarQube work with Jenkins?

To Integrate the Jenkins DevOps environment with sonarqube installation is to generate an access token. This generated token will be later used in Jenkins for Sonar authentication.

How do I send a sonar analysis report in an email?

Log in to the SonarQube dashboard and click on the “Administration” tab. Browse to the “Configuration -> General settings -> General” menu. Under the “Email” section, fill out the required information. The settings below configure SonarQube to send emails through a Gmail account.

Can we use SonarQube without Jenkins?

Sure, as stated here in the documentation, you can use the stand-alone sonar-scanner utility.

What is a sonar report?

Sonar does static code analysis, which provides a detailed report of bugs, code smells, vulnerabilities, code duplications.


1 Answers

One ugly solution I used so far is to use Sonar Web API.

I add one curl command in the end of job (build steps) to fetch the needed metrics like

curl http://sonar.sh.cn.ao.ericsson.se//api/resources?metrics=qi-quality-index,coverage,test_success_density&resource=54936 --output sonar-result.xml

Then I archive the sonar-result.xml to make it visible inside the job.

like image 115
Larry Cai Avatar answered Jan 27 '23 21:01

Larry Cai