Skip to content

Commit 792bfa2

Browse files
authored
Merge pull request #2426 from larsewi/protoc-download-retry
Added retries to the protoc download
2 parents cb25aac + 6b15b59 commit 792bfa2

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

ci/linux-install-protobuf.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,24 @@ install_protobuf() {
2323
fi
2424

2525
zipfile="protoc-${version}-${arch}.zip"
26-
wget --quiet "$baseurl/$zipfile"
26+
27+
# Retry in case of transient errors.
28+
tries=3
29+
while [ $tries -gt 0 ]; do
30+
# -O keeps every attempt writing to the same file rather than adding a .1 suffix.
31+
status=0
32+
wget --quiet -O "$zipfile" "$baseurl/$zipfile" || status=$?
33+
if [ $status -eq 0 ]; then
34+
break
35+
fi
36+
tries=$((tries - 1))
37+
sleep 10
38+
done
39+
if [ $tries -eq 0 ]; then
40+
echo "wget failed with status $status: $baseurl/$zipfile" >&2
41+
exit 1
42+
fi
43+
2744
echo "$sha $zipfile" | sha256sum --check -
2845
# Installs bin/protoc and include/ under /usr/local.
2946
unzip -o "$zipfile" -d /usr/local

0 commit comments

Comments
 (0)