Remote execution
By default buildrules runs every action on a remote execution farm and has no local fallback; running on your own machine is an explicit opt-in. You tell Buck2 where the farm is in a file that is never committed.
Why remote by default #
Building on a farm is what makes the cache shared and the toolchains uniform: the same pinned inputs run on the same kind of worker and give the same result. The default execution platform has local execution disabled and remote execution enabled. If you have not configured a farm, loading the platform fails with a message that tells you what to set, instead of quietly compiling on your machine.
Without a farm: local mode #
[buildrules_re] mode is remote (the default, also when unset) or local; any other value is refused. Pass -c buildrules_re.mode=local (or set it in .buckconfig.local) to run every action on the machine running Buck2, for example on a CI runner. It is refused when [buck2_re_client] engine_address or cas_address, or linux_x86_64_properties, is also set, so a machine that has a farm cannot slip into running locally.
Local mode is hermetic in what it runs, not in where: the tools are the same pinned toolchains, downloaded by Buck2 and checked against their sha256, with the same command lines and inputs as on a farm. The machine supplies Buck2, its kernel and its CPU; the CPU-level platforms run on that CPU, so a test built for x86-64-v3 needs a CPU with AVX2, BMI1/BMI2, FMA and MOVBE. Cache keys do not depend on the mode.
Every [buildrules_re] key, and [buck2_re_client] engine_address and cas_address, is read from the root cell's configuration, whichever cell loads the rules: a repository that is itself a cell of another repository takes these settings from that repository's .buckconfig and .buckconfig.local, not from its own.
Connect a farm #
buildrules init writes .buckconfig.local.example and adds .buckconfig.local to .gitignore. Copy the example and fill it in:
[buck2_re_client]
engine_address = <execution endpoint>
action_cache_address = <action cache endpoint>
cas_address = <content-addressable storage endpoint>
instance_name = <instance name>
tls = true
[buildrules_re]
linux_x86_64_properties = OSFamily=Linux,ISA=x86-64,container-image=docker://<image>@sha256:<digest>| Setting | Meaning |
|---|---|
engine_address, action_cache_address, cas_address | where Buck2 sends actions, looks up cached results and stores files. Many farms use one address for all three. |
instance_name | the REAPI instance your farm serves |
tls | whether to use TLS |
linux_x86_64_properties | the exact property set of the workers that should run Linux x86_64 actions, as comma-separated key=value pairs. These are your farm's own keys; buildrules passes them through unchanged. |
The [buck2_re_client] section is standard Buck2 configuration. The [buildrules_re] section is read by buildrules_execution_platforms in your platforms/BUCK. If linux_x86_64_properties is missing or malformed, the platform fails to load and says so.
CPU levels. Your property set names the baseline, ISA=x86-64, and every compile runs on a worker that matches it. buildrules registers one more execution platform for each of x86-64-v2, x86-64-v3 and x86-64-v4, with the same properties and ISA=<level>, and a test built for a level runs on it. Your farm has to schedule on that property: a worker reports every level it reaches, so ISA=x86-64-v3 is served by v3 and v4 workers. See CPU levels.
Keep endpoints out of repositories #
- Commit
.buckconfig.local.example, with placeholders. Never commit.buckconfig.local. buildrules initadds.buckconfig.localto.gitignorefor you.- No rule, generated file or table holds an endpoint, an account or a worker property. Nothing the CLI writes depends on which farm you use.
- In CI, write
.buckconfig.localfrom your secret store before the firstbuck2command.
Check that it worked #
buck2 build //crates/hello:testThe summary line shows where actions ran:
Commands: 12 (cached: 9, remote: 3, local: 0)In the default remote mode local is always 0: there is no local executor. In local mode, actions that run are counted as local. cached counts actions whose results the farm's action cache already had; run the same build twice and the second is all cached.
What the worker needs #
- Linux on x86_64, with glibc 2.34 or newer.
libgcc_s.so.1andlibz.so.1, which the Rust compiler loads (they are not pinned yet).- Nothing else. Compilers,
node, shells and file utilities are inputs of the actions. No hostcargo,rustc,cc,nodeornpmis read.