From 8dddc6ceb0aa6d516dce5a4b79ed176812144dfe Mon Sep 17 00:00:00 2001 From: Jonathon Leight Date: Sun, 9 Aug 2026 16:55:31 -0400 Subject: [PATCH] Use setup-ko task --- .github/workflows/ci.yml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c1105e..7816a39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -229,11 +229,25 @@ jobs: # across jobs and runs. Every job below compiles the same module, so this # is the difference between each one starting cold and starting warm. cache-dependency-path: go.sum - # ko is installed with `go install` rather than run from its own image so it - # compiles with the Go version pinned above, not whatever an image bundles. - # `go install pkg@version` builds in an isolated module context, so it does - # not touch go.mod or the licensing audit. - - run: go install github.com/google/ko@${{ env.KO_VERSION }} + # The official release binary, which is the same artifact mise installs locally + # (its aqua backend downloads the release, it does not build ko either) — so CI + # and a developer now run byte-identical ko. Compiling it from source here cost + # ~50s per publish and bought nothing: what affects the image is ko's VERSION, + # which decides layer layout, plus the Go on PATH that ko invokes to build the + # app. The Go that built ko itself never touches the artifact. + - uses: ko-build/setup-ko@v0.10 + with: + version: ${{ env.KO_VERSION }} + # An unresolved version input would leave setup-ko installing something other + # than the pin, silently — and an unpinned ko is an unreproducible image. Fail + # here instead, where the message says so. + - run: | + if ! ko version | grep -q "${KO_VERSION#v}"; then + echo "ko is $(ko version), want ${KO_VERSION#v} — the pinned version did not install" >&2 + exit 1 + fi + # setup-ko only logs in when KO_DOCKER_REPO is unset, and it is set above, so + # authenticate explicitly. - run: echo "${{ secrets.GITHUB_TOKEN }}" | ko login ghcr.io --username ${{ github.actor }} --password-stdin - name: Build and push