feat: try fix ci/cd

This commit is contained in:
leon-morival 2025-11-30 16:58:37 +01:00
parent 37ed8d5f6a
commit f17a561cd2
1 changed files with 21 additions and 2 deletions

View File

@ -70,8 +70,27 @@ deploy-to-portainer:
- envsubst < docker-compose.prod.yml > docker-compose.rendered.yml
- |
echo "🔍 Recherche de la stack '$PORTAINER_STACK_NAME' dans Portainer..."
STACKS_JSON=$(curl -s -H "X-API-Key: $PORTAINER_API_KEY" "$PORTAINER_URL/api/stacks")
echo "🔍 Vérif des variables Portainer..."
echo "PORTAINER_URL=$PORTAINER_URL"
echo "PORTAINER_ENDPOINT_ID=$PORTAINER_ENDPOINT_ID"
echo "PORTAINER_STACK_NAME=$PORTAINER_STACK_NAME"
echo "🔍 Test de connexion à $PORTAINER_URL/api/stacks ..."
RESP=$(curl -s -w "HTTPSTATUS:%{http_code}" -H "X-API-Key: $PORTAINER_API_KEY" "$PORTAINER_URL/api/stacks")
BODY=$(echo "$RESP" | sed -e 's/HTTPSTATUS:.*//g')
STATUS=$(echo "$RESP" | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
echo "➡️ HTTP status: $STATUS"
echo "➡️ Body: $BODY"
if [ "$STATUS" != "200" ]; then
echo "❌ Erreur HTTP $STATUS en appelant l'API Portainer. Vérifie PORTAINER_URL / le port / l'accessibilité."
exit 1
fi
echo "✅ Connexion Portainer OK, on continue..."
STACKS_JSON="$BODY"
STACK_ID=$(echo "$STACKS_JSON" | jq ".[] | select(.Name == \"$PORTAINER_STACK_NAME\") | .Id")
if [ -z "$STACK_ID" ]; then