-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
netrc doesn't work with UrlRewriter #13111
Comments
Also see #13822 |
I just ran into this today when trying out Thank you for putting up a PR to fix this, hopefully someone from Google will have time to review it soon. |
@bazel-io fork 5.1 |
This is fixed by #14066 |
Addresses bazelbuild#13111 Closes bazelbuild#14066. PiperOrigin-RevId: 424854105 (cherry picked from commit 1e53b1f)
Description of the problem / feature request:
When you have a ~/.netrc file with this content:
And
build --experimental_downloader_config=.bazel_download_config
with content of. bazel_download_config
as following:WORKSPACE
http_archive fails with
401
.The reason it fails is because
use_netrc
from repo/utils.bzl creates map with auth headers using hosts fromurls
param ofhttp_archive
. In this case netrc doesn't have gitbub.com, hence maps comes back empty. And download fails with 401.On other hand, if I try to "workaround" problem and add
github.com
intonetrc
, thenuse_netrc
will return map with one entry that corresponds to github.com.bazel/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/DownloadManager.java
Lines 101 to 105 in 9804ba5
first rewrite urls, therefore
https://github.com/bazelbuild/buildtools/archive/840218fa3afc7e7145c1eeb3bfeb612c497e67f7.zip
becomeshttps://my.corp.com/artifactory/bazelbuild/buildtools/archive/840218fa3afc7e7145c1eeb3bfeb612c497e67f7.zip
. Thencom.google.devtools.build.lib.bazel.repository.downloader.HttpConnectorMultiplexer#getHeaderFunction
tries to extract headers based on the URL. At this point URL ishttps://my.corp.com/artifactory/bazelbuild/buildtools/archive/840218fa3afc7e7145c1eeb3bfeb612c497e67f7.zip
, hence function returns empty map and no auth headers added to the http request.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
see above
What operating system are you running Bazel on?
macOS
What's the output of
bazel info release
?release 4.0.0
The solution I propose is to modify
use_netrc
Starlark function to return map of auth headers based on.netrc
file alone, i.e. don't filter it byurls
supplied.The text was updated successfully, but these errors were encountered: