Mise à jour de index.js

This commit is contained in:
soufiane 2025-11-03 22:34:51 +01:00
parent f2afdaaff7
commit 4c687bdcab

8
Jenkinsfile vendored
View File

@ -156,6 +156,7 @@ pipeline {
/* ───────────────────────────────
* 8⃣ Vérification de santé (via /health)
* ─────────────────────────────── */
* ─────────────────────────────── */
stage('Health Check') {
steps {
echo "🩺 Vérification du backend après déploiement..."
@ -166,14 +167,7 @@ pipeline {
def statusCode = "000"
for (int i = 1; i <= 10; i++) {
// 🔍 Essaie d'abord /health
statusCode = sh(script: "curl -k -s -o /dev/null -w '%{http_code}' https://${domain}/health || echo 000", returnStdout: true).trim()
// 🔁 Si /health renvoie 404, teste /
if (statusCode == '404') {
statusCode = sh(script: "curl -k -s -o /dev/null -w '%{http_code}' https://${domain}/ || echo 000", returnStdout: true).trim()
}
if (statusCode in ['200', '301', '302']) {
echo "✅ Backend ${env.ENV} opérationnel (HTTP ${statusCode})"
return