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 ?
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.
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 .
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.
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.
Sure, as stated here in the documentation, you can use the stand-alone sonar-scanner utility.
Sonar does static code analysis, which provides a detailed report of bugs, code smells, vulnerabilities, code duplications.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With