From 5ff9a835b438e35f4d0dc556adb360824372c819 Mon Sep 17 00:00:00 2001 From: sandeepds Date: Sun, 25 Aug 2019 18:46:28 +0530 Subject: [PATCH] Updated Jenkins Sonar Updated Jenkins Sonar --- jenkinsfile | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/jenkinsfile b/jenkinsfile index 06e22f91e..5c9514db9 100644 --- a/jenkinsfile +++ b/jenkinsfile @@ -8,6 +8,31 @@ node { // ** in the global configuration. mvnHome = tool 'M3' } + stage('Sonar Scan Execution'){ + //Run the sonar scan + steps { + script{ + mvnHome = tool 'M3' + withSonarQubeDev{ + sh "'${mvnHome}/bin/mvn' verify sonar:sonar -Dintegration-tests.skip=true -Dmaven.test.failure.ignore=true" + } + } + } + } + stage('Sonar scan result check') { + steps { + timeout(time: 2, unit: 'MINUTES') { + retry(3) { + script { + def qg = waitForQualityGate() + if (qg.status != 'OK') { + error "Pipeline aborted due to quality gate failure: ${qg.status}" + } + } + } + } + } + } stage('Build') { // Run the maven build withEnv(["MVN_HOME=$mvnHome"]) { @@ -18,15 +43,4 @@ node { } } } - stage('Sonar Scan Execution'){ - //Run the sonar scan - steps { - script{ - def mvnHome = tool 'M3' - withSonarQubeDev{ - sh "'${mvnHome}/bin/mvn' verify sonar:sonar -Dintegration-tests.skip=true -Dmaven.test.failure.ignore=true" - } - } - } - } }