How to configure sonarqube in jenkins?
SonarQube is code quality checker and that can be integrated to Jenkins workflow to deliver continuous inspection.
Configuration steps as follows:SonarQube:1. Do a SonarQube docker image pull from docker hub 2. Then use docker run command to run the image to build SonarQube container.(Assumption JDK is already setup on the machine) if not , we need to docker containerized JDK.3. Now that step 2 allows us to run the SonarQube as a standalone server under localhost port 9000. (Type localhost:9000 on browser)4.login to SonarQube web app using admin as user I’d and admin as password.5. The go to Admin tab , Market place of SonarQube and install the plugins you wanted (SonarPython, Java, Groovy etc)6. You may need to restart SonarQube app after applying plugin installation.
Jenkins integration with Sonar1. Now that Sonar Server is ready, you may need to integrate Jenkins with Sonar.2. Login on to Jenkins, and go to Manage plugin section to install Sonar plugin.3. After restarting Jenkins, go the Configure system in Manage Jenkins section.4. Enable injection of Sonarserver, add Sonar server auth token etc.
Now, Enable Analysis with Sonar scanner by defining the SonarQube server on Global configuration Then configure Jenkins build