diff --git a/.woodpecker.yml b/.woodpecker.yml index 3ea84da..8d9969a 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -74,20 +74,20 @@ steps: commands: - apk add --no-cache --quiet curl - | - PS_DOMAIN=$(grep '^PS_DOMAIN=' .env.deploy | cut -d= -f2) - if [ -z "${PS_DOMAIN}" ]; then + SITE=$(grep '^PS_DOMAIN=' .env.deploy | cut -d= -f2) + if [ -z "$SITE" ]; then echo "ERREUR: PS_DOMAIN non defini dans .env.deploy" exit 1 fi - TARGET="http://${PS_DOMAIN}" - echo "Healthcheck sur ${TARGET} (max 10 minutes)..." + TARGET="http://$SITE" + 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}" "${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 sur ${TARGET}" + CODE=$(curl -sSo /dev/null -w "%{http_code}" "$TARGET" 2>/dev/null) + echo "Tentative $((i+1))/$MAX - HTTP $CODE" + if [ "$CODE" = "200" ] || [ "$CODE" = "301" ] || [ "$CODE" = "302" ]; then + echo "PrestaShop repond correctement sur $TARGET" exit 0 fi i=$((i+1))