fix(docker-build,go): lowercase image refs, optional Go cache, PG pre-pull - #78
Merged
Merged
Conversation
Three failures observed on a consumer repo (HordiaLabs/store-postgres),
all in shared workflow code rather than in the consumer.
docker-build: the Trivy scan and SBOM steps build their image reference by
hand from the raw `image-name` input, normally `github.repository`, which
keeps the org's casing. OCI references must be lowercase, so Trivy failed
with `could not parse reference: ghcr.io/HordiaLabs/store-postgres@sha256:…`
on every push to the default branch — after the image had already built and
pushed, since metadata-action lowercases for the tags it generates. PR
builds were unaffected (push: false short-circuits the scan), so this only
ever broke the default branch. Resolve the lowercase ref once in a new step
and use it for all three digest refs. `tr` rather than bash 4's ${VAR,,},
because this reusable also runs on self-hosted macOS, still on bash 3.2.
go: add `go-cache` (default true, no behaviour change) so consumers can
disable setup-go's cache on runners where the post-job save is unreliable.
Observed on a containerized self-hosted runner: `tar` packing a cold
cgo-heavy build cache was still running 28 minutes after the last test
passed and took the job's whole 30-minute timeout with it.
go: pull the Postgres image before the readiness clock starts, and make the
wait configurable via `postgres-ready-timeout` (default 60, unchanged). A
cold pull was eating most of the budget, so the wait expired on init that
had barely begun — surfacing as "postgres did not become ready in 60s"
while the container log showed the server starting right at the boundary.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pa92NWDRAbDNXGrSuqcQDa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three failures seen on a consumer repo (
HordiaLabs/store-postgres), all in shared workflow code rather than in the consumer.1.
docker-build.yml— mixed-case image refs break Trivy and SBOMThe Trivy scan and SBOM steps assemble their reference by hand:
image-nameis normallygithub.repository, which preserves the org's casing. OCI references must be lowercase, so Trivy fails:docker/metadata-actionlowercases internally, so the push succeeds and only the scan afterwards fails. PR builds are unaffected (push: falseshort-circuits the scan), so this only ever breaks the default branch —store-postgreshas had a redCIon every push tomainsince 2026-06-11 because of it.A new
Resolve image refstep lowercases registry + name once; all three digest refs use it. It usestrrather than bash 4's${VAR,,}because this reusable also runs on self-hosted macOS, where bash is still 3.2 (verified both ways locally).Affects any org with capitals in its name.
2.
go.yml— newgo-cacheinputDefault
true, so no behaviour change. Setting itfalseskipsactions/setup-go's cache on runners where the post-job save is unreliable.Observed on a containerized self-hosted runner: every real step passed, then
tarpacking a cold cgo-heavy build cache was still running 28 minutes later and consumed the job's whole 30-minute timeout inPost Set up Go. The runner log ends withTerminate orphan process: pid (703) (tar).3.
go.yml— Postgres pre-pull +postgres-ready-timeoutDefault
60, unchanged. The image is now pulled before the readiness clock starts, so the budget covers container init rather than a cold download.A cold pull was eating most of the 60s, so the wait expired on init that had barely begun. It surfaced as
postgres did not become ready in 60swhile the container log showed the server starting right at the boundary — a slow download that read like a hung database.Test plan
actionlintandyamllintclean on both filesghcr.io/HordiaLabs/store-postgres→ghcr.io/hordialabs/store-postgres::error::postgres did not become ready in 3sand exits non-zeroNeeds a tag release before consumers pick it up.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Pa92NWDRAbDNXGrSuqcQDa