Explorar o código

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]>
Sebastiaan van Stijn %!s(int64=2) %!d(string=hai) anos
pai
achega
5d732010a7
Modificáronse 1 ficheiros con 8 adicións e 4 borrados
  1. 8 4
      pkg/watch/dockerignore.go

+ 8 - 4
pkg/watch/dockerignore.go

@@ -22,8 +22,8 @@ import (
 	"path/filepath"
 	"path/filepath"
 	"strings"
 	"strings"
 
 
-	"github.com/moby/buildkit/frontend/dockerfile/dockerignore"
 	"github.com/moby/patternmatcher"
 	"github.com/moby/patternmatcher"
+	"github.com/moby/patternmatcher/ignorefile"
 )
 )
 
 
 type dockerPathMatcher struct {
 type dockerPathMatcher struct {
@@ -133,13 +133,17 @@ func readDockerignorePatterns(repoRoot string) ([]string, error) {
 	}
 	}
 	defer func() { _ = f.Close() }()
 	defer func() { _ = f.Close() }()
 
 
-	return dockerignore.ReadAll(f)
+	patterns, err := ignorefile.ReadAll(f)
+	if err != nil {
+		return nil, fmt.Errorf("error reading .dockerignore: %w", err)
+	}
+	return patterns, nil
 }
 }
 
 
 func DockerIgnoreTesterFromContents(repoRoot string, contents string) (*dockerPathMatcher, error) {
 func DockerIgnoreTesterFromContents(repoRoot string, contents string) (*dockerPathMatcher, error) {
-	patterns, err := dockerignore.ReadAll(strings.NewReader(contents))
+	patterns, err := ignorefile.ReadAll(strings.NewReader(contents))
 	if err != nil {
 	if err != nil {
-		return nil, err
+		return nil, fmt.Errorf("error reading .dockerignore: %w", err)
 	}
 	}
 
 
 	return NewDockerPatternMatcher(repoRoot, patterns)
 	return NewDockerPatternMatcher(repoRoot, patterns)