Skip to content

Conversation

@QiWang19
Copy link
Member

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]

@rh-atomic-bot
Copy link
Collaborator

Can one of the admins verify this patch?
I understand the following commands:

  • bot, add author to whitelist
  • bot, test pull request
  • bot, test pull request once

@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L labels Mar 22, 2019
@mheon
Copy link
Member

mheon commented Mar 22, 2019

Alright, this is getting ridiculous, we've had to manually whitelist every PR from Qi...

@mheon
Copy link
Member

mheon commented Mar 22, 2019

bot, add author to whitelist

@TomSweeneyRedHat
Copy link
Member

Ditto on Buildah, if you find the magic bits to flip @mheon, please let me know.

@QiWang19
Copy link
Member Author

Because my format vendor PR ruined the libpod repo last week 😨 ? bot, I'm sorry 😭

@rhatdan
Copy link
Member

rhatdan commented Mar 24, 2019

I think we have to add her to the OWNERS file.

@rhatdan
Copy link
Member

rhatdan commented Mar 25, 2019

/approve

@openshift-ci-robot
Copy link
Collaborator

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 25, 2019
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,
Copy link
Member

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 
}

Copy link
Member Author

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
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

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
Copy link
Member

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
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@QiWang19
Copy link
Member Author

/test lint

@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably #2789) made this pull request unmergeable. Please resolve the merge conflicts.

@openshift-ci-robot openshift-ci-robot added size/L and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 28, 2019
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]>
@QiWang19
Copy link
Member Author

/retest

extract := c.Flag("extract").Changed
return copyBetweenHostAndContainer(runtime, args[0], args[1], extract)
copyOpts := copyOptions{
extract: c.Extract,
Copy link
Member

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()
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member Author

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.

@QiWang19 QiWang19 closed this Apr 3, 2019
@QiWang19 QiWang19 deleted the ignore branch June 26, 2020 15:10
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants