Skip to content

Commit bee60a8

Browse files
konstantin-s-bogoma-nogikh
authored andcommitted
tools/docker: install bazelisk instead of bazel
The needed Bazel version to build gVisor got bumped. However, instead of doing the same bump in two places whenever this happens, we can simply use bazelisk in syzkaller to determine which bazel version to use automatically.
1 parent 1e8c392 commit bee60a8

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

pkg/build/build.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func compilerIdentity(compiler string) (string, error) {
192192
arg, timeout := "--version", time.Minute
193193
if bazel {
194194
// Bazel episodically fails with 1 min timeout.
195-
arg, timeout = "", 10*time.Minute
195+
timeout = 10 * time.Minute
196196
}
197197
output, err := osutil.RunCmd(timeout, "", compiler, arg)
198198
if err != nil {
@@ -210,6 +210,9 @@ func compilerIdentity(compiler string) (string, error) {
210210
if strings.HasPrefix(line, "WARNING: ") {
211211
continue
212212
}
213+
if strings.Contains(line, "Downloading https://releases.bazel") {
214+
continue
215+
}
213216
}
214217

215218
return strings.TrimSpace(line), nil

tools/docker/syzbot/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@ RUN apt-get install -y -q --no-install-recommends clang-15
6161
# Not really GRTE, but it's enough to run some scripts that hardcode the path.
6262
RUN mkdir -p /usr/grte/v5/bin && ln -s /usr/bin/python3 /usr/grte/v5/bin/python2.7
6363

64-
# Install bazel
65-
# Download the official bazel binary. The APT repository isn't used because there is not packages for arm64.
66-
RUN sh -c 'curl -o /usr/local/bin/bazel https://releases.bazel.build/7.1.2/release/bazel-7.1.2-linux-$(uname -m | sed s/aarch64/arm64/) && chmod ugo+x /usr/local/bin/bazel'
64+
# Install bazelisk
65+
RUN curl -s https://api.github.com/repos/bazelbuild/bazelisk/releases/latest \
66+
| sed -n '/browser_download_url/s/[^:]*:[^"]*\("[^"]*"\).*/url = \1/p' \
67+
| grep bazelisk-linux-$(uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) \
68+
| curl -L -o /usr/local/bin/bazel -K - \
69+
&& chmod +x /usr/local/bin/bazel
6770

6871
# Install qemu from the backports.
6972
# The currently stable version (7.2) cannot properly run arm64-MTE kernels.

0 commit comments

Comments
 (0)