Skip to content

Commit 6b78cd8

Browse files
sushicwSteven Dake
authored and
Steven Dake
committed
Add retry to protoc.sh (istio#18616)
* Add retry to protoc calls * lint fix
1 parent 697d3ba commit 6b78cd8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

bin/protoc.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ if [[ $# -le 0 ]]; then
1919
exit 1
2020
fi
2121

22+
RETRY_COUNT=3
23+
2224
api=$(go list -m -f "{{.Dir}}" istio.io/api)
2325

24-
protoc -I"${REPO_ROOT}"/common-protos -I"${api}" "$@"
26+
# This occasionally flakes out, so have a simple retry loop
27+
for (( i=1; i <= RETRY_COUNT; i++ )); do
28+
protoc -I"${REPO_ROOT}"/common-protos -I"${api}" "$@" && break
29+
30+
ret=$?
31+
echo "Attempt ${i}/${RETRY_COUNT} to run protoc failed with exit code ${ret}"
32+
(( i == RETRY_COUNT )) && exit $ret
33+
done

0 commit comments

Comments
 (0)