bazelbuild / bazelbuild/bazelisk
`bazelisk version` fails to use HTTP proxy settings on linux
- Dominant language
- Go
- Stars
- 2.7k
- Forks
- 424
- PR merge metrics
- No merged PRs in 30d
Description
I'm currently working from a server that requires using an HTTP proxy to access resources on the public internet. This means that to use bazelisk successfully, I need to make sure all traffic goes through that proxy. However, when running a basic bazelisk command, I get the following error:
```
$ bazelisk version
2024/10/01 10:50:58 could not download Bazel: could not resolve the version 'latest' to an actual version number: unable to determine latest version: could not list Bazel versions in GCS bucket: could not list GCS objects at https://www.googleapis.com/storage/v1/b/bazel/o?delimiter=/: could not fetch https://www.googleapis.com/storage/v1/b/bazel/o?delimiter=/: unable to complete request to https://www.googleapis.com/storage/v1/b/bazel/o?delimiter=/ within 30s
```
This suggests that the HTTP proxy is not being respected in the google storage APIs, as I'm able to CURL that URL just fine:
```
$ curl https://www.googleapis.com/storage/v1/b/bazel/o\?delimiter\=/
{
"kind": "storage#objects",
"prefixes": [
"0.1.0/",
"0.1.1/",
"0.1.2/",
"0.1.3/",
[...]
```
But unsetting the `http_proxy` and `https_proxy` environment variables fails the same way. If on the other hand I specify the bazel version (or add a .bazelversion file), it downloads the bazel version without issue and runs:
```
$ USE_BAZEL_VERSION=7.3.1 bazelisk version
2024/10/01 10:47:33 Downloading https://releases.bazel.build/7.3.1/release/bazel-7.3.1-linux-x86_64...
Downloading: 68 MB out of 68 MB (100%)
Bazelisk version: v1.21.0
WARNING: Invoking Bazel in batch mode since it is not invoked from within a workspace (below a directory having a WORKSPACE file).
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Build label: 7.3.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Aug 19 16:12:50 2024 (1724083970)
Build timestamp: 1724083970
Build timestamp as int: 1724083970
``
Contributor guide
Research direction
Start from the `bazelisk version` entry point and trace the Google Cloud Storage API request used to resolve `latest`. Reproduce with `http_proxy` and `https_proxy` set, comparing the request with the working curl command. Done means version lookup succeeds through the configured HTTP proxy while fixed-version downloads continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100