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." - } } }