Pants
Enable Pants remote caching with NativeLink.
Pants can read and write remote cache entries through the Remote Execution API. NativeLink can provide the remote store and Action Cache for Pants goals without changing BUILD files.
Start NativeLink
Start a NativeLink server that exposes CAS and Action Cache on
localhost:50051 with instance name main. The Docker quickstart in
Getting Started → Setup is enough for local
cache validation.
Configure Pants
Add the remote cache settings to pants.toml:
[GLOBAL]
remote_cache_read = true
remote_cache_write = true
remote_store_address = "grpc://localhost:50051"
remote_instance_name = "main"For a shared deployment, replace localhost:50051 with your NativeLink
endpoint and use the same instance name your server config exposes.
Run a goal
Run any Pants goal as usual:
pants test ::The first run uploads results. A second run against the same inputs should read cached process results from NativeLink.
Remote execution
Pants remote execution uses the same Remote Execution API, but it needs a worker environment that matches the actions Pants sends. Start with remote caching, then add remote execution once you have worker platform properties and toolchains aligned.
Troubleshooting
- No cache hits on the second run. Check that
remote_cache_writeandremote_cache_readare both enabled. - Instance-name errors. Match
remote_instance_nameto the NativeLink config. The local examples usemain. - Connection failures. Pants expects a
grpc://URL inremote_store_address.