-
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
Support Dockerfile.dockerignore #801
Support Dockerfile.dockerignore #801
Conversation
d9e7fa4
to
7a6f4b9
Compare
7a6f4b9
to
db12a77
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.
LGTM except additional tests.
pkg/util/fs_util_test.go
Outdated
dockerfilepath: "../../integration/dockerfiles/Dockerfile_test_dockerignore_relative", | ||
buildcontext: "../../integration/", | ||
excluded: "ignore_relative/bar", | ||
notExcluded: "ignore_relative/foo", |
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 think we should test ignore/bar
is not excluded along with ignore_relative/foo
here to make sure context dockerignore is not used.? What do you think?
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.
very good point, yes!
pkg/util/fs_util_test.go
Outdated
dockerfilepath: "../../integration/dockerfiles/Dockerfile_test_dockerignore", | ||
buildcontext: "../../integration/", | ||
excluded: "ignore/bar", | ||
notExcluded: "ignore/foo", |
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 should test ignore_relative/bar
is not excluded here to make sure Dockerfile_test_dockerignore_relative.dockerignore
is not used?
The newly added dockerfile failed
The way integration tests are setup,
So, in your case step 1 fails. |
@tejal29 apparently, docker only reads the I'm not sure what is the best course of action then now. Is there some way to alter the integration test for this one or should we just drop it because it's not supported by vanilla docker build? |
@tejal29 I added another commit with more unit tests (and refactored it to separate them in multiple |
@@ -0,0 +1,5 @@ | |||
# This dockerfile makes sure Dockerfile.dockerignore is working |
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.
Can we remove this from integration test and rename this to "Dockerfile_dockeringore_relative"
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.
@tejal29 I'm not 100% sure how things work: if the file doesn't have the word test
in it, then it won't be included in integration tests or is there more to do?
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.
ah you answered below, thx :)
Thanks @victornoel, your integration test is still going to fail.
Awesome! The integration test will be fixed if you rename Line 99 in 2218859
|
@tejal29 it's pushed, do you want me to squash everything into one commit or should I leave it like that? |
@tejal29 @kokoro-team seams to have remove the |
@victornoel, whenever kokoro (internal jenkins) receives the notification via label, it kicks off a job to run the tests on the PR and removes the label. |
@tejal29 ah, ok, excellent, thank you for your help, my first PR here and in Go :) |
Could this be upstreamed to moby/moby ? |
@guillaume86 isn't what moby/buildkit#901 was for? (cited in GoogleContainerTools/skaffold#3837) |
@victornoel Yes but buildkit is not supported on windows. |
@guillaume86 ah, sorry about that, well here it's about kaniko, you would need to ask in the moby repository for implementing this feature, not sure you will get help here :) |
This fixes #776
Description
Dockerfile.dockerignore
in priority over the context's.dockerignore
file.I haven't added an unit test because it wasn't clear what was to correct way to test this because excludes seems to be managed globally via a static field. I would be interested by guidance from knowledgeable people on this.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
Release Notes
Dockerfile.dockerignore
file in the same way asdocker build