nsc bazel setup
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
nsc bazel setup [--bazelrc <path>] \
[--command <command>] \
[--disable_build_events] \
[--enable_remote_asset_api] \
[--key <name>] \
[--output <plain|json>] \
[--remote] \
[--static] \
[--static_token_duration <duration>] \
[--token <path>]Example
The following example provisions an execution cluster and runs a build against it.
$ nsc bazel setup --bazelrc=~/.namespace.bazelrcNext, let's use the generated configuration
$ bazel --bazelrc=~/.namespace.bazelrc build //...To configure cache access only, without remote execution:
$ nsc bazel setup --remote=false --bazelrc /etc/bazel.bazelrcOptions
--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 to default. 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 of plain or json. Defaults to plain.
--remote
Whether to configure remote execution. Defaults to true. 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