fix(staging): bound trusted main fetch retries
This commit is contained in:
@@ -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; }
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user