From af414beabd5313c1a36f80f6c165f0682074179d Mon Sep 17 00:00:00 2001 From: msaid-soighiri Date: Fri, 29 May 2026 11:32:49 +0200 Subject: [PATCH 1/3] Actualiser .gitea/workflows/ci.yml --- .gitea/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 2c65448..f3cb3f4 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -104,6 +104,10 @@ jobs: echo "--- 4. Envoi à Portainer ---" RESPONSE=$(curl -s -k \ + --max-time 300 # attend jusqu'à 5 minutes + --retry 3 # réessaie 3 fois si échec + --retry-delay 10 # attend 10 secondes entre chaque tentative + --retry-all-errors # réessaie même sur les erreurs 5xx comme le 504 -o response_body.json \ -w "%{http_code}" \ -X PUT "${PORTAINER_API}/stacks/${STACK_ID}?endpointId=${ENDPOINT_ID}" \ From 9b3e31fec776bb7cce06b3476b7295eb6fcbf6ef Mon Sep 17 00:00:00 2001 From: msaid-soighiri Date: Fri, 29 May 2026 11:41:14 +0200 Subject: [PATCH 2/3] Actualiser .gitea/workflows/ci.yml --- .gitea/workflows/ci.yml | 39 +++++++-------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index f3cb3f4..62e18cc 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -63,9 +63,7 @@ jobs: run: | echo "--- 1. Authentification ---" printf '{"username":"%s","password":"%s"}' "${{ secrets.PORTAINER_USER }}" "${{ secrets.PORTAINER_PASS }}" > auth.json - TOKEN=$(curl -s -k -X POST "${PORTAINER_API}/auth" \ - -H "Content-Type: application/json" \ - -d @auth.json | grep -o '"jwt":"[^"]*"' | cut -d'"' -f4) + TOKEN=$(curl -s -k -X POST "${PORTAINER_API}/auth" -H "Content-Type: application/json" -d @auth.json | grep -o '"jwt":"[^"]*"' | cut -d'"' -f4) rm -f auth.json if [ -z "$TOKEN" ]; then @@ -75,54 +73,31 @@ jobs: echo "Authentification réussie" echo "--- 2. Récupération des IDs ---" - ENDPOINT_ID=$(curl -s -k \ - -H "Authorization: Bearer $TOKEN" \ - "${PORTAINER_API}/endpoints" \ - | grep -o '"Id":[0-9]*,"Name":"myportainer-cgy-dev"' \ - | grep -o '[0-9]*' | head -n 1) + ENDPOINT_ID=$(curl -s -k -H "Authorization: Bearer $TOKEN" "${PORTAINER_API}/endpoints" | grep -o '"Id":[0-9]*,"Name":"myportainer-cgy-dev"' | grep -o '[0-9]*' | head -n 1) echo "Endpoint ID : $ENDPOINT_ID" - STACK_ID=$(curl -s -k \ - -H "Authorization: Bearer $TOKEN" \ - "${PORTAINER_API}/stacks" \ - | grep -o '"Id":[0-9]*,"Name":"gitea-action-dev"' \ - | grep -o '[0-9]*' | head -n 1) + STACK_ID=$(curl -s -k -H "Authorization: Bearer $TOKEN" "${PORTAINER_API}/stacks" | grep -o '"Id":[0-9]*,"Name":"gitea-action-dev"' | grep -o '[0-9]*' | head -n 1) echo "Stack ID : $STACK_ID" echo "--- 3. Génération du Payload ---" node -e ' const fs = require("fs"); const compose = fs.readFileSync("docker-compose.yml", "utf8"); - const payload = { - stackFileContent: compose, - pullImage: true, - prune: true - }; + const payload = { stackFileContent: compose, pullImage: true, prune: true }; fs.writeFileSync("payload.json", JSON.stringify(payload)); console.log("Payload size:", JSON.stringify(payload).length, "bytes"); ' echo "--- 4. Envoi à Portainer ---" - RESPONSE=$(curl -s -k \ - --max-time 300 # attend jusqu'à 5 minutes - --retry 3 # réessaie 3 fois si échec - --retry-delay 10 # attend 10 secondes entre chaque tentative - --retry-all-errors # réessaie même sur les erreurs 5xx comme le 504 - -o response_body.json \ - -w "%{http_code}" \ - -X PUT "${PORTAINER_API}/stacks/${STACK_ID}?endpointId=${ENDPOINT_ID}" \ - -H "Authorization: Bearer ${TOKEN}" \ - -H "Content-Type: application/json" \ - -d @payload.json) + RESPONSE=$(curl -s -k --max-time 300 --retry 3 --retry-delay 10 --retry-all-errors -o response_body.json -w "%{http_code}" -X PUT "${PORTAINER_API}/stacks/${STACK_ID}?endpointId=${ENDPOINT_ID}" -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" -d @payload.json) echo "HTTP Code : $RESPONSE" - echo "Réponse Portainer :" cat response_body.json if [ "$RESPONSE" = "200" ]; then - echo "DEPLOIEMENT REUSSI - Frontend: 3026 / Backend: 8025" + echo "✅ DEPLOIEMENT REUSSI - Frontend: 3026 / Backend: 8025" else - echo "Erreur Portainer (Code HTTP $RESPONSE)" + echo "❌ ECHEC - Erreur Portainer (Code HTTP $RESPONSE)" exit 1 fi From c4d26d4019ae7f28d5a24f325c24bac215301327 Mon Sep 17 00:00:00 2001 From: msaid-soighiri Date: Fri, 29 May 2026 12:09:21 +0200 Subject: [PATCH 3/3] Actualiser .gitea/workflows/ci.yml --- .gitea/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 62e18cc..2039961 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: sed -i '/context:/d' docker-compose.yml sed -i '/dockerfile:/d' docker-compose.yml sed -i 's/8024:3024/8025:3024/g' docker-compose.yml - sed -i 's/3025:81/3026:81/g' docker-compose.yml + sed -i 's/3025:81/3027:81/g' docker-compose.yml sed -i 's/container_name: ndf-backend/container_name: gitea-ndf-backend/g' docker-compose.yml sed -i 's/container_name: ndf-frontend/container_name: gitea-ndf-frontend/g' docker-compose.yml echo "Contenu du compose après modification :" @@ -89,7 +89,7 @@ jobs: ' echo "--- 4. Envoi à Portainer ---" - RESPONSE=$(curl -s -k --max-time 300 --retry 3 --retry-delay 10 --retry-all-errors -o response_body.json -w "%{http_code}" -X PUT "${PORTAINER_API}/stacks/${STACK_ID}?endpointId=${ENDPOINT_ID}" -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" -d @payload.json) + RESPONSE=$(curl -s -k --max-time 60 --retry 3 --retry-delay 5 --retry-all-errors -o response_body.json -w "%{http_code}" -X PUT "${PORTAINER_API}/stacks/${STACK_ID}?endpointId=${ENDPOINT_ID}" -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" -d @payload.json) echo "HTTP Code : $RESPONSE" cat response_body.json