From da751a476e8efa919894b18bcae51d807cd89ffd Mon Sep 17 00:00:00 2001 From: Josef Salyer Date: Thu, 3 Aug 2017 14:08:53 -0400 Subject: [PATCH] Added waitForQualityGate example for Sonarqube Added the quality gate example to demonstrate another part of the Sonarqube plugin. --- jenkinsfile-examples/sonarqube/Jenkinsfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jenkinsfile-examples/sonarqube/Jenkinsfile b/jenkinsfile-examples/sonarqube/Jenkinsfile index 24200b4..4344a05 100644 --- a/jenkinsfile-examples/sonarqube/Jenkinsfile +++ b/jenkinsfile-examples/sonarqube/Jenkinsfile @@ -7,4 +7,13 @@ node { withSonarQubeEnv { sh "./gradlew clean sonarqube" } + + // later...when you want to continue, + // but only after the quality gate has passed + timeout(time: 1, unit: 'HOURS') { + def qg = waitForQualityGate() + if (qg.status != 'OK') { + error "Pipeline aborted dur to quality gate failure: ${qg.status}" + } + } }