Friday, January 27, 2017

Continuous Quality - SonarQube Configuration in Jenkins

DevOps - Continuous Integration : SonarQube Configuration in Jenkins


Install SonarQube in CI server

Download latest SonarQube from https://www.sonarqube.org/downloads and install in your CI server, or for Mac machines brew command can be used alternatively - brew update - brew install sonar ->


Configure & start the sonarQube server

Create sonar database in local server using database queries - CREATE DATABASE sonar_source; - CREATE USER 'sonar'@'localhost' IDENTIFIED BY 'sonar'; - GRANT ALL PRIVILEGES ON sonar_source.* TO 'sonar'@'localhost'; - FLUSH PRIVILEGES; -> Update database details in sonar properties file using command - $ vim /usr/local/Cellar/sonarqube/6.1/libexec/conf/ sonar.properties -> Start the sonar server using command - $ sonar console ->


Configure SonarQube in Jenkins

Install SonarQube plugin in Jenkins using option - Manage Jenkins - Manage Plugins -> Update sonarQube server detail using option - Manage Jenkind - Configure System ->


Create SonarQube build job in Jenkins

Create a maven build job using option - new item -> Check ‘Prepare SonarQube Scanner environment’ under build Environment -> Update pom.xml url in ROOT POM -> Select ‘sonarQube analysis with maven’ under Post-build Actions ->


Run the sonarQube build job & view SonarQube report in Jenkins

Run the build -> Upon successful run, click ‘SonarQube’ icon to view SonarQube code analyzer report.


No comments:

Post a Comment