From a4153b855499e8f965a09633480b57f3c4b3bb7f Mon Sep 17 00:00:00 2001 From: Gabriel Radureau Date: Tue, 7 Apr 2026 08:16:15 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20fix:=20add=20race=20condition=20?= =?UTF-8?q?handling=20to=20version=20bump=20pushes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci-cd.yaml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci-cd.yaml b/.gitea/workflows/ci-cd.yaml index 739b059..cc6720b 100644 --- a/.gitea/workflows/ci-cd.yaml +++ b/.gitea/workflows/ci-cd.yaml @@ -186,9 +186,29 @@ jobs: if [ "$VERSION_BUMPED" = "true" ]; then git config --global user.name "CI Bot" git config --global user.email "ci@arcodange.fr" + + # Set up credentials using Gitea token + git config --global credential.helper store + echo "https://${{ secrets.PACKAGES_TOKEN }}@gitea.arcodange.lab" > ~/.git-credentials + git add VERSION cmd/server/main.go README.md git commit -m "chore: auto version bump [skip ci]" || echo "No changes to commit" - git push + + # Try push with retry logic for race conditions + for i in 1 2 3; do + if git push; then + echo "Successfully bumped version" + break + else + echo "Version bump push attempt $i failed, retrying..." + if [ $i -eq 3 ]; then + echo "Final version bump push attempt failed - another job may have bumped version" + git pull --rebase || true + git push || echo "Version bump recovery push also failed" + fi + sleep 2 + fi + done fi - name: Login to Gitea Container Registry