Updated Jenkins Sonar

Updated Jenkins Sonar
This commit is contained in:
sandeepds 2019-08-25 18:46:28 +05:30 committed by GitHub
parent a076a429e3
commit 5ff9a835b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,6 +8,31 @@ node {
// ** in the global configuration. // ** in the global configuration.
mvnHome = tool 'M3' 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') { stage('Build') {
// Run the maven build // Run the maven build
withEnv(["MVN_HOME=$mvnHome"]) { 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"
}
}
}
}
} }