-
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
Resolve filepaths before scanning for changes #1069
Resolve filepaths before scanning for changes #1069
Conversation
ade927b
to
92cef5c
Compare
92cef5c
to
a675ad9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor nits regarding commenting out code instead of removing
|
||
for _, file := range files { | ||
file = filepath.Clean(file) | ||
filesSet[file] = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can skip traversing if fileSet[file] = true
filesSet[file] = true | |
if _, ok := fileSet[file] ; !ok { | |
filesSet[file] = true | |
for _, dir := range util.ParentDirectories(file) { | |
dir = filepath.Clean(dir) | |
filesSet[dir] = true | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function filesWithParentDirs
was copy/pasted from the util pkg. If you think it won't clutter the change I'm happy to take this opportunity to make these updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more tests for resolveSymlinkAncestor
} | ||
} | ||
|
||
newFiles := []string{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can optimize this by allocation memory of expected size
newFiles := make([]string, 0, len(filesSet))
} | ||
|
||
if target != newPath { | ||
last = filepath.Base(newPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shd this be target?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe so. We want to return the link, not the target.
012d8cd
to
ce8eebb
Compare
b380112
to
2f2914d
Compare
2f2914d
to
965b606
Compare
This is needed until 'latest'/'debug' tag is applied to GoogleContainerTools/kaniko#1069
Description
Implement the new filepath resolver described in https://github.com/GoogleContainerTools/kaniko/blob/d31d2bc74c884ff5d7932b1f6e7209c6fc63cc5e/docs/design_proposals/filesystem-resolution-proposal-01.md
One change to note is that ancestor directories will no longer be added regardless of whether they are changed. The ancestor directory logic now occurs before the change checking, so ancestor directories will only be added if they have changed.
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