A tiny single-file Go client for Bazel Remote Execution API v2.
The Bazel Remote Execution protocol turns out to be a surprisingly nice “universal remote runner” for retro platforms. With a compatible server (see my excitoon/buildpot repository), you can offload execution to old/slow systems — starting with Windows NT 3.1 and likely even older — and still drive the workflow from a modern machine.
This is useful for:
- running command-line tools that are awkward or impossible to run on modern hardware/OSes
- keeping classic compilers and toolchains alive (some are still genuinely useful and deserve not to be forgotten)
It:
- computes the most common directory among input files (input prefix)
- uploads inputs to the remote CAS under paths relative to that prefix
- runs a command remotely
- downloads declared output files and writes them into the current directory, preserving paths relative to the most common output directory (output prefix)
go build -o bazz .
./bazz \
-address executor.example.com:8980 \
-tls-certificate ca.pem \
-instance my-instance \
-input /abs/path/work/src/a.txt -input /abs/path/work/src/b.txt \
-output /abs/path/work/out/result.bin -output /abs/path/work/out/logs/build.log \
-environment FOO=bar -environment BAZ=qux \
-- \
sh -lc 'cat a.txt b.txt > ../out/result.bin; echo ok > ../out/logs/build.log'Notes:
- If
-tls-certificateis omitted, the client uses insecure gRPC (plaintext). -instanceis optional; many deployments require it.- Inputs must be files (directories aren’t supported).
- Outputs must be listed explicitly; the client requests them via
Command.output_paths.
-
-address: remote executor gRPC address (required) -
-instance: instance name (optional) -
-tls-certificate: CA cert to trust (optional) -
-tls-server-name: TLS server name override (optional) -
-tls-insecure-skip-verify: skip hostname/SAN verification (helps CN-only certs; insecure) -
-input: input file path (repeatable or comma-separated) -
-output: expected output file path (repeatable or comma-separated) -
-environment: environment variableKEY=VALUE(repeatable) -
-working-directory: remote working directory relative to input root (optional) -
-timeout: execution timeout (default10m) -
-dry-run: print computed prefixes and planned command without network calls
