Skip to content

mz822: fold resolved heredoc contents into COPY/ADD cache key#823

Open
mzihlmann wants to merge 5 commits into
mainfrom
mz791-heredoc-cache-key
Open

mz822: fold resolved heredoc contents into COPY/ADD cache key#823
mzihlmann wants to merge 5 commits into
mainfrom
mz791-heredoc-cache-key

Conversation

@mzihlmann

Copy link
Copy Markdown
Collaborator

Fixes #822

Stacked on #817 and #791, the only new commit is the last one (the earlier commits are cherry-picks of those two PRs and should land first).

A COPY or ADD heredoc body can reference build args once it is expanded, but the layer cache key is built from the instruction text, which omits the heredoc body. A build that changes only an arg referenced inside a body reused the layer cached for a different resolved content and served a stale file. The resolved heredoc contents are now folded into the COPY/ADD cache key under FF_KANIKO_RESOLVE_CACHE_KEY, the same flag and resolution #791 introduced for instruction paths, so the key tracks exactly the variables the body references. Resolution touches no files, so the cache-lookahead precompute derives the same key as the build.

@mzihlmann mzihlmann force-pushed the mz791-heredoc-cache-key branch from ee68ef7 to 404f6c0 Compare June 24, 2026 21:59
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.29032% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/commands/copy.go 50.00% 9 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@mzihlmann mzihlmann force-pushed the mz791-heredoc-cache-key branch 4 times, most recently from deeaa3b to ac6196c Compare June 26, 2026 10:50
@mzihlmann mzihlmann force-pushed the mz791-heredoc-cache-key branch from ac6196c to 044e236 Compare June 27, 2026 21:31
@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.

COPY/ADD heredoc body variables not reflected in layer cache key

1 participant