fix: acme.sh exit code capture avec set -e
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

; ACME_EXIT=$? ne fonctionnait que si acme.sh retournait 0 (premier lancement).
Avec exit 2 (skip/cert valide), set -e coupait le script avant la capture.
Correction : ACME_EXIT=0 + || ACME_EXIT=$?

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
syoul
2026-03-17 21:59:01 +01:00
parent 8168082765
commit becb1b4666

View File

@@ -84,12 +84,15 @@ steps:
# acme.sh est idempotent : skip si cert valide, renouvelle si proche expiration
# Exit 0 = emis/renouvele, exit 2 = skip (domaine inchange), autres = erreur
# --home /etc/acme.sh = volume persistant sonic_acme (sinon /root/.acme.sh non persiste)
# ; ACME_EXIT=$? ne fonctionne pas avec set -e (shell quitte si exit != 0 avant la capture)
# || ACME_EXIT=$? capture le code sans declencher set -e
ACME_EXIT=0
docker exec sonic-acme-1 /app/acme.sh \
--home /etc/acme.sh \
--issue -d "$DOMAIN" \
--webroot /usr/share/nginx/html \
--server letsencrypt \
--accountemail support+acme@asycn.io; ACME_EXIT=$?
--accountemail support+acme@asycn.io || ACME_EXIT=$?
if [ "$ACME_EXIT" -ne 0 ] && [ "$ACME_EXIT" -ne 2 ]; then
echo "ERREUR: acme.sh a echoue (exit $ACME_EXIT)"
exit 1