Skip to content

fix(builder): skip cache_from/cache_to entries that render empty#8

Merged
blairham merged 1 commit into
mainfrom
fix/skip-empty-cache-entries
Jul 5, 2026
Merged

fix(builder): skip cache_from/cache_to entries that render empty#8
blairham merged 1 commit into
mainfrom
fix/skip-empty-cache-entries

Conversation

@blairham

@blairham blairham commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Cache flags were passed to buildx unconditionally, so an env-templated entry like {{ .Env.STEVEDORE_CACHE_TO }} renders to "" outside CI and fails the build. With this change, entries that render to an empty string are skipped after template resolution — configs can gate layer caching on environment presence: active on CI runners that export STEVEDORE_CACHE_FROM/STEVEDORE_CACHE_TO, inert on a laptop.

Motivation: pinpredict/.github#39 — pinpredict/trading's build-once Dockerfile wants a single shared type=gha cache scope wired in CI, while stevedore build must keep working locally with no GHA cache backend available.

  • internal/builder: skip empty CacheFrom/CacheTo entries (+ dry-run test asserting the empty entries are omitted and non-empty ones survive)
  • internal/config + README: document the skip rule and the env-gating pattern

make check green.

🤖 Generated with Claude Code

Cache flags were passed to buildx unconditionally, so an env-templated
entry like "{{ .Env.STEVEDORE_CACHE_TO }}" rendered to "" outside CI and
broke local builds (--cache-to "" is a buildx error). Skip empty entries
after template rendering: configs can now gate layer caching on
environment presence — active on CI runners that export the cache env,
inert on a laptop.

Motivation: pinpredict/.github#39 — one shared type=gha scope for
pinpredict/trading's build-once Dockerfile.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@blairham
blairham force-pushed the fix/skip-empty-cache-entries branch from 5015e76 to cdf6486 Compare July 5, 2026 20:33
@blairham
blairham merged commit 92abe15 into main Jul 5, 2026
2 checks passed
blairham added a commit to pinpredict/.github that referenced this pull request Jul 5, 2026
blairham/stevedore#8 merged and released: empty-rendering
cache_from/cache_to entries are skipped, so cache-wired configs
(pinpredict/trading#1969) build locally without the CI cache env.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
blairham added a commit to pinpredict/.github that referenced this pull request Jul 5, 2026
- Export STEVEDORE_CACHE_FROM/STEVEDORE_CACHE_TO (one type=gha scope per
  calling repo) and re-export the GitHub runtime env via
  crazy-max/ghaction-github-runtime so stevedore's shelled-out buildx can
  reach the gha cache backend. Configs opt in per image with
  '{{ index .Env "STEVEDORE_CACHE_FROM" }}' entries that render empty
  outside CI (skipped by stevedore >= v0.0.5, blairham/stevedore#8).
- Bump the action pin + default binary to v0.0.4 (plan/matrix mode).
- Document the single-job-by-design decision (#39):
  one runner + one BuildKit means a build-once Dockerfile (trading#1967)
  compiles once for all images, even with --parallel; a per-image matrix
  fan-out would cold-cache every runner and re-run the shared stage N
  times.

Still a draft (no-push defaults true): the remaining publish gap is the
Dispatch notification (blairham/stevedore#6).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
blairham added a commit to pinpredict/.github that referenced this pull request Jul 5, 2026
blairham/stevedore#8 merged and released: empty-rendering
cache_from/cache_to entries are skipped, so cache-wired configs
(pinpredict/trading#1969) build locally without the CI cache env.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
blairham added a commit to pinpredict/.github that referenced this pull request Jul 5, 2026
…re (#40)

* feat(stevedore-release): add draft reusable stevedore release workflow

Reusable image build/release via stevedore v0.0.3. The caller passes no
service matrix: stevedore reads the repo's .stevedore.yaml, resolves
per-service ECR versions, does change detection against per-image
refs/releases/image/<id> marker refs (the same ref family
docker-release.yml advances; contents: write so it can push them), and
groups identical build specs into a single build. Draft: defaults to
--no-push; remaining gap vs docker-release.yml is the Dispatch publish
notification.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(stevedore-release): wire gha layer cache + bump stevedore v0.0.4

- Export STEVEDORE_CACHE_FROM/STEVEDORE_CACHE_TO (one type=gha scope per
  calling repo) and re-export the GitHub runtime env via
  crazy-max/ghaction-github-runtime so stevedore's shelled-out buildx can
  reach the gha cache backend. Configs opt in per image with
  '{{ index .Env "STEVEDORE_CACHE_FROM" }}' entries that render empty
  outside CI (skipped by stevedore >= v0.0.5, blairham/stevedore#8).
- Bump the action pin + default binary to v0.0.4 (plan/matrix mode).
- Document the single-job-by-design decision (#39):
  one runner + one BuildKit means a build-once Dockerfile (trading#1967)
  compiles once for all images, even with --parallel; a per-image matrix
  fan-out would cold-cache every runner and re-run the shared stage N
  times.

Still a draft (no-push defaults true): the remaining publish gap is the
Dispatch notification (blairham/stevedore#6).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(stevedore-release): bump stevedore to v0.0.5

blairham/stevedore#8 merged and released: empty-rendering
cache_from/cache_to entries are skipped, so cache-wired configs
(pinpredict/trading#1969) build locally without the CI cache env.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(docker-release)!: replace the matrix implementation with stevedore

The matrix implementation lives on the frozen pre-stevedore tag that
every existing caller is pinned to — this replacement breaks the
workflow_call contract (no matrix input) for @main only, which is
exactly what the pin was minted for. Repos migrate by adding a
.stevedore.yaml, dropping the matrix wiring from ci.yml, and pointing
uses: back to @main.

Carries the draft stevedore workflow's shape: single job by design
(#39 — one BuildKit instance so a build-once Dockerfile compiles once
for all images, even with --parallel), gha layer cache env
(STEVEDORE_CACHE_FROM/TO, one scope per repo, opt-in per config via
index-form templates skipped when empty by stevedore >= v0.0.5), and
no-push defaulting true until the Dispatch notification gap
(blairham/stevedore#6) closes.

README + AGENTS.md updated: consumer contract, migration steps, the
pre-stevedore exception wording, and the statements that only apply to
the frozen matrix implementation (per-service push roles,
notify-dispatch, matrix-shape playbook).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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