nsc cache bazel setup

Set up a remote Bazel cache.

Namespace provides high-performance Bazel caching with very low network latency between runners and the cache storage. This allows your Bazel workflows to reuse build artifacts across runs, irrespective of your chosen granularity, significantly reducing build times. cache bazel setup sets up a remote Bazel cache and generates a bazelrc to use it.

Learn more about Bazel caching →

The cache can also serve as a remote downloader for Bazel's external dependency fetches.

Usage

nsc cache bazel setup [--bazelrc <target bazelrc path>]

Example

The following example creates a remote Bazel cache and uses it during a build invocation.

$ nsc cache bazel setup --bazelrc=/tmp/bazel-cache.bazelrc

Next, let's use the generated configuration

$ bazel --bazelrc=yourown.bazelrc --bazelrc=/tmp/bazel-cache.bazelrc build //...

Options

--bazelrc

If specified, write the bazelrc to this path.

--command

The Bazel command to use in the generated bazelrc (e.g. build or common). Defaults to build.

--enable_remote_asset_api

Opt in to the remote asset API, so Bazel can route external dependency fetches through the Namespace cache via --experimental_remote_downloader.

--experimental_cache_name

If specified, request a named experimental Bazel cache backing instance.

--experimental_direct

Configure Bazel to connect directly to the cache endpoint with a freshly issued client certificate.

--static

Use a static bearer token in --remote_header instead of a credential helper. Useful for CI/CD pipelines and automation without an interactive login.

--static_token_duration

The minimum duration of the static token configured. Requires --static. Defaults to 4h.

-o, --output

Output format, one of plain or json. Defaults to plain.

Last updated