Buck2
Configure Buck2 to use NativeLink for remote cache and execution.
Before you start
A running NativeLink instance. If you don't have one, start with the Quickstart.
Buck2 has a native Remote Execution API client. NativeLink can serve the CAS, Action Cache, capabilities, and execution services that Buck2 expects.
The repo includes a runnable Buck2 integration test at
integration_tests/buck2/.
It starts NativeLink with a combined scheduler and local worker, runs
buck2 build //..., and checks for BUILD SUCCEEDED.
Start NativeLink
Use a config that exposes these services on localhost:50051:
- CAS
- Action Cache
- execution
- capabilities
- ByteStream
The integration test uses
integration_tests/buck2/buck2_cas.json5and instance name main.
Configure Buck2
In your Buck2 project, add .buckconfig:
[cells]
root = .
[buck2_re_client]
engine_address = localhost:50051
action_cache_address = localhost:50051
cas_address = localhost:50051
tls = false
instance_name = main
[build]
execution_platforms = root//platforms:platformsThe checked-in integration test uses the same settings in integration_tests/buck2/.buckconfig.
Register an execution platform
Buck2 needs an execution platform that allows remote actions. The
integration test registers one with remote_enabled = true and
local_enabled = true:
platform = ExecutionPlatformInfo(
label = ctx.label.raw_target(),
configuration = configuration,
executor_config = CommandExecutorConfig(
local_enabled = True,
remote_enabled = True,
use_limited_hybrid = True,
remote_execution_properties = {},
remote_execution_use_case = "buck2-default",
remote_output_paths = "output_paths",
),
)See
integration_tests/buck2/platforms/defs.bzlfor the complete rule.
Run a build
buck2 build //...The integration test uses a small staged build graph that mixes local-only
and remote-capable actions, then verifies the output with diff. That shape
is useful when validating a new cluster because it proves both upload and
download paths are working.
Troubleshooting
- Buck2 cannot connect. Confirm NativeLink is listening on
50051and Buck2 is not expecting TLS. - Everything runs locally. Check that your selected execution platform
sets
remote_enabled = True. - Instance-name errors. Make sure Buck2's
instance_namematches the NativeLink config. The integration test usesmain.
FAQ
Buck2 is talking to the cache on one machine. The step that makes it worth the setup is the same cache answering for everyone.