From b4eb137d5822e94b82c62864a6d2896320afb823 Mon Sep 17 00:00:00 2001 From: soufiane Date: Thu, 30 Oct 2025 23:12:18 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Fix=20Jenkinsfile:=20force=20recrea?= =?UTF-8?q?te=20+=20health=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 442c3571..030eaa15 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,11 +1,13 @@ pipeline { agent any + environment { REGISTRY = "registry.wk-archi-o24a-15m-g3.fr" IMAGE_NAME = "the-tip-top-backend" } stages { + stage('Checkout') { steps { echo "📦 Récupération du code source..." @@ -17,7 +19,7 @@ pipeline { steps { echo "🐳 Construction de l’image Docker backend..." sh """ - docker build -t ${REGISTRY}/${IMAGE_NAME}:${BUILD_NUMBER} backend + docker build -t ${REGISTRY}/${IMAGE_NAME}:${BUILD_NUMBER} . docker tag ${REGISTRY}/${IMAGE_NAME}:${BUILD_NUMBER} ${REGISTRY}/${IMAGE_NAME}:latest """ } @@ -45,14 +47,26 @@ pipeline { """ } } + + stage('Health Check') { + steps { + echo "🩺 Vérification du déploiement..." + script { + def code = sh(script: "curl -s -o /dev/null -w '%{http_code}' https://api.dsp5-archi-o24a-15m-g3.fr || echo 000", returnStdout: true).trim() + if (code != "200") { + error "Le backend ne répond pas correctement (code HTTP ${code})" + } + } + } + } } post { + success { + echo "✅ Déploiement du backend réussi." + } failure { echo "❌ Échec du pipeline backend." } - success { - echo "✅ Déploiement backend réussi." - } } }