This blog will show you how you can integrate SonarQube with Jenkins, You can implement various quality gates using SonarQube based on your needs and configure the code analysis to be done by SonarQube so the code should pass the quality gate to continue with the CI pipeline
Step 1: Login to your Jenkins controller and install SonarQube plugin
Go to Manage Jenkins > Manage Plugins
Click on Available > Type SonarQube Scanner for Jenkins and hit enter > Click on Install without restart
Step 2: Login to SonarQube and generate a security token
Click on your profile > My Account
Go to Security > Give a Token Name > Generate
Click on Copy ( You wont be able to see the key if the page gets refreshed )
Step 3: Login to Jenkins and perform the Integration
Go to Manage Jenkins > Global Tool Configuration
Scroll down to SonarQube Scanner > Click on Add SonarQube Scanner > Give a Name ( This name will be used in the Pipeline code when implementing CI ) > Click on Save
Go Back to Manage Jenkins > Configure System
Scroll down to SonarQube servers > Click on Add SonarQube
Give a Name, Server URL ( SonarQube Server IP ) > Click on Add
Note:
Make sure Jenkins is able to communicate with SonarQube Server ( Check firewall rules )
Sometimes you might need to Click on Save ( If the Add option is not responding ) , then comeback to the same section
Add a Comment