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

fix: exclusion files during COPY statement #1510

Closed
wants to merge 3 commits into from
Closed

fix: exclusion files during COPY statement #1510

wants to merge 3 commits into from

Conversation

alex1989hu
Copy link
Contributor

Relates to (and quite possibly fixes) #552 and #1280.

Description

The original PR is here: #1312

When using COPY --from, do not exclude files from
dockerignore

Credites goes to Pieter Lexis (@pieterlexis)

Signed-off-by: Alex Szakaly alex.szakaly@gmail.com

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes unit tests
  • Adds integration tests if needed.

See the contribution guide for more details.

Reviewer Notes

  • The code flow looks good.
  • Unit tests and or integration tests added.

Release Notes

Describe any changes here so maintainer can include it in the release notes, or delete this block.

- Kaniko no longer ignores files specified in `.dockerignore` when copying files from other stages using `COPY --from`

@google-cla google-cla bot added the cla: yes CLA signed by all commit authors label Nov 29, 2020
@alex1989hu
Copy link
Contributor Author

alex1989hu commented Nov 29, 2020

CI failures:

  • the new test integration/dockerfiles/Dockerfile_test_dont_ignore_copy_from causing no space left on device also on my machine. If I remove that new test, then no more issue with space. Thoughts?
  • build-image-and-k8s-integration-test: Abuse detection of GitHub, retry possibly solves

@tejal29
Copy link
Member

tejal29 commented Dec 9, 2020

Thanks @alex1989hu. i will retry the runs.

When using `COPY --from`, do not exclude files from
`dockerignore`

Credites goes to Pieter Lexis (@pieterlexis)

Signed-off-by: Alex Szakaly <alex.szakaly@gmail.com>
@tejal29 tejal29 closed this Dec 9, 2020
@tejal29 tejal29 reopened this Dec 9, 2020
@@ -0,0 +1,5 @@
FROM scratch as src
COPY . /
Copy link
Member

Choose a reason for hiding this comment

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

i think this '.' is causing the no space left error.

Can yo instead re-write the existing test Dockerfile_test_dockerignore

# This dockerfile makes sure the .dockerignore is working
# If so then ignore/foo should copy to /foo
# If not, then this image won't build because it will attempt to copy three files to /foo.txt, which is a file not a directory
FROM scratch as base
COPY ignore/* /foo.txt

From base as first
COPY --from=base /foo.txt ignore/bar

# Make sure that .dockerignore also applies for later stages
FROM scratch as base2
COPY ignore/* /foo.txt

From base2 as second
COPY --from=base2 /foo.txt ignore/bar

FROM scratch
# Test make sure, dockerignore is not applied with `-from`
COPY --from=first ignore/* /fooAnother/
COPY --from=second ignore/* /fooAnother2/

@google-cla
Copy link

google-cla bot commented Dec 11, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no CLA not signed by all commit authors and removed cla: yes CLA signed by all commit authors labels Dec 11, 2020
@tejal29
Copy link
Member

tejal29 commented Dec 11, 2020

@googlebot I consent

@google-cla
Copy link

google-cla bot commented Dec 11, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

1 similar comment
@google-cla
Copy link

google-cla bot commented Dec 11, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Dec 12, 2020

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@tscni
Copy link
Contributor

tscni commented Feb 5, 2021

Didn't I already fix this with #1447 where the excludes are now part of the FileContext?
For a --from COPY the FileContext is simply created without any excludes and the whole ignoreExcludes logic shouldn't be necessary at all.

Or more specifically, didn't #1234 already fix this? Which made #1447 necessary for some unrelated fixes?

@kvaps
Copy link
Contributor

kvaps commented Aug 25, 2021

This PR probably solving the same issue, I solved in #1724

However I think my solutions might be better as it not even saving the ignored files into cached layer, take a look at this:
f7fc5c3#diff-1e90758e2fb0f26bdbfe7a40aafc4b4796cbf808842703e52e16c1f36b8da7dc

@alex1989hu alex1989hu closed this Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: no CLA not signed by all commit authors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants