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

Add support for exclusion rules in dockerignore #12245

Merged
merged 1 commit into from
Apr 28, 2015
Merged

Add support for exclusion rules in dockerignore #12245

merged 1 commit into from
Apr 28, 2015

Conversation

buddhamagnet
Copy link
Contributor

Parallel pull request to #11823 (since closed).

@buddhamagnet
Copy link
Contributor Author

Amended last commit, now signed.

@icecrime
Copy link
Contributor

icecrime commented Apr 9, 2015

@buddhamagnet Thanks! There's a formatting problem to one of your files:

These files are not properly gofmt'd:
 - pkg/fileutils/fileutils_test.go

Please reformat the above files using "gofmt -s -w" and commit the result.

Can you please fix it?

@buddhamagnet
Copy link
Contributor Author

Done, thanks. Was a trailing newline.

@cpuguy83
Copy link
Member

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.
Lmk know if you need any help with this!

Thanks!

@buddhamagnet
Copy link
Contributor Author

Ah sorry I committed at work and hadn't updated my local git config. On it.

@buddhamagnet
Copy link
Contributor Author

Done that, apologies. Don't have time to do the squash now will do later, but the commits are now both signed.

@thaJeztah
Copy link
Member

I see the tests failed

@buddhamagnet
Copy link
Contributor Author

My bad, had added a failing test for the single exclamation point case. Will complete that locally, apologies.

@buddhamagnet
Copy link
Contributor Author

Now rebased against master and squashed.

@thaJeztah
Copy link
Member

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) == "." {
Copy link
Contributor

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.

Copy link
Contributor Author

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 ]]
Copy link
Contributor

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.

@buddhamagnet
Copy link
Contributor Author

@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.

@thaJeztah
Copy link
Member

@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

@duglin
Copy link
Contributor

duglin commented Apr 11, 2015

@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.

@buddhamagnet
Copy link
Contributor Author

@thaJeztah so can I just commit --amend on each iteration and force push? Is that an acceptable workflow?

@duglin
Copy link
Contributor

duglin commented Apr 11, 2015

@buddhamagnet yup - that's what I do.

@calavera
Copy link
Contributor

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).
Copy link
Contributor

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.

@buddhamagnet
Copy link
Contributor Author

@moxiegirl amended and pushed.

@moxiegirl
Copy link
Contributor

@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.

@buddhamagnet
Copy link
Contributor Author

@moxiegirl go for it.

@moxiegirl
Copy link
Contributor

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.

@buddhamagnet
Copy link
Contributor Author

@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?

@buddhamagnet
Copy link
Contributor Author

@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).

@camilonova
Copy link

Man, is so hard to make this happen, should be easier. @buddhamagnet thank you for keeping pushing forward.

@buddhamagnet
Copy link
Contributor Author

@camilonova @moxiegirl it's not hard at all, I'm happy ;)

@moxiegirl
Copy link
Contributor

@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 .dockerignore file, I think it is appropriate to clean up the whole slew with the same PR.

BTW, thank you for being so patient. I've been tracking you through the process on this PR. You've been great.

@buddhamagnet
Copy link
Contributor Author

@moxiegirl no worries at all. Easier for me to give you remote access and you issue a PR?

@buddhamagnet
Copy link
Contributor Author

@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.

@moxiegirl
Copy link
Contributor

Signed-off-by: Dave Goodchild <buddhamagnet@gmail.com>
@buddhamagnet
Copy link
Contributor Author

@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.

@buddhamagnet
Copy link
Contributor Author

@moxiegirl all incorporated, all tests green, one single shining commit.

jessfraz pushed a commit that referenced this pull request Apr 28, 2015
Add support for exclusion rules in dockerignore
@jessfraz jessfraz merged commit 4676ff3 into moby:master Apr 28, 2015
@calavera
Copy link
Contributor

🎉

@thaJeztah
Copy link
Member

\o/ awesome! Thanks for the contribution!

@buddhamagnet
Copy link
Contributor Author

HOLY COW PARTY TIME!!!

@buddhamagnet buddhamagnet deleted the dockerignore-ignores branch April 28, 2015 19:02
@buddhamagnet
Copy link
Contributor Author

@duglin you needed some credit on that commit.

@duglin
Copy link
Contributor

duglin commented Apr 29, 2015

@buddhamagnet just glad to help move it along

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.