bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.07k stars 4.04k forks source link

How to authenticate with repository_ctx.download? How does auth work? #23481

Open grepwood opened 1 month ago

grepwood commented 1 month ago

Crossposting from https://github.com/bazelbuild/bazel/issues/7469

For the last 3 years people have been wanting to know how to achieve this. The only person who did is sitting duck and not telling anybody.

We owe this state of affair to the lackluster documentation: https://bazel.build/rules/lib/builtins/repository_ctx

auth    [dict](https://bazel.build/rules/lib/core/dict.html); default is {}
An optional dict specifying authentication information for some of the URLs.

As such I would like to ask on behalf of everyone who asked so far, to please update the documentation in that regard.

peakschris commented 1 month ago

@grepwood I believe you can use a credential helper https://github.com/bazelbuild/bazel/pull/18429

peakschris commented 1 month ago

Here is the credential helpers spec, including the api for between bazel and the helper: https://github.com/bazelbuild/proposals/blob/main/designs/2022-06-07-bazel-credential-helpers.md