Skip to content

mz824: fold heredoc bodies into RUN cache key#825

Open
mzihlmann wants to merge 1 commit into
mainfrom
mz824-run-heredoc-cache-key
Open

mz824: fold heredoc bodies into RUN cache key#825
mzihlmann wants to merge 1 commit into
mainfrom
mz824-run-heredoc-cache-key

Conversation

@mzihlmann

Copy link
Copy Markdown
Collaborator

Fixes #824

Stacked on #791, the only new commit is the last one (the first is a cherry-pick of #791 and should land first).

A RUN heredoc body is not part of the layer cache key. The key is keyed on the instruction text, which for a heredoc is just the RUN <<EOF line, while the body lives in cmd.Files. Two RUN steps that differ only in their body shared a key, so a build that changed only the script reused the stale layer. The raw heredoc bodies are now folded into the RUN cache key under FF_KANIKO_RESOLVE_CACHE_KEY, the same flag #791 introduced. The bodies are added verbatim rather than variable-resolved: the shell expands them at runtime and RUN already folds all env into its key, so the variable case was already covered and only the literal body text was missing.

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/commands/run.go 66.66% 3 Missing and 1 partial ⚠️
pkg/commands/run_marker.go 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@mzihlmann mzihlmann force-pushed the mz824-run-heredoc-cache-key branch from dc784ab to 5c729fc Compare June 26, 2026 10:39
@mzihlmann mzihlmann requested review from 0hlov3, BobDu, babs and nejch July 3, 2026 20:48
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.

RUN heredoc body not reflected in layer cache key

1 participant