@@ -251,12 +251,38 @@ above](#which-is-evaluated-first-module-bazel-or-workspace)), or use a target
251251pattern (like ` bazel fetch @foo//:bar ` ) to fetch all transitive dependencies of
252252` @foo//:bar ` (this is equivalent to ` bazel build --nobuild @foo//:bar ` ).
253253
254- The make sure no fetches happen during a build, use ` --nofetch ` . More precisely,
254+ To make sure no fetches happen during a build, use ` --nofetch ` . More precisely,
255255this makes any attempt to run a non-local repository rule fail.
256256
257257If you want to fetch repos _ and_ modify them to test locally, consider using
258258the [ ` bazel vendor ` ] ( vendor ) command.
259259
260+ ### How do I insulate my builds from the Internet?
261+
262+ Here are some websites on the publicly accessible Internet that a typical Bazel
263+ build relies on, and what you can do to insulate yourself from potential
264+ outages, especially as an enterprise Bazel user.
265+
266+ * ` releases.bazel.build ` : Bazelisk downloads Bazel release binaries from this
267+ website. You can [ configure Bazelisk] [ bazelisk-config ] to have it download
268+ from your company's internal mirror instead.
269+ * ` bcr.bazel.build ` : Bazel consults the BCR for module metadata during module
270+ resolution. You can mirror the BCR itself and set the ` --registry ` flag to
271+ remove your dependency on BCR serving infrastructure (see the
272+ [ disclaimer] [ bcr-disclaimer ] for more information). Alternatively, you can
273+ ensure your MODULE.bazel.lock file is up to date, and set up your CI or
274+ developer machines with a prepopulated download cache
275+ (` --repository_cache ` ). If properly set up, the download cache will contain
276+ all necessary registry files needed for a build, and the lockfile will
277+ contain their checksums; Bazel will then use the cached results and avoid
278+ Internet access altogether during module resolution.
279+ * ` mirror.bazel.build ` and ` github.com ` : Many modules have source archives
280+ hosted on these two websites. Consider setting up a company-internal mirror
281+ for source archives, and use either ` --downloader_config ` or
282+ ` --module_mirrors ` to point Bazel at them. Alternatively, a prepopulated
283+ download cache as mentioned in the previous bullet point will also help
284+ Bazel completely avoid accessing the Internet for source archives.
285+
260286### How do I use HTTP proxies?
261287
262288Bazel respects the ` http_proxy ` and ` HTTPS_PROXY ` environment variables commonly
@@ -326,4 +352,5 @@ fetched](https://github.com/bazelbuild/bazel/discussions/20464).
326352[ npm-semver ] : https://docs.npmjs.com/about-semantic-versioning
327353[ cargo-semver ] : https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#version-requirement-syntax
328354[ go_deps ] : https://github.com/bazel-contrib/rules_go/blob/master/docs/go/core/bzlmod.md#specifying-external-dependencies
329-
355+ [ bazelisk-config ] : https://github.com/bazelbuild/bazelisk?tab=readme-ov-file#where-does-bazelisk-get-bazel-from
356+ [ bcr-disclaimer ] : https://github.com/bazelbuild/bazel-central-registry?tab=readme-ov-file#disclaimer
0 commit comments