diff --git a/.woodpecker.yml b/.woodpecker.yml index 3c59685..277779d 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -71,6 +71,8 @@ steps: - cd /opt/prestashop && docker compose ps # 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: image: curlimages/curl:8.11.0 environment: @@ -78,20 +80,25 @@ steps: from_secret: PS_DOMAIN commands: - | - echo "Attente du demarrage de PrestaShop (max 6 minutes)..." - MAX=36 + TARGET="http://${PS_DOMAIN}" + 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 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}" if [ "${HTTP_CODE}" = "200" ] || [ "${HTTP_CODE}" = "301" ] || [ "${HTTP_CODE}" = "302" ]; then - echo "PrestaShop repond correctement" + echo "PrestaShop repond correctement sur ${TARGET}" exit 0 fi i=$((i+1)) sleep 10 done - echo "ERREUR: PrestaShop ne repond pas apres 6 minutes" + echo "ERREUR: PrestaShop ne repond pas apres 10 minutes" exit 1 # Notification en cas d'echec