bazelbuild / bazelbuild/bazelisk
Changing BAZELISK_FORMAT_URL does not trigger re-downloading Bazel
- Dominant language
- Go
- Stars
- 2.7k
- Forks
- 424
- PR merge metrics
- No merged PRs in 30d
Description
Using `bazelisk v1.17.0`, changing `BAZELISK_FORMAT_URL` does not trigger re-downloading Bazel if the same version number of Bazel has previously been downloaded from anywhere.
```
# Start off clean
rm -f .bazelversion
rm -f .bazeliskrc
rm -rf ~/.cache/bazelisk/downloads/bazelbuild
# Download official/upstream Bazel 6.3.1
USE_BAZEL_VERSION=6.3.1 bazelisk --version
# Outputs:
# 2023/08/11 10:05:46 Downloading https://releases.bazel.build/6.3.1/release/bazel-6.3.1-linux-x86_64...
# bazel 6.3.1
# Switch to our internally-built and published URL
cat > .bazeliskrc <
USE_BAZEL_VERSION=6.3.1
EOL
bazelisk --version
# Outputs:
# bazel 6.3.1
# We expect this to download from our internal URL, but it does not
```
Workaround: we can use `BAZELISK_BASE_URL`, but then we have to conform to the usual URL format.
Changing `BAZELISK_BASE_URL` properly re-downloads - the code [here](https://github.com/bazelbuild/bazelisk/blob/70e3e87d4ca23cdbe5439685fb6d2018d69be1e5/core/core.go/#L414-L420) changes the download directory if `BaseURLEnv` is set, but not if `FormatURLEnv` is set.
Contributor guide
Research direction
Start in core/core.go around the linked lines 414-420 and reproduce the commands in the issue with BAZELISK_FORMAT_URL and BAZELISK_BASE_URL. Trace how each setting affects the download directory; done means changing BAZELISK_FORMAT_URL causes the requested Bazel version to be downloaded from the new URL instead of reusing the existing cache.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100