-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Add support for exclusion rules in dockerignore #12245
Conversation
Amended last commit, now signed. |
@buddhamagnet Thanks! There's a formatting problem to one of your files:
Can you please fix it? |
Done, thanks. Was a trailing newline. |
Can you squash and make sure the commit is signed? Tests aren't running because your last commit isn't signed. These should be 1 commit anyway. Thanks! |
Ah sorry I committed at work and hadn't updated my local git config. On it. |
Done that, apologies. Don't have time to do the squash now will do later, but the commits are now both signed. |
I see the tests failed |
My bad, had added a failing test for the single exclamation point case. Will complete that locally, apologies. |
Now rebased against master and squashed. |
Sorry, @buddhamagnet looks like it still failed; https://jenkins.dockerproject.com/job/Docker-PRs/5544/console (The Windows fail doesn't look like your fault) |
matched = false | ||
continue | ||
} | ||
|
||
if filepath.Clean(relFilePath) == "." { |
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.
Should this check for "." apply to the ! case too?
If so, you can move this up before the "if negative" line and then the line below becomes:
matched = !negative
and you can remove the "if negative" check.
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.
Yep - done.
dockerfile := ` | ||
FROM busybox | ||
ADD . /bla | ||
RUN [[ -f /bla/src/x.go ]] |
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 these indented more?
edit: weird the test before has that too, must be tabs mucking with it.
@thaJeztah apologies I didn't write the integration part. I was on this with @omeid but can't seem to reach him (@omeid hope all is well) so I created a fresh PR from master to move things forward. Will work on all this early next week and hopefully get it into shape. Out of interest @duglin @cpuguy83 why the insistence on squashing all commits during the review process. My common process is to rebase and squash on approval before merge. Just curious. |
@buddhamagnet no problem; on the squashing: all tests are run for each individual commit, so this can result in longer test-times and failing tests if commits are not complete |
@buddhamagnet I don't care much about having one vs many commits during the review cycle, as long as its done before its merged. The thing I worry about is that reviewers may jump the gun and merge before you do your final "clean-up" and squash them down to one so I prefer to have the PR in as "final" a state as possible. |
@thaJeztah so can I just commit --amend on each iteration and force push? Is that an acceptable workflow? |
@buddhamagnet yup - that's what I do. |
Code and design LGTM. Moving to docs review 🎉 |
@@ -46,6 +46,8 @@ the files needed for building that Dockerfile to that directory. To further spee | |||
build, you can exclude files and directories by adding a `.dockerignore` file to the same | |||
directory. | |||
|
|||
The `.dockerignore` file also supports exclusion patterns (as per `.gitignore` files). |
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.
Combine this with the paragraph above. Also, there is no need to talk about the patterns in this paragraph, there is a section further down the page with an example .dockerignore --- refer to that instead
Change ## The .dockeringore File
in this document to Ignore files and directories
Then
---> https://gist.github.com/moxiegirl/2a8f455f0e7836377457
In most cases, it's best to put each Dockerfile in an empty directory. Then,
only add the files needed for building the Dockerfile to the directory. To
increase the build's performance, you can exclude files and directories by
adding a .dockerignore
file to the directory. This file supports the same exclusion patterns as .gitignore
files. See the information about how to ignore files and directories on this page.
@moxiegirl amended and pushed. |
@buddhamagnet You are super quick. I noticed a few problems in the way we document this file. Unfortunately, after my initial comments. My apologies. I'll sort this out and post a Gist with the changes -- if you are willing to make them. |
@moxiegirl go for it. |
Hi @buddhamagnet -- I ended up creating a Gist containing a patch here: https://gist.github.com/moxiegirl/d0ec84384df2763b82fd Just download it and apply it to your branch. |
@moxiegirl output from dummy run: git apply --stat moxie.patch
docs/sources/articles/dockerfile_best-practices.md | 12 +-
docs/sources/reference/builder.md | 97 +++++++++++++-------
docs/sources/reference/commandline/cli.md | 68 +++++--------- output from dummy run: git apply --check moxie.patch
error: patch failed: docs/sources/articles/dockerfile_best-practices.md:32
error: docs/sources/articles/dockerfile_best-practices.md: patch does not apply
error: patch failed: docs/sources/reference/builder.md:41
error: docs/sources/reference/builder.md: patch does not apply
error: patch failed: docs/sources/reference/commandline/cli.md:674
error: docs/sources/reference/commandline/cli.md: patch does not apply Looks like that patch won't apply cleanly? |
@moxiegirl also, it looks like a lot of these changes pertain to the documentation of the dockerignore file, rather than changes introduced by this feature. Could this not be added in a separate pull request (just asking). |
Man, is so hard to make this happen, should be easier. @buddhamagnet thank you for keeping pushing forward. |
@camilonova @moxiegirl it's not hard at all, I'm happy ;) |
@buddhamagnet Normally, I wouldn't ask for this many changes which is why I checked with you yesterday to see if you are willing. Since all your documentation changes were around the BTW, thank you for being so patient. I've been tracking you through the process on this PR. You've been great. |
@moxiegirl no worries at all. Easier for me to give you remote access and you issue a PR? |
@moxiegirl may well be because I rebased against master and force pushed just before I got the patch. We can either try a new patch or your can issue a PR against my branch, whichever is easiest and spreads more rainbows and unicorns. |
Sure thing. Here you go: https://github.com/buddhamagnet/docker/pull/2 @buddhamagnet |
Signed-off-by: Dave Goodchild <buddhamagnet@gmail.com>
@moxiegirl yeah some conflicts there, resolved them, merged and rebased my own branch to combine it all into the original commit etc. Hope it's good. |
@moxiegirl all incorporated, all tests green, one single shining commit. |
Add support for exclusion rules in dockerignore
🎉 |
\o/ awesome! Thanks for the contribution! |
HOLY COW PARTY TIME!!! |
@duglin you needed some credit on that commit. |
@buddhamagnet just glad to help move it along |
Parallel pull request to #11823 (since closed).