How to Stop Bazel From Accessing the Internet

165 views
Skip to first unread message

Eric Stoces

unread,
Feb 27, 2025, 5:18:03 PM2/27/25
to bazel-discuss
How do I stop Bazel from trying to access the internet for packages. I have a hosted bazel-central-registry, and that works.  But now I'm trying to use Bazel with Python and cannot stop it from failing to access pythonhosted.org. Thanks in advance.

> bazel run //:requirements.update


compile_pip_requirements(
name = "requirements",
extra_args = [
],
requirements_in = "requirements.txt",
requirements_txt = "requirements_lock.txt",
)

David Neil

unread,
Mar 2, 2025, 5:02:24 PM3/2/25
to bazel-discuss
I've never tried to use these, but:
The `block-network` and `require-network` tags/execution-requirements can control this for individual sandboxes, and the default can be controlled with the flag `--sandbox_default_allow_network` / `--nosandbox_default_allow_network`.

Manuel

unread,
Mar 3, 2025, 1:29:42 AM3/3/25
to David Neil, bazel-discuss

Your issue report is very vague, you should provide more than what you're running and the failure, at least you should provide some lines of context on what your execution did.
Anyway it looks like it failed during the build stage of your binary, you want to the use the downloader rewrite feature https://bazel.build/reference/command-line-reference#flag--experimental_downloader_config, which is marked as experimental at least since Bazel 4 if not way before.
The way I use this flag is my first statement is block * and then do an allow for our domain and add a bunch of rewrite rules


--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/bazel-discuss/621dd424-d8b8-4b0c-a4ae-278d727c69cfn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages