Make retry tool generic

This commit is contained in:
BtbN 2022-07-13 01:46:13 +02:00
parent b7ca4432e1
commit d1dd644b80
6 changed files with 19 additions and 15 deletions

View file

@ -6,17 +6,7 @@ DEST="$3"
git init "$DEST" git init "$DEST"
git -C "$DEST" remote add origin "$REPO" git -C "$DEST" remote add origin "$REPO"
RETRY_COUNTER=0 retry-tool git -C "$DEST" fetch --depth=1 origin "$REF"
MAX_RETRY=15
while [[ $RETRY_COUNTER -lt $MAX_RETRY ]]; do
timeout 120 git -C "$DEST" fetch --depth=1 origin "$REF" && break || sleep 10
RETRY_COUNTER=$(( $RETRY_COUNTER + 1 ))
echo "Retry $RETRY_COUNTER..."
done
if [[ $RETRY_COUNTER -ge $MAX_RETRY ]]; then
echo "Max retry count exceeded."
exit 1
fi
git -C "$DEST" config advice.detachedHead false git -C "$DEST" config advice.detachedHead false
git -C "$DEST" checkout FETCH_HEAD git -C "$DEST" checkout FETCH_HEAD

14
images/base/retry-tool.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
set -xe
RETRY_COUNTER=0
MAX_RETRY=15
while [[ $RETRY_COUNTER -lt $MAX_RETRY ]]; do
timeout 120 "$@" && break || sleep 10
RETRY_COUNTER=$(( $RETRY_COUNTER + 1 ))
echo "Retry $RETRY_COUNTER..."
done
if [[ $RETRY_COUNTER -ge $MAX_RETRY ]]; then
echo "Max retry count exceeded."
exit 1
fi

View file

@ -8,7 +8,7 @@ ffbuild_enabled() {
} }
ffbuild_dockerbuild() { ffbuild_dockerbuild() {
svn checkout "${SCRIPT_REPO}@${SCRIPT_REV}" lame retry-tool sh -c "rm -rf lame && svn checkout '${SCRIPT_REPO}@${SCRIPT_REV}' lame"
cd lame cd lame
autoreconf -i autoreconf -i

View file

@ -8,7 +8,7 @@ ffbuild_enabled() {
} }
ffbuild_dockerbuild() { ffbuild_dockerbuild() {
svn checkout "${SCRIPT_REPO}@${SCRIPT}" openmpt retry-tool sh -c "rm -rf openmpt && svn checkout '${SCRIPT_REPO}@${SCRIPT}' openmpt"
cd openmpt cd openmpt
local myconf=( local myconf=(

View file

@ -9,7 +9,7 @@ ffbuild_enabled() {
} }
ffbuild_dockerbuild() { ffbuild_dockerbuild() {
svn checkout --username "anonymous" --password "" "${SCRIPT_REPO}@${SCRIPT_REV}" xvid retry-tool sh -c "rm -rf xvid && svn checkout --username 'anonymous' --password '' '${SCRIPT_REPO}@${SCRIPT_REV}' xvid"
cd xvid cd xvid
cd build/generic cd build/generic

View file

@ -12,7 +12,7 @@ ffbuild_dockerstage() {
} }
ffbuild_dockerbuild() { ffbuild_dockerbuild() {
svn checkout "${SCRIPT_REPO}@${SCRIPT_REV}" zvbi retry-tool sh -c "rm -rf zvbi && svn checkout '${SCRIPT_REPO}@${SCRIPT_REV}' zvbi"
cd zvbi cd zvbi
for patch in /patches/*.patch; do for patch in /patches/*.patch; do