Fix Jenkinsfile syntax (clean comments)

This commit is contained in:
soufiane 2025-11-04 15:38:00 +01:00
parent cf4809be39
commit 91802b178b
2 changed files with 1 additions and 26 deletions

24
Jenkinsfile vendored
View File

@ -100,29 +100,7 @@ pipeline {
}
}
stage('Health Check') {
steps {
echo "🩺 Vérification de létat du backend..."
script {
def domain = (env.ENV == 'dev') ? "api.dev.dsp5-archi-o24a-15m-g3.fr" :
(env.ENV == 'preprod') ? "api.preprod.dsp5-archi-o24a-15m-g3.fr" :
"api.dsp5-archi-o24a-15m-g3.fr"
def statusCode = "000"
for (int i = 1; i <= 10; i++) {
statusCode = sh(script: "curl -k -s -o /dev/null -w '%{http_code}' https://${domain}/health || echo 000", returnStdout: true).trim()
if (statusCode in ['200', '301', '302']) {
echo "✅ Backend ${env.ENV} opérationnel (HTTP ${statusCode})"
return
}
echo "⏳ Tentative ${i}/10 → HTTP ${statusCode}"
sleep 5
}
error("❌ Health check échoué - code HTTP ${statusCode}")
}
}
}
}
post {

View File

@ -19,9 +19,6 @@ app.use(helmet());
app.use(morgan("tiny"));
app.use(express.json());
app.get("/health", (req, res) => {
res.status(200).json({ status: "ok" });
});
// ✅ Route racine (pour test ou monitoring)
app.get("/", (req, res) => {