SonarQube Integration with Jenkins
Integration SonarQube server with Jenkins is necessary to store your reports. Follow below steps to enable that.
Follow this in YouTube
Prerequisites
- SonarQube Server Get Help here
- Jenkins Server Get Help here
Implementation
Login to Jenkins server and install sonarqube scanner.
- SonarQube scanner URL : https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner
- Package : https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip
# wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip
# unzip sonar-scanner-cli-3.2.0.1227-linux.zip
# mv sonar-scanner-3.2.0.1227-linux /opt/sonar_scanner
Set SonarQube server details in sonar-scanner property file
- Sonar properties file: /opt/sonar_scanner/conf/sonar-scanner.properties
- sonar.host.url=http://
<SONAR_SERVER_IP>:9000
- sonar.host.url=http://
Login to Jenkins GUI console and install " SonarQube scanner" plugin
Manage Jenkins>Manage Plugins>Avalable>SonarQube scanner
Configure SonarQube scanner home path
Manage Jenkins>Global Tool Configuration>SonarQube Scanner- Name :
sonar_scanner - SONAR_RUNNER_HOME :
/opt/sonar_scanner
- Name :
Configure SonarQube server name and authentication token
Manage Jenkins>Configure Systems>SonarQube Servers- Name :
SonarQube - ServerURL :
http://<Sonarqube_server>:9000/sonar - Server
authentication tokenTo Get Authentication code follow below steps. Login to SonarQube server as a adminMy Account>Security>Generate Token
- Name :
Create a job to test SonarQube. Provide below sonar properties details in the job under build
- Build:
Execute SonarQube Scanner>Analysis properties(it is mandatary).- sonar.projectKey=
Valaxy - sonar.projectName=
ValaxyDemo - sonar.projectVersion=
1.0 - sonar.sources=
/var/lib/jenkins/workspace/$JOB_NAME/<PROJECT_NAME>/src
- sonar.projectKey=
Execute job to get analysis report.
Next Step
from : https://github.com/ValaxyTech/DevOpsDemos/blob/master/SonarQube/Sonar_Integration_with_Jenkins.MD
No comments:
Post a Comment