SonarQube configuration in Jenkins

8
SONARQUBE CONFIGURATION IN JENKINS DevOps – Continuous Integration

Transcript of SonarQube configuration in Jenkins

Page 1: SonarQube configuration in Jenkins

SONARQUBE CONFIGURATION IN JENKINS

DevOps – Continuous Integration

Page 2: SonarQube configuration in Jenkins

Continuous Testing

Continuous Deployment

Continuous Monitoring

DevOps

Continuous Integration

Continuous Development

Continuous Feedback

Page 3: 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 ->

Page 4: SonarQube configuration in Jenkins

CONFIGURE & START THE SONARQUBE SERVERCreate 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 ->

Page 5: SonarQube configuration in Jenkins

CONFIGURE SONARQUBE IN JENKINS

Request certification from agent -># puppet agent --test --server=<master hostname> master.demo.com --waitforcert=50 -> check for certificate request in master -># puppet cert list -> sing certification in master -># puppert cert sign <agent hostname> agent.demo.com ->

Page 6: SonarQube configuration in Jenkins

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 ->

Page 7: SonarQube configuration in Jenkins

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.