From cc717790f772c75d9e8514f6d602d5dc325f4a77 Mon Sep 17 00:00:00 2001 From: Dave Kowalski Date: Fri, 3 Jul 2026 00:33:56 +0000 Subject: [PATCH] untag built image after push to bound the dind image store image-build loads each build into the runner pod's dind (load: true); the tags then accumulated forever (dozens of stale 2-3GB tags per pod, a chunk of the runner disk growth). Untag after a successful push and sweep the now-dangling previous :latest. The buildkit build cache is separate and refcounts its own layers, so the next build stays warm; when the repo is 'runner' itself the pod's next job re-pulls the ~380MB job image from the local registry (cheap). Guarded (continue-on-error + || true) so cleanup never fails a release. Co-Authored-By: Claude Fable 5 --- action.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/action.yaml b/action.yaml index 5f2e5ad..0fbd486 100644 --- a/action.yaml +++ b/action.yaml @@ -83,3 +83,29 @@ runs: echo "deleting ${NAME}:$tag" tea api -X DELETE "/packages/${ORG}/container/${NAME}/${tag}" done + + - name: Untag local image + # image-build loads the built image into the runner's dind (load: true). + # Nothing needs the local tag after the push, but the tags used to pile up + # forever in the pod's dind image store (dozens of stale 2-3GB tags). Untag + # after pushing to reclaim the store; the buildkit BUILD cache is separate + # and refcounts its own layers, so the next build of this image is still + # warm. (When THIS repo is `runner`, untagging :latest costs the pod's next + # job one ~380MB re-pull of the job image from the local registry — cheap.) + # The image prune sweeps the now-dangling previous :latest that a re-tag + # orphans; it only removes untagged images no container/tag references, so + # shared layers survive. + continue-on-error: true + shell: bash + env: + IMAGE: ${{ inputs.image }} + TAG_INPUT: ${{ inputs.tag }} + RUN_NUMBER: ${{ github.run_number }} + LATEST: ${{ inputs.latest }} + run: | + TAG="${TAG_INPUT:-$RUN_NUMBER}" + docker rmi "${IMAGE}:${TAG}" || true + if [ "$LATEST" = "true" ]; then + docker rmi "${IMAGE}:latest" || true + fi + docker image prune -f || true