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
Cache of COPY --from layers is not working as expected. #2615
Comments
Possibly related: |
@massimeddu-sonicjobs can you confirm that this is a regression from a previous version of kaniko (issue wasn't in version vX.Y.Z) and if so add the latest version of Kaniko this worked with or is this a bug that has always been the case? Thanks |
Hi @aaron-prindle , thanks for having a look at this issue. I dug a bit into the codebase, and apparently the root cause of the issue is at: kaniko/pkg/executor/composite_cache.go Line 79 in 63be499
Basically it looks like that when kaniko calculates the cache key, it excludes the files that are in the Actually, removing I'm not familiar with go and kaniko codebase, but I'll try to create a small PR to solve the issue in the next few days. Thank you, |
when filename in the .dockerignore docker buildx dont copy to context this file and cant execute COPY .
|
@massimeddu-sonicjobs can you create repo with example project? |
Hi @kt-315 , sure. Please have a look at this example repo: https://github.com/massimeddu-sonicjobs/kaniko-copy-issue-test |
I checked it but dont see mistake. 🤔 |
I'm seeing similar issues of older cache being used even when files have been updated, using Kaniko 1.14.0. The options I provide are |
Hi @rgschmitz1! Can you make example |
I can't share my exact source code but I'll try to work out an example, you're going to need a |
Actual behavior
I'm building a multi-target Docker image like this one:
With the following build options
--compressed-caching=true --cache-copy-layers=true --target deploy --reproducible --cache=true --skip-unused-stages=true --cache-run-layers=true --compression=zstd --compression-level=20 --cleanup --snapshot-mode=redo --use-new-run --log-timestamp=true
Now, if the content of the
./src
directory is changed the build is re-run in the builder target, but Kaniko is using an (old) cached version of theCOPY --from
layer in the deploy target, so the new build is not reflecting the changes in the./src
directory.Expected behavior
I expect that the kaniko do not use the cached layer but execute the
COPY --from
command.To Reproduce
Steps to reproduce the behavior:
COPY
command and the second target has aCOPY --from
command--cache-copy-layers=true
optionN.B: Removing the
--cache-copy-layers=true
option fixed the issue.Additional Information
Kaniko version 1.12.1
Triage Notes for the Maintainers
--cache
flagThe text was updated successfully, but these errors were encountered: