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
Example
The following example creates a remote Bazel cache and uses it during a build invocation.1
Configure the remote cache
Generate a Bazel configuration for the remote cache:
2
Run a build
Use the generated configuration during a 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.
—disable_build_events
If specified, do not configure Bazel to send build events to Namespace.—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 ofplain or json. Defaults to plain.
—token
Use the bearer token stored at this location for authentication instead of the default. Implies--static.