Skip to content

Commit 5d73201

Browse files
committed
replace dockerfile/dockerignore with patternmatcher/ignorefile
The BuildKit dockerignore package was integrated in the patternmatcher repository / module. This patch updates our uses of the BuildKit package with its new location. A small local change was made to keep the format of the existing error message, because the "ignorefile" package is slightly more agnostic in that respect and doesn't include ".dockerignore" in the error message. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 2006f3f commit 5d73201

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/watch/dockerignore.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
"path/filepath"
2323
"strings"
2424

25-
"github.com/moby/buildkit/frontend/dockerfile/dockerignore"
2625
"github.com/moby/patternmatcher"
26+
"github.com/moby/patternmatcher/ignorefile"
2727
)
2828

2929
type dockerPathMatcher struct {
@@ -133,13 +133,17 @@ func readDockerignorePatterns(repoRoot string) ([]string, error) {
133133
}
134134
defer func() { _ = f.Close() }()
135135

136-
return dockerignore.ReadAll(f)
136+
patterns, err := ignorefile.ReadAll(f)
137+
if err != nil {
138+
return nil, fmt.Errorf("error reading .dockerignore: %w", err)
139+
}
140+
return patterns, nil
137141
}
138142

139143
func DockerIgnoreTesterFromContents(repoRoot string, contents string) (*dockerPathMatcher, error) {
140-
patterns, err := dockerignore.ReadAll(strings.NewReader(contents))
144+
patterns, err := ignorefile.ReadAll(strings.NewReader(contents))
141145
if err != nil {
142-
return nil, err
146+
return nil, fmt.Errorf("error reading .dockerignore: %w", err)
143147
}
144148

145149
return NewDockerPatternMatcher(repoRoot, patterns)

0 commit comments

Comments
 (0)