Skip to content

ci: speed up multi-arch build with Go + layer caching - #802

Merged
jacksontj merged 1 commit into
masterfrom
ci-speedups
Jul 3, 2026
Merged

ci: speed up multi-arch build with Go + layer caching#802
jacksontj merged 1 commit into
masterfrom
ci-speedups

Conversation

@jacksontj

@jacksontj jacksontj commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Why

The build workflow (multi-arch docker, runs on master push + tags) spends ~10m almost entirely in one step:

Workflow Trigger Total Slow step
build master push + tags 10m39s Run Buildx = 10m12s

The Dockerfile cross-compiles ($BUILDPLATFORM, CGO_ENABLED=0), so the four arches aren't emulated under QEMU — they're four native cross-compiles. But every push did COPY . … → full go build of promxy + all of vendor, ×4 platforms, from a cold build cache, with no layer cache between runs.

What

  • Dockerfile: add per-arch --mount=type=cache,target=/root/.cache/go-build mounts so the Go build cache is reused across the four platform builds.
  • build.yml: drive the build with docker/build-push-action@v6 and cache-from/to: type=gha so that cache (and image layers) also persists across runs.

Expected: ~10m → ~2–3m on warm cache. The first run still populates the cache.

Notes

  • Node 20 deprecation warnings remain, but checkout@v4 / docker/setup-*@v3 / azure/docker-login@v2 are already on their latest majors — nothing to bump yet.
  • Considered splitting the Go test workflow's lint and test into parallel jobs, but dropped it: the jobs run on separate runners (no shared build cache mid-run) and staticcheck (non-race) vs go test -race compile different artifacts, so it traded a whole extra runner for a marginal wall-clock gain. go.yml is unchanged.
  • Based on master (already Go 1.25), independent of the in-flight OCI branch.

🤖 Generated with Claude Code

@jacksontj jacksontj changed the title ci: speed up test and multi-arch build workflows ci: speed up multi-arch build with Go + layer caching Jul 3, 2026
The `build` workflow spent ~10m almost entirely in buildx. The Dockerfile
cross-compiles (`$BUILDPLATFORM`, `CGO_ENABLED=0`), so the four arches aren't
QEMU-emulated — they're four native cross-compiles. But every push did
`COPY . …` → full `go build` of promxy + all of vendor, once per platform,
from a cold Go build cache, with no layer cache between runs.

- Dockerfile: add per-arch `--mount=type=cache,target=/root/.cache/go-build`
  mounts so the Go build cache is reused across the four platform builds.
- build.yml: drive the build via docker/build-push-action@v6 with
  cache-from/to type=gha so that cache and the image layers also persist
  across runs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jacksontj
jacksontj merged commit dff64f7 into master Jul 3, 2026
1 check passed
@jacksontj
jacksontj deleted the ci-speedups branch July 3, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant