Sonar
This commit is contained in:
sandeepds 2019-08-26 00:45:04 +05:30 committed by GitHub
parent f54eeb1fb9
commit 69cf2b4ff7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,31 +8,21 @@ node {
// ** in the global configuration. // ** in the global configuration.
mvnHome = tool 'M3' mvnHome = tool 'M3'
} }
stage('Sonar Scan Execution'){ stage('Sonar Quality Analysis'){
//Run the sonar scan //Run the sonar scan
steps {
script{
mvnHome = tool 'M3'
withSonarQubeDev{ withSonarQubeDev{
sh "'${mvnHome}/bin/mvn' verify sonar:sonar -Dsonar.projectKey=Petclinic -Dsonar.host.url=http://xyart81442dns1.eastus2.cloudapp.azure.com -Dsonar.login=bff9e0e153a1384234a2c18652327736550c1ecd-Dintegration-tests.skip=true -Dmaven.test.failure.ignore=true" sh "'${mvnHome}/bin/mvn' verify sonar:sonar -Dsonar.projectKey=Petclinic -Dsonar.host.url=http://xyart81442dns1.eastus2.cloudapp.azure.com -Dsonar.login=bff9e0e153a1384234a2c18652327736550c1ecd-Dintegration-tests.skip=true -Dmaven.test.failure.ignore=true"
} }
} }
} stage('Sonar Quality Gate') {
} timeout(time: 1, unit: 'HOURS') {
stage('Sonar scan result check') {
steps {
timeout(time: 2, unit: 'MINUTES') {
retry(3) {
script {
def qg = waitForQualityGate() def qg = waitForQualityGate()
if (qg.status != 'OK') { if (qg.status != 'OK') {
currentBuild.status='FAILURE'
error "Pipeline aborted due to quality gate failure: ${qg.status}" 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"]) {