Conversation
217936a to
668daf5
Compare
jsternberg
left a comment
There was a problem hiding this comment.
I do have a general question for this and we might want to delay this from the current release until we have a longer discussion about it. I know it's been discussed before but the linked issue doesn't talk about it.
It's already fairly common to get issues or experience problems where a file that is expected to be in the context is missing or in the wrong place and the error message is a bit opaque. Are we taking any steps to mitigate that? Maybe we want some way to control the build to ensure that there is a way to enforce a "pure" build (only stuff in the context) versus an "impure" build (which could have some of the more local conveniences) and we could maybe configure that at the builder level or somewhere else?
I also wonder if having a file alongside .dockerignore such as .dockerignore.local would be a better solution than a global ignore file as it would allow the same functionality but keep the functionality in the context and prevent it from applying to things like git checkouts (which I'm not actually sure if git checkouts pay attention to dockerignore now that I think about it).
| if errors.Is(err, os.ErrNotExist) { | ||
| return nil | ||
| } | ||
| if err != nil { | ||
| return errors.Wrapf(err, "failed to open global ignore file %s", filename) | ||
| } |
There was a problem hiding this comment.
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return nil
}
return errors.Wrapf(err, "...", ...)
}You could also just set err = nil and call errors.Wrapf either way since that function will return nil if it is passed a nil error.
| patterns, err := ignorefile.ReadAll(f) | ||
| if err != nil { | ||
| return errors.Wrapf(err, "failed to read global ignore file %s", filename) | ||
| } | ||
| if len(patterns) == 0 { | ||
| return nil | ||
| } |
There was a problem hiding this comment.
You can take advantage of that here by doing err != nil || len(patterns) == 0.
We do have warning for the common cases where |
942239a to
e7f6dec
Compare
Was wondering if we could show that in build progress if loaded like: |
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
e7f6dec to
1229b55
Compare
|
If we add a global I once wrote down some thoughts here;
One other thing that could be useful (but .. also can be complicated) is multiple |
needs session: add per-request filter hook to file sync moby/buildkit#7202Buildx now reads a global
.dockerignorefrom its config directory and applies it to local build contexts and local named contexts. The global rules run before repository rules, so a repository!pattern can restore a globally excluded path. This extends the additive-only behavior originally proposed in #3776. The change uses the per-request file sync hook from moby/buildkit#7202. Remote contexts and Dockerfile mounts are unaffected.