cacher

S3-backed CI cache helper. A single static Go binary.

What it is

cacher is the build that the typical "check S3, fall back to upstream, upload for next time" shell loop should have been. It downloads, uploads, lists, and invalidates cached artifacts in any S3-compatible bucket — single files, docker images (via streamed save | zstd | s3), and whole directory trees keyed by lockfile hash. Built for builds.sr.ht; works anywhere you can run a binary and reach an S3 endpoint.

Install

wget https://bigbes.pages.srht.bigb.es/ci-cacher/cacher-linux-amd64 \
  -O ~/.local/bin/cacher
chmod +x ~/.local/bin/cacher

Verify the binary against the sha256 below before using it.

The loop it replaces

# before — install awscli, write ~/.aws/config, then in every task:
if aws s3api head-object --bucket "$B" --key "$K" >/dev/null 2>&1; then
  aws s3 cp "s3://$B/$K" "$out"
else
  curl -sSL "$url" -o "$out"
  aws s3 cp "$out" "s3://$B/$K"
fi
# after — one binary, one config, one command:
cacher download "$key" "$out" --url "$url"

Commands

Run cacher --help for the full surface. Read the README for usage patterns, Garage compatibility notes, and exit-code semantics.

Why

The shell version this replaced repeated five things in every CI task: install AWS CLI v2 (≈50 MB per build), write a Garage-tuned ~/.aws/config, compute cache keys from file content with sha256sum | cut, branch HIT/MISS by hand, and for docker images pipe docker save | zstd | aws s3 cp - (and the inverse). cacher collapses all of that into one fetched binary plus a config file. The directory caching is the genuinely new capability — the shell version only ever handled single files.

This build

Version
{{VERSION}}
SHA-256
{{SHA256}}
Built
{{BUILT}}
Source
git.srht.bigb.es/~bigbes/ci-cacher
License
BSD-2-Clause