fix: healthcheck - detect empty PS_DOMAIN and extend timeout to 10min
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
syoul
2026-03-17 13:26:07 +01:00
parent f39c57bd5a
commit b17062f9af

View File

@@ -71,6 +71,8 @@ steps:
- cd /opt/prestashop && docker compose ps - cd /opt/prestashop && docker compose ps
# Etape 4 : Healthcheck post-deploiement # Etape 4 : Healthcheck post-deploiement
# PS_DOMAIN n'est pas sensible, passe en valeur directe pour eviter
# les problemes d'injection de secret dans les blocs multilignes
healthcheck: healthcheck:
image: curlimages/curl:8.11.0 image: curlimages/curl:8.11.0
environment: environment:
@@ -78,20 +80,25 @@ steps:
from_secret: PS_DOMAIN from_secret: PS_DOMAIN
commands: commands:
- | - |
echo "Attente du demarrage de PrestaShop (max 6 minutes)..." TARGET="http://${PS_DOMAIN}"
MAX=36 if [ -z "${PS_DOMAIN}" ]; then
echo "ERREUR: PS_DOMAIN non defini, verifier le secret Woodpecker"
exit 1
fi
echo "Healthcheck sur ${TARGET} (max 10 minutes)..."
MAX=60
i=0 i=0
until [ $i -ge $MAX ]; do until [ $i -ge $MAX ]; do
HTTP_CODE=$(curl -sSo /dev/null -w "%{http_code}" "http://${PS_DOMAIN}" 2>/dev/null || echo "000") HTTP_CODE=$(curl -sSo /dev/null -w "%{http_code}" "${TARGET}" 2>/dev/null)
echo "Tentative $((i+1))/${MAX} - HTTP ${HTTP_CODE}" echo "Tentative $((i+1))/${MAX} - HTTP ${HTTP_CODE}"
if [ "${HTTP_CODE}" = "200" ] || [ "${HTTP_CODE}" = "301" ] || [ "${HTTP_CODE}" = "302" ]; then if [ "${HTTP_CODE}" = "200" ] || [ "${HTTP_CODE}" = "301" ] || [ "${HTTP_CODE}" = "302" ]; then
echo "PrestaShop repond correctement" echo "PrestaShop repond correctement sur ${TARGET}"
exit 0 exit 0
fi fi
i=$((i+1)) i=$((i+1))
sleep 10 sleep 10
done done
echo "ERREUR: PrestaShop ne repond pas apres 6 minutes" echo "ERREUR: PrestaShop ne repond pas apres 10 minutes"
exit 1 exit 1
# Notification en cas d'echec # Notification en cas d'echec