Skip to content
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

Don't fail copy to emptydir #2978

Conversation

TomSweeneyRedHat
Copy link
Member

When a COPY command was being targeted at an empty new directory,
the copy would fail. It could be "worked around" by putting a dummy
file into the directory.

Fixes: #2964
Signed-off-by: TomSweeneyRedHat [email protected]

What type of PR is this?

/kind api-change
/kind bug
/kind cleanup
/kind deprecation
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake
/kind other

What this PR does / why we need it:

Fixes an issue where a COPY to a new/empty directory would fail during the build process.

How to verify it

See 'bud test empty newdir' in bud.bats

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

An issue was fixed where a COPY command in a Containerfile would fail if the destination was an empty directory and a file was being placed into it.

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 7, 2021
@TomSweeneyRedHat
Copy link
Member Author

@nalind PTAL

@TomSweeneyRedHat
Copy link
Member Author

Looks like a legit test failure. Will have to see if the test was wrong to begin with as it was expected to fail but now succeeds or if I messed something up.

[+0202s] not ok 33 bud with .dockerignore
[+0202s] # (from function `die' in file ./helpers.bash, line 196,
[+0202s] #  from function `run_buildah' in file ./helpers.bash, line 183,
[+0202s] #  in test file ./bud.bats, line 20)
[+0202s] #   `run_buildah 125 bud -t testbud --signature-policy ${TESTSDIR}/policy.json -f ${TESTSDIR}/bud/dockerignore/Dockerfile ${TESTSDIR}/bud/dockerignore' failed
```

@rhatdan rhatdan mentioned this pull request Feb 10, 2021
@TomSweeneyRedHat
Copy link
Member Author

TomSweeneyRedHat commented Feb 14, 2021

OK, I found the issue. I was not considering the .dockerignore file before doing the empty dir creation in the container. I've moved that logic down under the excludes check and it's now (hopefully) working with the next push.

When a COPY command was being targeted at an empty new directory,
the copy would fail.  It could be "worked around" by putting a dummy
file into the directory.

Addresses:  containers#2964
Signed-off-by: TomSweeneyRedHat <[email protected]>
@rhatdan
Copy link
Member

rhatdan commented Feb 15, 2021

/approve
lgtm

@rhatdan
Copy link
Member

rhatdan commented Feb 15, 2021

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

LGTM

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: rhatdan, saschagrunert, TomSweeneyRedHat

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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

@rhatdan
Copy link
Member

rhatdan commented Feb 16, 2021

/lgtm

@openshift-merge-robot openshift-merge-robot merged commit e1c7a5c into containers:master Feb 16, 2021
@TomSweeneyRedHat TomSweeneyRedHat deleted the dev/tsweeney/emptydir2 branch February 17, 2021 00:52
TomSweeneyRedHat added a commit that referenced this pull request Feb 17, 2021
Cherrypick #2978 to fix and issue when
copying files to an empty directory on a container.

Signed-off-by: TomSweeneyRedHat <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved kind/bug Categorizes issue or PR as related to a bug. lgtm locked - please file new issue/PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error doing COPY of empty directory in multi-stage build
5 participants