From 8d0b0e24ba422fbffce90d48eab197374165253d Mon Sep 17 00:00:00 2001 From: soufiane Date: Thu, 30 Oct 2025 23:38:09 +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 | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 83fbe78b..d1abbbe4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,11 +3,9 @@ pipeline { environment { REGISTRY_URL = "registry.wk-archi-o24a-15m-g3.fr" - IMAGE_NAME = "the-tip-top-frontend" - CONTAINER_NAME = "the-tip-top-frontend" + IMAGE_NAME = "the-tip-top-backend" DEPLOY_PATH = "/srv/devops/the-tip-top" - DOMAIN = "dsp5-archi-o24a-15m-g3.fr" - API_URL = "https://api.${DOMAIN}" + DOMAIN = "api.dsp5-archi-o24a-15m-g3.fr" } stages { @@ -18,23 +16,9 @@ pipeline { } } - stage('Install dependencies') { - steps { - echo "📦 Installation des dépendances NPM..." - sh 'npm ci' - } - } - - stage('Build Next.js') { - steps { - echo "⚙️ Compilation de l’application Next.js (production)..." - sh 'npm run build' - } - } - stage('Build Docker image') { steps { - echo "🐳 Construction de l’image Docker frontend..." + echo "🐳 Construction de l’image Docker backend..." sh ''' docker build -t ${REGISTRY_URL}/${IMAGE_NAME}:${BUILD_NUMBER} . docker tag ${REGISTRY_URL}/${IMAGE_NAME}:${BUILD_NUMBER} ${REGISTRY_URL}/${IMAGE_NAME}:latest @@ -57,7 +41,7 @@ pipeline { stage('Deploy') { steps { - echo "🚀 Déploiement du frontend..." + echo "🚀 Déploiement du backend..." sh ''' if [ ! -f ${DEPLOY_PATH}/docker-compose.yml ]; then echo "❌ Fichier docker-compose.yml introuvable dans ${DEPLOY_PATH}" @@ -65,15 +49,15 @@ pipeline { fi cd ${DEPLOY_PATH} - docker compose pull frontend - docker compose up -d --force-recreate frontend + docker compose pull backend + docker compose up -d --force-recreate backend ''' } } stage('Health Check') { steps { - echo "🩺 Vérification du frontend après déploiement..." + echo "🩺 Vérification du backend après déploiement..." script { def maxRetries = 10 def statusCode = "000" @@ -85,7 +69,7 @@ pipeline { ).trim() if (statusCode == '200') { - echo "✅ Frontend opérationnel (HTTP ${statusCode}) après ${i} essai(s)" + echo "✅ Backend opérationnel (HTTP ${statusCode}) après ${i} essai(s)" break } else { echo "⏳ Tentative ${i}/${maxRetries} → HTTP ${statusCode}" @@ -103,10 +87,10 @@ pipeline { post { success { - echo "✅ Pipeline frontend terminé avec succès !" + echo "✅ Pipeline backend terminé avec succès !" } failure { - echo "❌ Échec du pipeline frontend." + echo "❌ Échec du pipeline backend." } } }