Skip to content
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

go_download_sdk does not support .netrc #2560

Closed
GabrielGhe opened this issue Jul 9, 2020 · 2 comments
Closed

go_download_sdk does not support .netrc #2560

GabrielGhe opened this issue Jul 9, 2020 · 2 comments

Comments

@GabrielGhe
Copy link

What version of rules_go are you using?

v0.22.6

What version of gazelle are you using?

Not using gazelle

What version of Bazel are you using?

Build label: 2.0.1

Does this issue reproduce with the latest releases of all the above?

If I want to use go_download_sdk with a url that requires a .netrc, I get 401 Unauthorized.

What operating system and processor architecture are you using?

ubuntu16.04 x86

Any other potentially useful information about your toolchain?

No

What did you do?

load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_register_toolchains", "go_rules_dependencies")

go_download_sdk(
    name = "go_sdk",
    urls = ["https://<internal_url>.<companyname>.com/{}"],
    sdks = {
        "linux_amd64": ("go1.14.4.linux-amd64.tar.gz", <sha256>),
        "linux_arm64": ("go1.14.4.linux-arm64.tar.gz", <sha256>),
    },
)

go_rules_dependencies()
go_register_toolchains()

What did you expect to see?

That the go_download_sdk passes.

What did you see instead?

401 Unauthorized

@jayconrod
Copy link
Contributor

go_download_sdk uses repository_ctx.download_and_extract to fetch these archives. I think that method would be the right place to support .netrc, so please consider opening an issue at bazelbuild/bazel for this.

It may be possible to read .netrc, parse it in Starlark, then pass credentials to download_and_extract through the auth parameter. I'd rather not add that complexity to go_download_sdk though. Maybe you can implement a custom repository rule that does this, then call go_wrap_sdk to configure it?

@GabrielGhe
Copy link
Author

You're right. The approach we took was to use http_archive which supports .netrc, and then go_wrap_sdk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants