Skip to content

mz817: expand variables in COPY/ADD heredoc content#821

Open
mzihlmann wants to merge 3 commits into
mainfrom
mz817-copy-heredoc-expansion
Open

mz817: expand variables in COPY/ADD heredoc content#821
mzihlmann wants to merge 3 commits into
mainfrom
mz817-copy-heredoc-expansion

Conversation

@mzihlmann

@mzihlmann mzihlmann commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Fixes #817

A COPY or ADD heredoc with an unquoted delimiter now expands build args and env into its body like docker does, expanding ${VAR} and stripping the backslash from \${VAR}. Kaniko wrote the body verbatim before, so variables ended up in the file literally.

Quote the delimiter to keep the body verbatim and get the old behaviour: COPY <<'EOF' leaves ${VAR} untouched.

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/commands/copy.go 71.42% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@mzihlmann mzihlmann requested review from 0hlov3, BobDu, babs and nejch June 24, 2026 21:47
@mzihlmann mzihlmann force-pushed the mz817-copy-heredoc-expansion branch 2 times, most recently from 6e51cb9 to 4d3b350 Compare June 26, 2026 10:46
@mzihlmann mzihlmann force-pushed the mz817-copy-heredoc-expansion branch from 4d3b350 to 737f5d6 Compare June 27, 2026 21:31
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.

Heredoc variable expansion not working properly

1 participant