bazelbuild / bazelbuild/bazelisk

Bazelisk does not honor locally installed bazel version

Open
#89 0 comments 0 reactions 0 assignees View on GitHub
P3 type: feature request
Dominant language
Go
Stars
2.7k
Forks
424
PR merge metrics
No merged PRs in 30d

Description

On our CI docker we install Bazel version from the official Debian image,
that corresponds to the `.bazelversion` file, by using official Bazel version:

https://releases.bazel.build/1.0.0/rc2/bazel_1.0.0rc2-linux-x86_64.deb

In the same time we install bazelisk, version 1.0 on CI docker image.

If I run `bazelisk build :release` and .bazelversion is 1.0.0rc2, and locally the right version of Bazel is installed, I would expect that Bazelisk is smart enough, to use that version.

What happens, is yet another instance of Bazel is downloaded by Bazelisk:

```
davido@wizball:~/projects/gerrit$ bazel version
Build label: 1.0.0rc2
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Sep 6 12:17:09 2019 (1567772229)
Build timestamp: 1567772229
Build timestamp as int: 1567772229

davido@wizball:~/projects/gerrit$ which bazel
/usr/bin/bazel

davido@wizball:~/projects/gerrit$ cat .bazelversion
1.0.0rc2

davido@wizball:~/projects/gerrit$ bazelisk build java/com/google/gerrit/server:server
2019/09/10 21:43:16 Downloading https://releases.bazel.build/1.0.0/rc2/bazel-1.0.0rc2-linux-x86_64...
INFO: Writing tracer profile to '/home/jenkins/.cache/bazel/_bazel_jenkins/4e8644684552b40c50dc624b79e09982/command.profile.gz'
INFO: Invocation ID: 3e92d1fa-39a5-4266-a806-642073c70b89
INFO: Analyzed target //java/com/google/gerrit/server:server (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //java/com/google/gerrit/server:server up-to-date:
bazel-bin/java/com/google/gerrit/server/libserver.jar
INFO: Elapsed time: 0.625s, Critical Path: 0.21s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
```

And now yet additional Bazel version was downloaded by Bazelisk and is located here:

```
/home/davido/.cache/bazelisk/bin/bazelbuild/bazel-1.0.0rc2-linux-x86_64
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `bazelisk build :release` with `.bazelversion` set to `1.0.0rc2`, while `/usr/bin/bazel` reports that version. Inspect Bazelisk's launcher behavior and the downloaded path under `~/.cache/bazelisk/bin/bazelbuild/`. Done means the locally installed matching Bazel is honored without downloading another instance.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.