Skip to content

Commit c3c6578

Browse files
authored
Merge pull request moby#4166 from thaJeztah/migrate_dockerignore
replace dockerfile/dockerignore with patternmatcher/ignorefile
2 parents 6cb9f42 + 376e9c8 commit c3c6578

File tree

8 files changed

+24
-63
lines changed

8 files changed

+24
-63
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package dockerignore
2+
3+
import (
4+
"io"
5+
6+
"github.com/moby/patternmatcher/ignorefile"
7+
)
8+
9+
// ReadAll is an alias for [ignorefile.ReadAll].
10+
//
11+
// Deprecated: use [ignorefile.ReadAll] instead.
12+
func ReadAll(reader io.Reader) ([]string, error) {
13+
return ignorefile.ReadAll(reader)
14+
}

frontend/dockerfile/dockerignore/dockerignore_test.go

Lines changed: 0 additions & 54 deletions
This file was deleted.

frontend/dockerui/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import (
1515
"github.com/moby/buildkit/client/llb"
1616
"github.com/moby/buildkit/exporter/containerimage/image"
1717
"github.com/moby/buildkit/frontend/attestations"
18-
"github.com/moby/buildkit/frontend/dockerfile/dockerignore"
1918
"github.com/moby/buildkit/frontend/gateway/client"
2019
"github.com/moby/buildkit/solver/pb"
2120
"github.com/moby/buildkit/util/flightcontrol"
21+
"github.com/moby/patternmatcher/ignorefile"
2222
digest "github.com/opencontainers/go-digest"
2323
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
2424
"github.com/pkg/errors"
@@ -442,7 +442,7 @@ func (bc *Client) MainContext(ctx context.Context, opts ...llb.LocalOption) (*ll
442442

443443
var excludes []string
444444
if len(bc.dockerignore) != 0 {
445-
excludes, err = dockerignore.ReadAll(bytes.NewBuffer(bc.dockerignore))
445+
excludes, err = ignorefile.ReadAll(bytes.NewBuffer(bc.dockerignore))
446446
if err != nil {
447447
return nil, errors.Wrapf(err, "failed parsing %s", bc.dockerignoreName)
448448
}

frontend/dockerui/namedcontext.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111
"github.com/moby/buildkit/client/llb"
1212
"github.com/moby/buildkit/exporter/containerimage/exptypes"
1313
"github.com/moby/buildkit/exporter/containerimage/image"
14-
"github.com/moby/buildkit/frontend/dockerfile/dockerignore"
1514
"github.com/moby/buildkit/frontend/gateway/client"
1615
"github.com/moby/buildkit/util/imageutil"
16+
"github.com/moby/patternmatcher/ignorefile"
1717
"github.com/pkg/errors"
1818
)
1919

@@ -206,7 +206,7 @@ func (bc *Client) namedContextRecursive(ctx context.Context, name string, nameWi
206206
}) // error ignored
207207

208208
if len(dt) != 0 {
209-
excludes, err = dockerignore.ReadAll(bytes.NewBuffer(dt))
209+
excludes, err = ignorefile.ReadAll(bytes.NewBuffer(dt))
210210
if err != nil {
211211
return nil, nil, errors.Wrapf(err, "failed parsing %s", DefaultDockerignoreName)
212212
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ require (
4545
github.com/klauspost/compress v1.16.3
4646
github.com/mitchellh/hashstructure/v2 v2.0.2
4747
github.com/moby/locker v1.0.1
48-
github.com/moby/patternmatcher v0.5.0
48+
github.com/moby/patternmatcher v0.6.0
4949
github.com/moby/sys/mountinfo v0.6.2
5050
github.com/moby/sys/signal v0.7.0
5151
github.com/morikuni/aec v1.0.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,8 @@ github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQ
906906
github.com/moby/buildkit v0.8.1/go.mod h1:/kyU1hKy/aYCuP39GZA9MaKioovHku57N6cqlKZIaiQ=
907907
github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
908908
github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc=
909-
github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo=
910-
github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
909+
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
910+
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
911911
github.com/moby/sys/mount v0.1.0/go.mod h1:FVQFLDRWwyBjDTBNQXDlWnSFREqOo3OKX9aqhmeoo74=
912912
github.com/moby/sys/mount v0.1.1/go.mod h1:FVQFLDRWwyBjDTBNQXDlWnSFREqOo3OKX9aqhmeoo74=
913913
github.com/moby/sys/mount v0.3.3 h1:fX1SVkXFJ47XWDoeFW4Sq7PdQJnV2QIDZAqjNqgEjUs=

frontend/dockerfile/dockerignore/dockerignore.go renamed to vendor/github.com/moby/patternmatcher/ignorefile/ignorefile.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,10 @@ github.com/mitchellh/hashstructure/v2
632632
# github.com/moby/locker v1.0.1
633633
## explicit; go 1.13
634634
github.com/moby/locker
635-
# github.com/moby/patternmatcher v0.5.0
635+
# github.com/moby/patternmatcher v0.6.0
636636
## explicit; go 1.19
637637
github.com/moby/patternmatcher
638+
github.com/moby/patternmatcher/ignorefile
638639
# github.com/moby/sys/mount v0.3.3
639640
## explicit; go 1.16
640641
github.com/moby/sys/mount

0 commit comments

Comments
 (0)