Files
go-cache-plugin/README.md
T
unkin-agent 3e2f7e59b6
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
Scaffold build repo for pinned tailscale/go-cache-plugin
Upstream publishes no releases, so CI has nothing to curl.

- pin cmd/go-cache-plugin at 3031b5d via the go.mod tool directive
- build a static stripped binary with make build
- test the built binary: static ELF, pinned provenance, and a real
  go build driven through it as a GOCACHEPROG against a stub S3
- add PR build/test/pre-commit workflows and a tag release workflow
  attaching linux/amd64 and linux/arm64 to a Gitea release
2026-09-26 21:30:07 +10:00

59 lines
1.8 KiB
Markdown

# go-cache-plugin
Build repo for [`tailscale/go-cache-plugin`](https://github.com/tailscale/go-cache-plugin),
a `GOCACHEPROG` implementation that backs the Go build cache with S3. Upstream
publishes no releases, so this repo pins a commit via the `tool` directive in
`go.mod` and ships the static binary as a Gitea release.
No source of its own. To move to a newer upstream commit:
```sh
go get -tool github.com/tailscale/go-cache-plugin/cmd/go-cache-plugin@<commit>
make test
```
## Build
```sh
make build # dist/go-cache-plugin, CGO_ENABLED=0, stripped
make test # builds the binary, then drives a real `go build` through it
```
## Use
Point it at the estate's Ceph RGW, which needs both a custom endpoint and
path-style addressing:
```sh
export GOCACHEPROG="go-cache-plugin \
--cache-dir=$HOME/.cache/go-cache-plugin \
--bucket=go-build-cache \
--region=default \
--s3-endpoint-url=https://s3.ceph.unkin.net \
--s3-path-style"
go build ./...
```
Credentials come from the usual `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`
environment. Every flag also has a `GOCACHE_*` environment equivalent — see
`go-cache-plugin help environment`. Add `--metrics` to print cache hit rates at
exit, and `--expiry` to age entries out.
For a shared cache daemon, run `go-cache-plugin serve --plugin <port>` once and
have each build use `go-cache-plugin connect <port>` as its `GOCACHEPROG`.
## CI
Woodpecker steps fetch the released binary:
```yaml
commands:
- curl -fsSLo /usr/local/bin/go-cache-plugin https://git.unkin.net/unkin/go-cache-plugin/releases/download/v0.1.0/go-cache-plugin-linux-amd64
- chmod +x /usr/local/bin/go-cache-plugin
```
## Release
`make patch|minor|major` tags and pushes; the tag pipeline builds
`linux/amd64` and `linux/arm64` and attaches them with `sha256sums.txt`.