-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Caching ignores filenames when COPYing a directory of files #2241
Labels
area/caching
For all bugs related to cache issues
area/performance
issues related to kaniko performance enhancement
cmd/copy
kind/bug
Something isn't working
priority/p1
Basic need feature compatibility with docker build. we should be working on this next.
priority/p2
High impact feature/bug. Will get a lot of users happy
Comments
This doesn't really fit the issue report template, but I believe this shell output shows a concise reproduction of the issue:
|
And the equivalent steps using
Note the last line of output that shows |
aaron-prindle
added
kind/bug
Something isn't working
area/caching
For all bugs related to cache issues
cmd/copy
priority/p1
Basic need feature compatibility with docker build. we should be working on this next.
priority/p2
High impact feature/bug. Will get a lot of users happy
area/performance
issues related to kaniko performance enhancement
labels
Jun 21, 2023
SJrX
pushed a commit
to SJrX/kaniko
that referenced
this issue
Jun 16, 2024
Issues GoogleContainerTools#2241 GoogleContainerTools#1678 both point to cases where renames can point to incorrect images being used with caching. This commit adds the path of the file (relative to the build context to the hash). A different approach would be to change the underlying function in CacheHasher to include the name (and maybe file size), this was avoided for two reasons: 1. It was unclear whether this would change or break the computed digests outside the context of caching. 2. The CacheHasher does not know the prefix to strip in the filename to compute the hash.
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/caching
For all bugs related to cache issues
area/performance
issues related to kaniko performance enhancement
cmd/copy
kind/bug
Something isn't working
priority/p1
Basic need feature compatibility with docker build. we should be working on this next.
priority/p2
High impact feature/bug. Will get a lot of users happy
Actual behavior
Kaniko appears to ignore filenames when deciding when it can use a cached layer for a COPY command. Changing the name of a file, then COPYing the directory containing the file can cause Kaniko to reuse a cache layer containing a file with the old filename.
Expected behavior
Kaniko would not reuse a cache layer that was created with a different set of input files. The resulting image would contain the set of files that should have been added with the COPY command.
To Reproduce
Steps to reproduce the behavior:
1.txt
and2.txt
.2.txt
to3.txt
in the host file system.Using caching version of cmd: COPY test test
1.txt
and2.txt
and not3.txt
.Additional Information
Dockerfile
Build Context
Builds use the command:
Kaniko Image (fully qualified with digest)
Triage Notes for the Maintainers
--cache
flagThe text was updated successfully, but these errors were encountered: