SonarQube Jenkins Integration and project analysis

2018-02-25 03_14_24-Document4 - Microsoft Word

Using the steps we can configure SonarQube code analysis with Jenkins in genral sonarqube gets installed at port number 9000 so the IP should come as http://<<ipaddress&gt;:9000/dashboard.

  1. Open the Jenkins login if required move to option Manage Jenkins >> manage plugins

pic1

  1. Under manage plugin we need to configure sonarqube code analysis plugin the link for the plugin is https://plugins.jenkins.io/sonar

To configure the plugin follow :-

  • Click the “Manage Jenkins” link.
  • Click the “Global Tool Configuration” link.
  • Click the “Available” tab.
  • Search “SonarQube Plugin”.
  • Select “SonarQube Plugin” and Click the “Install without restart” button.
    pic2

Once the plugin is installed it should under the menu Installed plugin option

pic3

  1. Once the plugin is configure we need to configure our sonar servers details like (server url , credentials under Jenkins
  2. Go to Manage Jenkins -> Configure system   and give the details as required and shown below
    pic4
  3. Once SonarQube server details are successfully configured under the Jenkins next we can utilize it for doing sonar analysis of project under Jenkins
  4. Go to Jenkins create a sample project either it can be Freestyle or Maven project
    pic5
  5. Under build environment option in Jenkins  search and choose the option Prepare SonarQube Scanner environment
    buildenvironment
  6. Next under POST BUILD ACTION STEPS choose sonarqube analysis with maven
    pic6
  7. Next under SonarQube analysis section choose Advance option and provide the path for POM.XML file

pic7

  1. So till now we were able to complete
    * Embedding sonar server under Jenkins
    * Configuring sonar analysis for once the project under Jenkins

Next we will run the Jenkins job
pic8

  1. Once the project build is successful go to sonarqube server at http://<<ipaddress>:9000/dashboard it will show all the project got analyzed
  2. Or click the icon sonarqube under Jenkins project summary tab
    pic9
  3. Once we are into sonarqube dashboard we can see the report for our project which got analyzed and can check the status whether it’s PASSED , FAILED or under WARNING its all depends on the quality get we set against the project
  4. As per the result of sonarqube analysis we can make our respective build pass or fail under Jenkins using the option the steps mentioned under the blog :
    https://aboullaite.me/sonar-build-breaker-groovy-jenkins/