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>:9000/dashboard.
- Open the Jenkins login if required move to option Manage Jenkins >> manage plugins
- 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.
Once the plugin is installed it should under the menu Installed plugin option
- Once the plugin is configure we need to configure our sonar servers details like (server url , credentials under Jenkins
- Go to Manage Jenkins -> Configure system and give the details as required and shown below
- Once SonarQube server details are successfully configured under the Jenkins next we can utilize it for doing sonar analysis of project under Jenkins
- Go to Jenkins create a sample project either it can be Freestyle or Maven project
- Under build environment option in Jenkins search and choose the option Prepare SonarQube Scanner environment
- Next under POST BUILD ACTION STEPS choose sonarqube analysis with maven
- Next under SonarQube analysis section choose Advance option and provide the path for POM.XML file
- 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
- Once the project build is successful go to sonarqube server at http://<<ipaddress>:9000/dashboard it will show all the project got analyzed
- Or click the icon sonarqube under Jenkins project summary tab
- 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
- 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/