From 08601fc8e9772c8bf4c5d3ad13ec56d69c699541 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Wed, 6 Sep 2017 12:34:38 -0500 Subject: [PATCH] Updated the logic to allow for different allowable statuses from the SonarQube quality gate. --- Jenkinsfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 97aa3ebfd..6ca0134f0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,8 +32,15 @@ pipeline { steps { timeout(time: 1, unit: 'HOURS') { 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() - 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}" } }