formation il y a 3 ans
Parent
commit
44851760c1
1 fichiers modifiés avec 12 ajouts et 1 suppressions
  1. 12 1
      Jenkinsfile

+ 12 - 1
Jenkinsfile

@@ -137,13 +137,24 @@ node{
 	// }
     stage('SonarQube analysis') 
 		{
-			def scannerHome = tool 'SonarQube Scanner 2.8';
+			def scannerHome = tool name: 'SonarQube Scanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation';
 			withSonarQubeEnv('SonarQube') 
 			{ 
 			// If you have configured more than one global server connection, you can specify its name
 			sh "${scannerHome}/bin/sonar-scanner -Dsonar.host.url=https://sonarqube.foodgame.fr -Dsonar.login=sqp_09ee9072c917af8212864baf0f75c950afc14c64"
 			}
 		}
+        // No need to occupy a node
+    stage("Quality Gate"){
+
+         timeout(time: 1, unit: 'HOURS') { // Just in case something goes wrong, pipeline will be killed after a timeout
+         def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv
+
+       if (qg.status != 'OK') {
+      error "Pipeline aborted due to quality gate failure: ${qg.status}"
+          }
+  }
+}
 	
 
     stage('Build Docker MEAN Stack(PreProduction Deployment)')