Skip to content

Commit c7fa651

Browse files
committed
chore: Implement retry logic for pushing changes in K8s manifest update workflow
1 parent d6dbfff commit c7fa651

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/update-manifest.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,18 @@ jobs:
8585
git commit -m "chore(${SERVICE_NAME}): update image to ${{ steps.info.outputs.branch }}-${{ steps.info.outputs.sha }}" \
8686
-m "Triggered by: ${{ github.event.workflow_run.html_url }}"
8787
88-
git push origin ${{ steps.info.outputs.branch }}
88+
# Retry loop for race conditions
89+
MAX_RETRIES=5
90+
for ((i=1; i<=MAX_RETRIES; i++)); do
91+
echo "🔄 Attempt $i of $MAX_RETRIES to push changes..."
92+
git pull --rebase origin ${{ steps.info.outputs.branch }}
93+
if git push origin ${{ steps.info.outputs.branch }}; then
94+
echo "✅ Push successful!"
95+
exit 0
96+
fi
97+
echo "⚠️ Push failed, retrying in roughly 5 seconds..."
98+
sleep $((RANDOM % 5 + 3))
99+
done
100+
101+
echo "❌ Failed to push changes after $MAX_RETRIES attempts."
102+
exit 1

0 commit comments

Comments
 (0)