-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Don't descend into ignored directories when building context #863
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
Conversation
docker/utils/utils.py
Outdated
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.
probably better to use a timestamp here instead of "current docker logic"
Nice. I agree with @kanzure's comments, plus it'd be good to document the logic of |
@aanand cool, added some docs/comments! |
Thanks! I think this can be squashed to one commit. |
a9be3b8
to
f79e4d9
Compare
Signed-off-by: Thomas Boyt <thomas@ledgerx.com>
f79e4d9
to
a49166a
Compare
@aanand rebased :) |
Thanks. I just noticed that we're now excluding parent directories of files mentioned in !-style exceptions. Is that in line with Docker client behaviour? |
So, while before it was adding the parent directories of exceptions to the set of included paths, it wasn't adding back the contents of those directories. Let's say you have the following structure:
and the following rules:
Before, the final set of included paths would have looked like:
Because the tar created in the build process adds each path non-recursively, this didn't actually include Now, the final set of included paths just looks like:
Even though |
OK, so even if we're not passing the directories explicitly to LGTM |
LGTM |
Don't descend into ignored directories when building context
Closes #859.
The major limitation this fix has is that, if the
dockerignore
has any exception rules, the walk algorithm will descend into ignored directories, since of course if you have adockerignore
like:it needs to descend into
foo/bar/baz
to see if there are any files that match*.txt
to include. This is the same behavior that Docker has, so I think it's acceptable - long-term, it may be possible to further optimize this by only descending if there is an exception rule that could actually match inside the directory.