diff options
author | Adin Scannell <ascannell@google.com> | 2020-02-27 15:35:19 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-02-27 15:36:13 -0800 |
commit | c96bb4d2ebc6a24b3111d986c5d40574ec8ff660 (patch) | |
tree | 3d541d78a05d6427f0846560d02e709498b15bd3 /tools/images/ubuntu1604/20_bazel.sh | |
parent | 88f73699225bd50102bbacb6f78052338f205cdd (diff) |
Fix apt-get reliability issues.
This is frequently causing the core build scripts to fail. The core ubuntu
distribution will perform an auto-update at first start, which may cause the
lock file to be held. All apt-get commands may be done in a loop in order to
retry to avoid this issue. We may want to consider retrying other pieces, but
for now this should avoid the most frequent cause of build flakes.
PiperOrigin-RevId: 297704789
Diffstat (limited to 'tools/images/ubuntu1604/20_bazel.sh')
-rwxr-xr-x | tools/images/ubuntu1604/20_bazel.sh | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/images/ubuntu1604/20_bazel.sh b/tools/images/ubuntu1604/20_bazel.sh index b33e1656c..bb7afa676 100755 --- a/tools/images/ubuntu1604/20_bazel.sh +++ b/tools/images/ubuntu1604/20_bazel.sh @@ -19,7 +19,17 @@ set -xeo pipefail declare -r BAZEL_VERSION=2.0.0 # Install bazel dependencies. -apt-get update && apt-get install -y openjdk-8-jdk-headless unzip +while true; do + if (apt-get update && apt-get install -y \ + openjdk-8-jdk-headless \ + unzip); then + break + fi + result=$? + if [[ $result -ne 100 ]]; then + exit $result + fi +done # Use the release installer. curl -L -o bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh |