Fix Jenkinsfile syntax (clean comments)
This commit is contained in:
parent
cf4809be39
commit
91802b178b
22
Jenkinsfile
vendored
22
Jenkinsfile
vendored
|
|
@ -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 {
|
post {
|
||||||
|
|
|
||||||
3
index.js
3
index.js
|
|
@ -19,9 +19,6 @@ app.use(helmet());
|
||||||
app.use(morgan("tiny"));
|
app.use(morgan("tiny"));
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
|
||||||
app.get("/health", (req, res) => {
|
|
||||||
res.status(200).json({ status: "ok" });
|
|
||||||
});
|
|
||||||
|
|
||||||
// ✅ Route racine (pour test ou monitoring)
|
// ✅ Route racine (pour test ou monitoring)
|
||||||
app.get("/", (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user