fix(staging): bound trusted main fetch retries

This commit is contained in:
Jesse
2026-08-06 17:40:41 +08:00
parent 02cc483b7c
commit 975f5c346d
5 changed files with 53 additions and 4 deletions
+13 -1
View File
@@ -96,7 +96,19 @@ jobs:
git init .
git remote remove origin 2>/dev/null || true
git remote add origin https://git.copse.top/root/Jyotisha.git
git fetch --no-tags origin main "$DEPLOY_SHA"
fetch_succeeded=false
for attempt in 1 2 3; do
if timeout 120 git fetch --no-tags origin main "$DEPLOY_SHA"; then
fetch_succeeded=true
break
fi
if [ "$attempt" -eq 3 ]; then
echo "trusted main fetch failed after $attempt bounded attempts" >&2
exit 1
fi
sleep $((attempt * 10))
done
[[ "$fetch_succeeded" == true ]]
git checkout --detach --force origin/main
git merge-base --is-ancestor "$DEPLOY_SHA" HEAD || { echo "staging revision is not in trusted main history" >&2; exit 1; }
+13 -1
View File
@@ -68,7 +68,19 @@ jobs:
git init .
git remote remove origin 2>/dev/null || true
git remote add origin https://git.copse.top/root/Jyotisha.git
git fetch --no-tags origin main "$DEPLOY_SHA"
fetch_succeeded=false
for attempt in 1 2 3; do
if timeout 120 git fetch --no-tags origin main "$DEPLOY_SHA"; then
fetch_succeeded=true
break
fi
if [ "$attempt" -eq 3 ]; then
echo "trusted main fetch failed after $attempt bounded attempts" >&2
exit 1
fi
sleep $((attempt * 10))
done
[[ "$fetch_succeeded" == true ]]
git checkout --detach --force origin/main
git merge-base --is-ancestor "$DEPLOY_SHA" HEAD || { echo "staging revision is not in trusted main history" >&2; exit 1; }