From 0aea718e5e18ac9400a3e2102010a1b74107968d Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 6 Sep 2017 08:14:04 -0500 Subject: [PATCH] Adding a sample SonarQube configuration. --- Jenkinsfile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 009b53dc5..fb0169e6b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,6 +16,30 @@ pipeline { } } + stage('SonarQube analysis') { + withSonarQubeEnv('SonarQube Scanner 3.0.3.778') { + sh 'mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar ' + + '-f pom.xml ' + + '-Dsonar.projectKey=com.huettermann:all:master ' + + '-Dsonar.login=$SONAR_UN ' + + '-Dsonar.password=$SONAR_PW ' + + '-Dsonar.language=java ' + + '-Dsonar.sources=. ' + + '-Dsonar.tests=. ' + + '-Dsonar.test.inclusions=**/*Test*/** ' + + '-Dsonar.exclusions=**/*Test*/**' + } + } + + stage("SonarQube Quality Gate") { + timeout(time: 1, unit: 'HOURS') { + def qg = waitForQualityGate() + if (qg.status != 'OK') { + error "Pipeline aborted due to quality gate failure: ${qg.status}" + } + } + } + stage('Approve for QA') { agent any steps {