will it work

pull/30628/head
Justin Newberry 2 years ago
parent 31ab43ce41
commit ff1a7a81a7
  1. 7
      release/build_devel.sh
  2. 23
      scripts/retry.sh

@ -22,8 +22,11 @@ pre-commit uninstall || true
echo "[-] bringing master-ci and devel in sync T=$SECONDS" echo "[-] bringing master-ci and devel in sync T=$SECONDS"
cd $TARGET_DIR cd $TARGET_DIR
git fetch --depth 1 origin master-ci
git fetch --depth 1 origin devel source scripts/retry.sh
retry git fetch --depth 1 origin master-ci
retry git fetch --depth 1 origin devel
git checkout -f --track origin/master-ci git checkout -f --track origin/master-ci
git reset --hard master-ci git reset --hard master-ci

@ -0,0 +1,23 @@
#!/bin/bash
function fail {
echo $1 >&2
exit 1
}
function retry {
local n=1
local max=3 # 3 retries before failure
local delay=5 # delay between retries, 5 seconds
while true; do
echo "Running command '$@' with retry, attempt $n/$max"
"$@" && break || {
if [[ $n -lt $max ]]; then
((n++))
sleep $delay;
else
fail "The command has failed after $n attempts."
fi
}
done
}
Loading…
Cancel
Save