lib: retry git fetch a few times
The instance hosting the forgejo repository may be down or very slow while the build tries to fetch from it, retry a few times instead of giving up immediately. A total retry time of 3 * 60 seconds is probably sufficient since Forgejo startup time is lower than this, even on large instances.
This commit is contained in:
parent
90e5b72123
commit
872e4632bf
1 changed files with 5 additions and 0 deletions
|
@ -25,6 +25,11 @@ fi
|
|||
if ! [[ "$ref" =~ ^refs/ ]] ; then
|
||||
ref=refs/heads/$ref
|
||||
fi
|
||||
for retry in 1 2 3 ; do
|
||||
timeout 15m git fetch --update-head-ok origin +$ref:$ref && break
|
||||
echo "Retry git fetch in 60 seconds"
|
||||
sleep 60
|
||||
done
|
||||
git fetch --update-head-ok origin +$ref:$ref
|
||||
git switch --force-create $v $ref
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue