You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2018/02/22 14:48:48 UTC

[incubator-plc4x] 01/01: fail the build if the quality gate fails

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch feature/sonarqube_build_breaker
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git

commit a5d44d655d9a196e2e9da199f622987662a7a2d3
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Feb 22 15:48:43 2018 +0100

    fail the build if the quality gate fails
---
 Jenkinsfile | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index afaffe9..9567e8c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -103,7 +103,25 @@ pipeline {
             }
             steps {
                 echo 'Building'
-                sh 'mvn -P${JENKINS_PROFILE} sonar:sonar'
+                withSonarQubeEnv('Apache SonarQube Server') {
+                    sh 'mvn -P${JENKINS_PROFILE} sonar:sonar'
+                }
+            }
+        }
+
+        stage("Quality Gate") {
+            when {
+                branch 'master'
+            }
+            steps {
+                script {
+                    timeout(time: 1, unit: 'HOURS') {
+                        def qg = waitForQualityGate()
+                        if (qg.status != 'OK') {
+                            error "Pipeline aborted due to quality gate failure: ${qg.status}"
+                        }
+                    }
+                }
             }
         }
 

-- 
To stop receiving notification emails like this one, please contact
sruehl@apache.org.