Kokoro: Retry gclient sync
Network IO appears to flake. Try up to 5 times before giving up. Change-Id: I1c58e2b603495835d2410a1256aa70c0fe10ee98 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49340 Kokoro: Kokoro <noreply+kokoro@google.com> Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
5bdece5583
commit
70c8a96cd8
|
@ -38,6 +38,21 @@ function status {
|
|||
echo ""
|
||||
task_begin $@
|
||||
}
|
||||
function with_retry {
|
||||
local MAX_ATTEMPTS=5
|
||||
local RETRY_DELAY_SECS=5
|
||||
local ATTEMPT=1
|
||||
while true; do
|
||||
"$@" && break
|
||||
if [[ $ATTEMPT -ge $MAX_ATTEMPTS ]]; then
|
||||
echo "The command has failed after $ATTEMPT attempts."
|
||||
exit $?
|
||||
fi
|
||||
((ATTEMPT++))
|
||||
echo "'$@' failed. Attempt ($ATTEMPT/$MAX_ATTEMPTS). Retrying..."
|
||||
sleep $RETRY_DELAY_SECS;
|
||||
done
|
||||
}
|
||||
|
||||
ORIGINAL_SRC_DIR="$(pwd)"
|
||||
|
||||
|
@ -55,7 +70,7 @@ git clone ${ORIGINAL_SRC_DIR} .
|
|||
|
||||
status "Fetching dependencies"
|
||||
cp standalone.gclient .gclient
|
||||
gclient sync
|
||||
with_retry gclient sync
|
||||
|
||||
status "Configuring build system"
|
||||
if [ "$BUILD_SYSTEM" == "cmake" ]; then
|
||||
|
|
Loading…
Reference in New Issue