bazel setup provisions a Bazel Remote Execution cluster
for your workspace and generates a bazelrc that points Bazel at it. The generated
configuration covers the remote executor, the remote cache, credentials, and
recommended execution defaults, so a single --bazelrc flag is enough to run a
build remotely.
Pass --remote=false to configure remote caching and build events without remote
execution. This is the form used to set up Bazel caching on
its own.
Usage
Example with remote execution
The following example provisions an execution cluster and runs a build against it.1
Configure remote execution
Generate a Bazel configuration for remote execution:
2
Run a build
Use the generated configuration during a build:
Example with remote caching
The following example configures remote cache access without remote execution and uses it during a build.1
Configure remote caching
Configure remote cache access without remote execution:
2
Run a build
Use the generated cache 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.
—key
Stable identifier that disambiguates multiple parallel execution clusters for the same workspace. Defaults todefault. Use a distinct key when you want a separate cluster, for example to keep one project’s workers from sharing capacity with another.
-o, —output
Output format, one ofplain or json. Defaults to plain.
—remote
Whether to configure remote execution. Defaults totrue. Set --remote=false to configure remote caching and build events without remote execution.
—static
Use a static bearer token in--remote_header against the public endpoints, instead of issuing an mTLS client certificate. 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.
—token
Use the bearer token stored at this location for authentication instead of the default. Implies--static. Pair it with nsc bazel create-token to authenticate without an interactive login.
Related Topics
- Bazel Remote Execution - Run Bazel actions on Namespace compute
- Bazel cache - Reuse build artifacts across runs
- nsc bazel create-token - Create a revocable token for Bazel remote execution
- nsc bazel invocation list - List recent Bazel invocations