Orcun Yeniay
Orcun Yeniay

Reputation: 11

Private Bazel registry authentication issues with GitHub

I have a private Bazel registry in my GitHub organization. I am trying to use that registry with my Bazel builds.

Calling Bazel build or query commands with my private remote Bazel registry, expecting it to run successfully:

bazel build ... --registry=https://raw.githubusercontent.com/my-org/bazel-registry/master/

With this option Bazel cannot find the module in the registry. And of course without authentication, I cannot also access this URL by just accessing it from my browser (getting 404: Not Found)

Something to mention: if I manually checkout this registry into my workspace and use the local version it works fine, it can even checkout the modules from the same GitHub space (using credentials from .netrc file)

Is this a limitation from Bazel registry handling? Should they all be public?

Thanks in advance

Upvotes: 1

Views: 189

Answers (1)

J-B-Blankenship
J-B-Blankenship

Reputation: 49

The issue from your question looks like you did not put your organization's details in the option --registry=https://raw.githubusercontent.com/my-org/bazel-registry/master/. The my-org/bazel-registry/master/ gets replaced with the following pattern: organization/repo/branch/.

This worked when I did it by setting my .bazelrc file using common --registry=https://raw.githubusercontent.com/organization/repo/branch/. To be sure, I did a bazel clean --expunge followed by a bazel build //....

My underlying authentication mechanism is SSH. If you are using SSO or another method, I would still expect this to work.

EDIT: That provides initial access, but there seems to be a bug where it is unable to find the package. I am not sure what file is missing to make the magic work with just bazel_dep. However, using bazel_dep paired with git_override makes it work.

EDIT 2: I highly recommend abandoning the idea of a private registry. If you specify the bazel_dep in conjunction with git_override, there is no need for a registry. The registry appears to be built on the idea of public only repos after much trial and error to understand what was not working (and ultimately failing).

Upvotes: 0

Related Questions