-
Notifications
You must be signed in to change notification settings - Fork 2.9k
podman cp supports .dockerignore
#2745
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
Conversation
|
Can one of the admins verify this patch?
|
|
Alright, this is getting ridiculous, we've had to manually whitelist every PR from Qi... |
|
bot, add author to whitelist |
|
Ditto on Buildah, if you find the magic bits to flip @mheon, please let me know. |
|
Because my format vendor PR ruined the libpod repo last week 😨 ? bot, I'm sorry 😭 |
|
I think we have to add her to the OWNERS file. |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: QiWang19, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
cmd/podman/cp.go
Outdated
| extract := c.Flag("extract").Changed | ||
| return copyBetweenHostAndContainer(runtime, args[0], args[1], extract) | ||
| copyOpts := copyOptions{ | ||
| extract: c.Flag("extract").Changed, |
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.
This code is wrong
Should be
copyOpts := copyOptions{
extract: c.Extract
}
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.
fixed
cmd/podman/cp.go
Outdated
| if exclude.IsExcluded { | ||
| return nil | ||
| } | ||
| break |
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.
why break here? Don't we need to check all the exclude rules?
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.
if it's not match, I have continue in line 295
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.
shouldn't we consider the last match though?
Something like:
a/b
!a/b/c
Wouldn't we skip a/b/c in this way?
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.
yes, @giuseppe , needs review 🕵️♂️
cmd/podman/cp.go
Outdated
| if exclude.IsExcluded { | ||
| return nil | ||
| } | ||
| break |
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.
same here, don't we need to check all the excludes?
cmd/podman/cp.go
Outdated
| return err | ||
| } | ||
| if info.IsDir() { | ||
| return nil |
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.
what happens if a directory is marked to be excluded?
For example, if I've:
mkdir -p a/b
touch a/b/c
echo a/b > .dockerignore
Shouldn't we skip also the file c from being copied?
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.
fixed
f81658d to
6e2513f
Compare
|
/test lint |
|
☔ The latest upstream changes (presumably #2789) made this pull request unmergeable. Please resolve the merge conflicts. |
podman cp can exclude (or keep) some files by specifying the rules in .dockerignoe file, so that can avoid sending unnecessary files to container. Signed-off-by: Qi Wang <[email protected]>
|
/retest |
| extract := c.Flag("extract").Changed | ||
| return copyBetweenHostAndContainer(runtime, args[0], args[1], extract) | ||
| copyOpts := copyOptions{ | ||
| extract: c.Extract, |
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.
Why are we only filling one field in here?
If we're not using all of copyOptions, just pass in Extract to copyBetweenHostAndContainer and make a copyOptions in there
| glob = append(glob, srcPath) | ||
| } | ||
|
|
||
| dir, err := os.Getwd() |
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.
Is this actually how Docker find .dockerignore? I would assume they would start at the source directory and look for .dockerignore in the source directory and its parents?
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.
docker looks for a file named .dockerignore in the root directory of the context
what does this mean, it it the source directory?
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.
That's for Dockerfiles. We don't have a context directory in podman copy, really. We have a source and a destination we're copying.
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'm looking for documentation here on how docker cp actually handles this and not finding much.
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.
Does Docker even do this? I can't find any documentation for this actually working in Docker. I don't really see why we would want to implement it if they don't?
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 didn't find the documentation, either. But just found the cp command was influenced if there is a .dockerignore file in the context directory
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.
hm...maybe we don't need this.
podman cp can exclude (or keep) some files by specifying the rules in .dockerignoe file, so that can avoid sending unnecessary files to container.
Signed-off-by: Qi Wang [email protected]