-
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
Fix snapshotter ignore list; do not attempt to delete whiteouts of ignored paths #1652
Fix snapshotter ignore list; do not attempt to delete whiteouts of ignored paths #1652
Conversation
* include filesystem mounts in ignorelist of snapshotter * clean up ignore list logic
6c36ea0
to
a954eb1
Compare
Some of the integration tests are failing with this error—is this a known error?
|
They could be flakes. Running the jobs again. |
Thanks @tejal29. I noticed that the two newer PRs are also failing with the same error 🤔 |
Thanks @kamaln7. Somehow the project was deleted. |
Got it, thank you @tejal29! I assume the changes are also good? I’m worried about accidentally breaking existing behavior, although the tests pass. |
Hey @tejal29, I just wanted to follow up and check on the status of the release? |
This PR is breaking unit test:
|
The unit tests are still broken
|
Fixes #1626
Description
With a Dockerfile like:
and
--use-new-run
, Kaniko would build a faulty cache image that adds a whiteout for/dev
. This results in any builds that attempt to reuse the cache image to try and delete/dev
, which obviously does not work and so fails the whole build:Change 1: Add a safe-guard to
GetFSFromLayers
that prevents Kaniko from deleting whiteouts of ignored pathsThis is more of a bandaid in that it prevents bad cache images from failing builds entirely. With this change, bad cache images can still be used as Kaniko no longer tries to delete
/dev
even though there is a whiteout for it.Change 2: Fix the snapshotter ignore list not including filesystem mounts
This is the actual root issue and the change stops Kaniko from erroneously adding a whiteout for
/dev
(or other similar paths). Theapt-get
command in the Dockerfile adds the following symlink:When building the list of changed files, this symlink is resolved and so
/dev/null
is added to the list (which causes the parent dir/dev
to be added as well). There is an ignore list check in the snapshot code, but it turns out that the ignore list that it gets doesn't include filesystem mounts. This is because the snapshotter is created beforeDetectFilesystemIgnoreList
is run, and snapshotter takes a copy of the ignore list.To fix this, I changed up the order of operations a bit and made sure that the ignore list is fully initialized as early as possible (in
newStageBuilder
). I also cleaned up the ignore list code a bit.Before/After
docker run -ti --rm \ -v "$PWD:/workspace" \ -v docker-config.json:/kaniko/.docker/config.json:ro \ kaniko \ --force \ --dockerfile=Dockerfile \ --cache \ --use-new-run=1 \ --snapshotMode redo \ --destination=image -v debug
Before:
Note that the
Taking snapshot of files
list contains/dev/null
and/dev
, and the/dev
whiteout.After:
Note that
/dev/null
is correctly ignored and there is no whiteout for/dev
.Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Reviewer Notes
Release Notes