Updated the logic to allow for different allowable statuses from the SonarQube quality gate.

This commit is contained in:
Christopher Jones 2017-09-06 12:34:38 -05:00
parent 349eb685e0
commit 08601fc8e9

9
Jenkinsfile vendored
View file

@ -32,8 +32,15 @@ pipeline {
steps { steps {
timeout(time: 1, unit: 'HOURS') { timeout(time: 1, unit: 'HOURS') {
script { script {
// these are the statuses that we'll allow
def alowableStatuses = ['OK','WARN']
// we need to wait for the quality check to complete
def qg = waitForQualityGate() def qg = waitForQualityGate()
if (qg.status != 'OK') {
// if the status we got back, isn't one of the logal ones, then
// we need o fail the build
if (!allowableStatuses.contains(qg.status)) {
error "Pipeline aborted due to quality gate failure: ${qg.status}" error "Pipeline aborted due to quality gate failure: ${qg.status}"
} }
} }