diff --git a/.travis.yml b/.travis.yml index e063965cd..cb5721468 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,9 @@ sudo: true notifications: email: true go: - - 1.10.x + - 1.11.x before_install: - - go get github.com/golang/lint/golint + - go get golang.org/x/lint/golint - go get honnef.co/go/tools/cmd/staticcheck - go get -u github.com/jteeuwen/go-bindata/... - echo "deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/backports.list diff --git a/basic.mk b/basic.mk index 96192f810..2aed84a77 100644 --- a/basic.mk +++ b/basic.mk @@ -51,7 +51,7 @@ static: prebuild ## Builds a static executable. -tags "$(BUILDTAGS) static_build" \ ${GO_LDFLAGS_STATIC} -o $(NAME) . -all: clean build fmt lint test staticcheck vet install ## Runs a clean, build, fmt, lint, test, staticcheck, vet and install. +all: clean build fmt lint test staticcheck vet verify-vendor install ## Runs a clean, build, fmt, lint, test, staticcheck, vet and install. .PHONY: fmt fmt: ## Verifies all files have been `gofmt`ed. @@ -165,6 +165,10 @@ vendor: ## Updates the vendoring directory. GO111MODULE=on $(GO) mod vendor @$(RM) Gopkg.toml Gopkg.lock +.PHONY: verify-vendor +verify-vendor: ## Verifies the vendoring directory. + GO111MODULE=on $(GO) mod verify + .PHONY: clean clean: ## Cleanup any build binaries or packages. @echo "+ $@" diff --git a/go.mod b/go.mod index ab6b14983..43c5396fb 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/genuinetools/img -replace github.com/hashicorp/go-immutable-radix v1.0.0 => ../../tonistiigi/go-immutable-radix +replace github.com/hashicorp/go-immutable-radix => github.com/tonistiigi/go-immutable-radix v0.0.0-20170803185627-826af9ccf0fe require ( github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect @@ -17,7 +17,7 @@ require ( github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260 // indirect github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3 github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd // indirect - github.com/coreos/go-systemd v0.0.0-20180828140353-eee3db372b31 // indirect + github.com/coreos/go-systemd v0.0.0-20180828140353-eee3db372b31 github.com/cyphar/filepath-securejoin v0.2.2 github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/cli v0.0.0-20180920165730-54c19e67f69c @@ -43,15 +43,18 @@ require ( github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect github.com/hashicorp/go-immutable-radix v1.0.0 // indirect + github.com/hashicorp/golang-lru v0.5.0 // indirect + github.com/hashicorp/uuid v0.0.0-20160311170451-ebb0a03e909c // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mitchellh/hashstructure v1.0.0 // indirect - github.com/moby/buildkit v0.0.0-20180925011041-a927eaf23a2e + github.com/moby/buildkit v0.3.1-0.20181016065855-0d80bd17a30e github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c // indirect + github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618 // indirect github.com/onsi/gomega v1.4.2 // indirect github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2 // indirect github.com/opencontainers/image-spec v1.0.1 github.com/opencontainers/runc v0.0.0-20180920170208-00dc70017d22 - github.com/opencontainers/runtime-spec v1.0.1 // indirect + github.com/opencontainers/runtime-spec v1.0.1 github.com/opencontainers/selinux v1.0.0-rc1 // indirect github.com/opentracing-contrib/go-stdlib v0.0.0-20180702182724-07a764486eb1 // indirect github.com/opentracing/opentracing-go v1.0.2 // indirect @@ -66,15 +69,16 @@ require ( github.com/sirupsen/logrus v1.0.6 github.com/stretchr/testify v1.2.2 // indirect github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 // indirect - github.com/tonistiigi/fsutil v0.0.0-20180925004926-70b709f90a17 // indirect + github.com/tonistiigi/fsutil v0.0.0-20181011223333-2862f6bc5ac9 // indirect github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect + github.com/urfave/cli v1.20.0 github.com/vishvananda/netlink v1.0.0 // indirect github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc // indirect go.etcd.io/bbolt v1.3.1-etcd.8 golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b // indirect golang.org/x/net v0.0.0-20180925072008-f04abc6bdfa7 // indirect golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f - golang.org/x/sys v0.0.0-20180925112736-b09afc3d579e // indirect + golang.org/x/sys v0.0.0-20180925112736-b09afc3d579e golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 // indirect google.golang.org/genproto v0.0.0-20180924164928-221a8d4f7494 // indirect google.golang.org/grpc v1.15.0 diff --git a/go.sum b/go.sum index a415a2f9e..2a4ad3f9c 100644 --- a/go.sum +++ b/go.sum @@ -86,8 +86,6 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92Bcuy github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 h1:MJG/KsmcqMwFAkh8mTnAwhyKoB+sTAnY4CACC110tbU= github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= -github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/uuid v0.0.0-20160311170451-ebb0a03e909c h1:nQcv325vxv2fFHJsOt53eSRf1eINt6vOdYUFfXs4rgk= @@ -99,10 +97,12 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/hashstructure v1.0.0 h1:ZkRJX1CyOoTkar7p/mLS5TZU4nJ1Rn/F8u9dGS02Q3Y= github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= -github.com/moby/buildkit v0.0.0-20180925011041-a927eaf23a2e h1:/u+wTTwOXMi98EXILoZYIdqkjC4gAGzuNiOa89ImDZU= -github.com/moby/buildkit v0.0.0-20180925011041-a927eaf23a2e/go.mod h1:nnELdKPRkUAQR6pAB3mRU3+IlbqL3SSaAWqQL8k/K+4= +github.com/moby/buildkit v0.3.1-0.20181016065855-0d80bd17a30e h1:5wBFSb2aRSseTl+thHARTUPdWEomVbsTxe84GEqRIkE= +github.com/moby/buildkit v0.3.1-0.20181016065855-0d80bd17a30e/go.mod h1:nnELdKPRkUAQR6pAB3mRU3+IlbqL3SSaAWqQL8k/K+4= github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c h1:nXxl5PrvVm2L/wCy8dQu6DMTwH4oIuGN8GJDAlqDdVE= github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618 h1:7InQ7/zrOh6SlFjaXFubv0xX0HsuC9qJsdqm7bNQpYM= +github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618/go.mod h1:x8F1gnqOkIEiO4rqoeEEEqQbo7HjGMTvyoq3gej4iT0= github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.2 h1:3mYCb7aPxS/RU7TI1y4rkEn1oKmPRjNJLNEXgw7MH2I= @@ -143,10 +143,14 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1 github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 h1:b6uOv7YOFK0TYG7HtkIgExQo+2RdLuwRft63jn2HWj8= github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/tonistiigi/fsutil v0.0.0-20180925004926-70b709f90a17 h1:xH557TE2LeAcbG3xlTEYJAbN7M07xZ6HXFk8ZX8qO9Q= -github.com/tonistiigi/fsutil v0.0.0-20180925004926-70b709f90a17/go.mod h1:eden9dLzAAuNQ0L7whFr6/Mzgz6btsvQpUnxOOI+CCE= +github.com/tonistiigi/fsutil v0.0.0-20181011223333-2862f6bc5ac9 h1:w/+9MapoT4VpbsZzMILdG896EygCj14r82Tv1J7JFpw= +github.com/tonistiigi/fsutil v0.0.0-20181011223333-2862f6bc5ac9/go.mod h1:eden9dLzAAuNQ0L7whFr6/Mzgz6btsvQpUnxOOI+CCE= +github.com/tonistiigi/go-immutable-radix v0.0.0-20170803185627-826af9ccf0fe h1:pd7hrFSqUPxYS9IB+UMG1AB/8EXGXo17ssx0bSQ5L6Y= +github.com/tonistiigi/go-immutable-radix v0.0.0-20170803185627-826af9ccf0fe/go.mod h1:/+MCh11CJf2oz0BXmlmqyopK/ad1rKkcOXPoYuPCJYU= github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea h1:SXhTLE6pb6eld/v/cCndK0AMpt1wiVFb/YYmqB3/QG0= github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6cRcDZSUvVmezrxJPkiO87ThFYsoUiMwWNDJk= +github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/vishvananda/netlink v1.0.0 h1:bqNY2lgheFIu1meHUFSH3d7vG93AFyqg3oGbJCOJgSM= github.com/vishvananda/netlink v1.0.0/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc h1:R83G5ikgLMxrBvLh22JhdfI8K6YXEPHx5P03Uu3DRs4= diff --git a/vendor/github.com/hashicorp/go-immutable-radix/go.mod b/vendor/github.com/hashicorp/go-immutable-radix/go.mod deleted file mode 100644 index f6490e93f..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/go.mod +++ /dev/null @@ -1,6 +0,0 @@ -module github.com/tonistiigi/go-immutable-radix - -require ( - github.com/hashicorp/golang-lru v0.5.0 - github.com/hashicorp/uuid v0.0.0-20160311170451-ebb0a03e909c -) diff --git a/vendor/github.com/hashicorp/go-immutable-radix/go.sum b/vendor/github.com/hashicorp/go-immutable-radix/go.sum deleted file mode 100644 index ff5b33d46..000000000 --- a/vendor/github.com/hashicorp/go-immutable-radix/go.sum +++ /dev/null @@ -1,4 +0,0 @@ -github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/uuid v0.0.0-20160311170451-ebb0a03e909c h1:nQcv325vxv2fFHJsOt53eSRf1eINt6vOdYUFfXs4rgk= -github.com/hashicorp/uuid v0.0.0-20160311170451-ebb0a03e909c/go.mod h1:fHzc09UnyJyqyW+bFuq864eh+wC7dj65aXmXLRe5to0= diff --git a/vendor/github.com/moby/buildkit/cache/blobs/blobs.go b/vendor/github.com/moby/buildkit/cache/blobs/blobs.go index 69e172413..a1e1b6069 100644 --- a/vendor/github.com/moby/buildkit/cache/blobs/blobs.go +++ b/vendor/github.com/moby/buildkit/cache/blobs/blobs.go @@ -115,7 +115,7 @@ func getDiffPairs(ctx context.Context, contentStore content.Store, snapshotter s } diffIDStr, ok := info.Labels[containerdUncompressed] if !ok { - return nil, errors.Errorf("invalid differ response with no diffID") + return nil, errors.Errorf("invalid differ response with no diffID: %v", descr.Digest) } diffIDDigest, err := digest.Parse(diffIDStr) if err != nil { diff --git a/vendor/github.com/moby/buildkit/cache/contenthash/checksum.go b/vendor/github.com/moby/buildkit/cache/contenthash/checksum.go index 478901c76..35199e02f 100644 --- a/vendor/github.com/moby/buildkit/cache/contenthash/checksum.go +++ b/vendor/github.com/moby/buildkit/cache/contenthash/checksum.go @@ -19,6 +19,7 @@ import ( digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" "github.com/tonistiigi/fsutil" + fstypes "github.com/tonistiigi/fsutil/types" ) var errNotFound = errors.Errorf("not found") @@ -274,7 +275,7 @@ func (cc *cacheContext) HandleChange(kind fsutil.ChangeKind, p string, fi os.Fil return } - stat, ok := fi.Sys().(*fsutil.Stat) + stat, ok := fi.Sys().(*fstypes.Stat) if !ok { return errors.Errorf("%s invalid change without stat information", p) } diff --git a/vendor/github.com/moby/buildkit/cache/contenthash/filehash.go b/vendor/github.com/moby/buildkit/cache/contenthash/filehash.go index 46c15cc6d..84018e785 100644 --- a/vendor/github.com/moby/buildkit/cache/contenthash/filehash.go +++ b/vendor/github.com/moby/buildkit/cache/contenthash/filehash.go @@ -8,7 +8,7 @@ import ( "path/filepath" "time" - "github.com/tonistiigi/fsutil" + fstypes "github.com/tonistiigi/fsutil/types" ) // NewFileHash returns new hash that is used for the builder cache keys @@ -22,7 +22,7 @@ func NewFileHash(path string, fi os.FileInfo) (hash.Hash, error) { } } - stat := &fsutil.Stat{ + stat := &fstypes.Stat{ Mode: uint32(fi.Mode()), Size_: fi.Size(), ModTime: fi.ModTime().UnixNano(), @@ -39,7 +39,7 @@ func NewFileHash(path string, fi os.FileInfo) (hash.Hash, error) { return NewFromStat(stat) } -func NewFromStat(stat *fsutil.Stat) (hash.Hash, error) { +func NewFromStat(stat *fstypes.Stat) (hash.Hash, error) { fi := &statInfo{stat} hdr, err := tar.FileInfoHeader(fi, stat.Linkname) if err != nil { @@ -75,7 +75,7 @@ func (tsh *tarsumHash) Reset() { } type statInfo struct { - *fsutil.Stat + *fstypes.Stat } func (s *statInfo) Name() string { diff --git a/vendor/github.com/moby/buildkit/cache/contenthash/filehash_unix.go b/vendor/github.com/moby/buildkit/cache/contenthash/filehash_unix.go index 0939112cb..4f610d772 100644 --- a/vendor/github.com/moby/buildkit/cache/contenthash/filehash_unix.go +++ b/vendor/github.com/moby/buildkit/cache/contenthash/filehash_unix.go @@ -7,7 +7,7 @@ import ( "syscall" "github.com/containerd/continuity/sysx" - "github.com/tonistiigi/fsutil" + fstypes "github.com/tonistiigi/fsutil/types" "golang.org/x/sys/unix" ) @@ -16,7 +16,7 @@ func chmodWindowsTarEntry(perm os.FileMode) os.FileMode { return perm } -func setUnixOpt(path string, fi os.FileInfo, stat *fsutil.Stat) error { +func setUnixOpt(path string, fi os.FileInfo, stat *fstypes.Stat) error { s := fi.Sys().(*syscall.Stat_t) stat.Uid = s.Uid diff --git a/vendor/github.com/moby/buildkit/cache/contenthash/filehash_windows.go b/vendor/github.com/moby/buildkit/cache/contenthash/filehash_windows.go index 340954aa3..e15bf1e5a 100644 --- a/vendor/github.com/moby/buildkit/cache/contenthash/filehash_windows.go +++ b/vendor/github.com/moby/buildkit/cache/contenthash/filehash_windows.go @@ -5,7 +5,7 @@ package contenthash import ( "os" - "github.com/tonistiigi/fsutil" + fstypes "github.com/tonistiigi/fsutil/types" ) // chmodWindowsTarEntry is used to adjust the file permissions used in tar @@ -18,6 +18,6 @@ func chmodWindowsTarEntry(perm os.FileMode) os.FileMode { return perm } -func setUnixOpt(path string, fi os.FileInfo, stat *fsutil.Stat) error { +func setUnixOpt(path string, fi os.FileInfo, stat *fstypes.Stat) error { return nil } diff --git a/vendor/github.com/moby/buildkit/cache/fsutil.go b/vendor/github.com/moby/buildkit/cache/fsutil.go deleted file mode 100644 index ec757d5e8..000000000 --- a/vendor/github.com/moby/buildkit/cache/fsutil.go +++ /dev/null @@ -1,71 +0,0 @@ -package cache - -import ( - "context" - "io" - "io/ioutil" - "os" - - "github.com/containerd/continuity/fs" - "github.com/moby/buildkit/snapshot" -) - -type ReadRequest struct { - Filename string - Range *FileRange -} - -type FileRange struct { - Offset int - Length int -} - -func ReadFile(ctx context.Context, ref ImmutableRef, req ReadRequest) ([]byte, error) { - mount, err := ref.Mount(ctx, true) - if err != nil { - return nil, err - } - - lm := snapshot.LocalMounter(mount) - - root, err := lm.Mount() - if err != nil { - return nil, err - } - - defer func() { - if lm != nil { - lm.Unmount() - } - }() - - fp, err := fs.RootPath(root, req.Filename) - if err != nil { - return nil, err - } - - var dt []byte - - if req.Range == nil { - dt, err = ioutil.ReadFile(fp) - if err != nil { - return nil, err - } - } else { - f, err := os.Open(fp) - if err != nil { - return nil, err - } - dt, err = ioutil.ReadAll(io.NewSectionReader(f, int64(req.Range.Offset), int64(req.Range.Length))) - f.Close() - if err != nil { - return nil, err - } - } - - if err := lm.Unmount(); err != nil { - return nil, err - } - lm = nil - return dt, err -} diff --git a/vendor/github.com/moby/buildkit/cache/util/fsutil.go b/vendor/github.com/moby/buildkit/cache/util/fsutil.go new file mode 100644 index 000000000..b7aa6730d --- /dev/null +++ b/vendor/github.com/moby/buildkit/cache/util/fsutil.go @@ -0,0 +1,139 @@ +package util + +import ( + "context" + "io" + "io/ioutil" + "os" + "path/filepath" + + "github.com/containerd/continuity/fs" + "github.com/moby/buildkit/cache" + "github.com/moby/buildkit/snapshot" + "github.com/pkg/errors" + "github.com/tonistiigi/fsutil" + fstypes "github.com/tonistiigi/fsutil/types" +) + +type ReadRequest struct { + Filename string + Range *FileRange +} + +type FileRange struct { + Offset int + Length int +} + +func withMount(ctx context.Context, ref cache.ImmutableRef, cb func(string) error) error { + mount, err := ref.Mount(ctx, true) + if err != nil { + return err + } + + lm := snapshot.LocalMounter(mount) + + root, err := lm.Mount() + if err != nil { + return err + } + + defer func() { + if lm != nil { + lm.Unmount() + } + }() + + if err := cb(root); err != nil { + return err + } + + if err := lm.Unmount(); err != nil { + return err + } + lm = nil + return nil +} + +func ReadFile(ctx context.Context, ref cache.ImmutableRef, req ReadRequest) ([]byte, error) { + var dt []byte + + err := withMount(ctx, ref, func(root string) error { + fp, err := fs.RootPath(root, req.Filename) + if err != nil { + return err + } + + if req.Range == nil { + dt, err = ioutil.ReadFile(fp) + if err != nil { + return err + } + } else { + f, err := os.Open(fp) + if err != nil { + return err + } + dt, err = ioutil.ReadAll(io.NewSectionReader(f, int64(req.Range.Offset), int64(req.Range.Length))) + f.Close() + if err != nil { + return err + } + } + return nil + }) + return dt, err +} + +type ReadDirRequest struct { + Path string + IncludePattern string +} + +func ReadDir(ctx context.Context, ref cache.ImmutableRef, req ReadDirRequest) ([]*fstypes.Stat, error) { + var ( + rd []*fstypes.Stat + wo fsutil.WalkOpt + ) + if req.IncludePattern != "" { + wo.IncludePatterns = append(wo.IncludePatterns, req.IncludePattern) + } + err := withMount(ctx, ref, func(root string) error { + fp, err := fs.RootPath(root, req.Path) + if err != nil { + return err + } + return fsutil.Walk(ctx, fp, &wo, func(path string, info os.FileInfo, err error) error { + if err != nil { + return errors.Wrapf(err, "walking %q", root) + } + stat, ok := info.Sys().(*fstypes.Stat) + if !ok { + // This "can't happen(tm)". + return errors.Errorf("expected a *fsutil.Stat but got %T", info.Sys()) + } + rd = append(rd, stat) + + if info.IsDir() { + return filepath.SkipDir + } + return nil + }) + }) + return rd, err +} + +func StatFile(ctx context.Context, ref cache.ImmutableRef, path string) (*fstypes.Stat, error) { + var st *fstypes.Stat + err := withMount(ctx, ref, func(root string) error { + fp, err := fs.RootPath(root, path) + if err != nil { + return err + } + if st, err = fsutil.Stat(fp); err != nil { + return err + } + return nil + }) + return st, err +} diff --git a/vendor/github.com/moby/buildkit/client/build.go b/vendor/github.com/moby/buildkit/client/build.go index 93059d139..f23df4450 100644 --- a/vendor/github.com/moby/buildkit/client/build.go +++ b/vendor/github.com/moby/buildkit/client/build.go @@ -84,6 +84,16 @@ func (g *gatewayClientForBuild) ReadFile(ctx context.Context, in *gatewayapi.Rea return g.gateway.ReadFile(ctx, in, opts...) } +func (g *gatewayClientForBuild) ReadDir(ctx context.Context, in *gatewayapi.ReadDirRequest, opts ...grpc.CallOption) (*gatewayapi.ReadDirResponse, error) { + ctx = buildid.AppendToOutgoingContext(ctx, g.buildID) + return g.gateway.ReadDir(ctx, in, opts...) +} + +func (g *gatewayClientForBuild) StatFile(ctx context.Context, in *gatewayapi.StatFileRequest, opts ...grpc.CallOption) (*gatewayapi.StatFileResponse, error) { + ctx = buildid.AppendToOutgoingContext(ctx, g.buildID) + return g.gateway.StatFile(ctx, in, opts...) +} + func (g *gatewayClientForBuild) Ping(ctx context.Context, in *gatewayapi.PingRequest, opts ...grpc.CallOption) (*gatewayapi.PongResponse, error) { ctx = buildid.AppendToOutgoingContext(ctx, g.buildID) return g.gateway.Ping(ctx, in, opts...) diff --git a/vendor/github.com/moby/buildkit/client/llb/exec.go b/vendor/github.com/moby/buildkit/client/llb/exec.go index a34e75ea1..8233b076e 100644 --- a/vendor/github.com/moby/buildkit/client/llb/exec.go +++ b/vendor/github.com/moby/buildkit/client/llb/exec.go @@ -7,6 +7,7 @@ import ( "sort" "github.com/moby/buildkit/solver/pb" + "github.com/moby/buildkit/util/system" digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" ) @@ -142,6 +143,13 @@ func (e *ExecOp) Marshal(c *Constraints) (digest.Digest, []byte, *pb.OpMetadata, e.meta.Env = e.meta.Env.AddOrReplace("SSH_AUTH_SOCK", e.ssh[0].Target) } } + if c.Caps != nil { + if err := c.Caps.Supports(pb.CapExecMetaSetsDefaultPath); err != nil { + e.meta.Env = e.meta.Env.SetDefault("PATH", system.DefaultPathEnv) + } else { + addCap(&e.constraints, pb.CapExecMetaSetsDefaultPath) + } + } meta := &pb.Meta{ Args: e.meta.Args, @@ -191,6 +199,14 @@ func (e *ExecOp) Marshal(c *Constraints) (digest.Digest, []byte, *pb.OpMetadata, } } + if len(e.secrets) > 0 { + addCap(&e.constraints, pb.CapExecMountSecret) + } + + if len(e.ssh) > 0 { + addCap(&e.constraints, pb.CapExecMountSSH) + } + pop, md := MarshalConstraints(c, &e.constraints) pop.Op = &pb.Op_Exec{ Exec: peo, @@ -258,10 +274,6 @@ func (e *ExecOp) Marshal(c *Constraints) (digest.Digest, []byte, *pb.OpMetadata, peo.Mounts = append(peo.Mounts, pm) } - if len(e.secrets) > 0 { - addCap(&e.constraints, pb.CapMountSecret) - } - for _, s := range e.secrets { pm := &pb.Mount{ Dest: s.Target, @@ -488,6 +500,12 @@ func SSHID(id string) SSHOption { }) } +func SSHSocketTarget(target string) SSHOption { + return sshOptionFunc(func(si *SSHInfo) { + si.Target = target + }) +} + func SSHSocketOpt(target string, uid, gid, mode int) SSHOption { return sshOptionFunc(func(si *SSHInfo) { si.Target = target diff --git a/vendor/github.com/moby/buildkit/client/llb/meta.go b/vendor/github.com/moby/buildkit/client/llb/meta.go index 25b788539..702ea1456 100644 --- a/vendor/github.com/moby/buildkit/client/llb/meta.go +++ b/vendor/github.com/moby/buildkit/client/llb/meta.go @@ -23,10 +23,6 @@ var ( keyNetwork = contextKeyT("llb.network") ) -func addEnv(key, value string) StateOption { - return addEnvf(key, value) -} - func addEnvf(key, value string, v ...interface{}) StateOption { return func(s State) State { return s.WithValue(keyEnv, getEnv(s).AddOrReplace(key, fmt.Sprintf(value, v...))) @@ -175,6 +171,13 @@ func (e EnvList) AddOrReplace(k, v string) EnvList { return e } +func (e EnvList) SetDefault(k, v string) EnvList { + if _, ok := e.Get(k); !ok { + e = append(e, KeyValue{key: k, value: v}) + } + return e +} + func (e EnvList) Delete(k string) EnvList { e = append([]KeyValue(nil), e...) if i, ok := e.Index(k); ok { diff --git a/vendor/github.com/moby/buildkit/client/llb/state.go b/vendor/github.com/moby/buildkit/client/llb/state.go index b5b8f1e11..15639fd3e 100644 --- a/vendor/github.com/moby/buildkit/client/llb/state.go +++ b/vendor/github.com/moby/buildkit/client/llb/state.go @@ -9,7 +9,6 @@ import ( "github.com/moby/buildkit/identity" "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/util/apicaps" - "github.com/moby/buildkit/util/system" digest "github.com/opencontainers/go-digest" specs "github.com/opencontainers/image-spec/specs-go/v1" ) @@ -34,7 +33,6 @@ func NewState(o Output) State { ctx: context.Background(), } s = dir("/")(s) - s = addEnv("PATH", system.DefaultPathEnv)(s) s = s.ensurePlatform() return s } @@ -411,6 +409,13 @@ func WithoutDefaultExportCache() ConstraintsOpt { }) } +// WithCaps exposes supported LLB caps to the marshaler +func WithCaps(caps apicaps.CapSet) ConstraintsOpt { + return constraintsOptFunc(func(c *Constraints) { + c.Caps = &caps + }) +} + type constraintsWrapper struct { Constraints } @@ -424,6 +429,7 @@ type Constraints struct { WorkerConstraints []string Metadata pb.OpMetadata LocalUniqueID string + Caps *apicaps.CapSet } func Platform(p specs.Platform) ConstraintsOpt { diff --git a/vendor/github.com/moby/buildkit/client/solve.go b/vendor/github.com/moby/buildkit/client/solve.go index a4267c09f..b8da06972 100644 --- a/vendor/github.com/moby/buildkit/client/solve.go +++ b/vendor/github.com/moby/buildkit/client/solve.go @@ -19,7 +19,7 @@ import ( opentracing "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" - "github.com/tonistiigi/fsutil" + fstypes "github.com/tonistiigi/fsutil/types" "golang.org/x/sync/errgroup" ) @@ -256,7 +256,7 @@ func prepareSyncedDirs(def *llb.Definition, localDirs map[string]string) ([]file return nil, errors.Errorf("%s not a directory", d) } } - resetUIDAndGID := func(st *fsutil.Stat) bool { + resetUIDAndGID := func(st *fstypes.Stat) bool { st.Uid = 0 st.Gid = 0 return true diff --git a/vendor/github.com/moby/buildkit/control/gateway/gateway.go b/vendor/github.com/moby/buildkit/control/gateway/gateway.go index 475d18b4a..074e73944 100644 --- a/vendor/github.com/moby/buildkit/control/gateway/gateway.go +++ b/vendor/github.com/moby/buildkit/control/gateway/gateway.go @@ -125,3 +125,19 @@ func (gwf *GatewayForwarder) Return(ctx context.Context, req *gwapi.ReturnReques res, err := fwd.Return(ctx, req) return res, err } + +func (gwf *GatewayForwarder) ReadDir(ctx context.Context, req *gwapi.ReadDirRequest) (*gwapi.ReadDirResponse, error) { + fwd, err := gwf.lookupForwarder(ctx) + if err != nil { + return nil, errors.Wrap(err, "forwarding ReadDir") + } + return fwd.ReadDir(ctx, req) +} + +func (gwf *GatewayForwarder) StatFile(ctx context.Context, req *gwapi.StatFileRequest) (*gwapi.StatFileResponse, error) { + fwd, err := gwf.lookupForwarder(ctx) + if err != nil { + return nil, errors.Wrap(err, "forwarding StatFile") + } + return fwd.StatFile(ctx, req) +} diff --git a/vendor/github.com/moby/buildkit/executor/oci/hosts.go b/vendor/github.com/moby/buildkit/executor/oci/hosts.go index 405d758d3..c350a6de2 100644 --- a/vendor/github.com/moby/buildkit/executor/oci/hosts.go +++ b/vendor/github.com/moby/buildkit/executor/oci/hosts.go @@ -13,7 +13,7 @@ import ( ) const hostsContent = ` -127.0.0.1 localhost +127.0.0.1 localhost buildkitsandbox ::1 localhost ip6-localhost ip6-loopback ` diff --git a/vendor/github.com/moby/buildkit/executor/oci/spec_unix.go b/vendor/github.com/moby/buildkit/executor/oci/spec_unix.go index 8a0610ee9..3e1976a69 100644 --- a/vendor/github.com/moby/buildkit/executor/oci/spec_unix.go +++ b/vendor/github.com/moby/buildkit/executor/oci/spec_unix.go @@ -44,11 +44,21 @@ func GenerateSpec(ctx context.Context, meta executor.Meta, mounts []executor.Mou s.Process.Args = meta.Args s.Process.Env = meta.Env s.Process.Cwd = meta.Cwd + s.Process.Rlimits = nil // reset open files limit + s.Hostname = "buildkitsandbox" s.Mounts = GetMounts(ctx, withROBind(resolvConf, "/etc/resolv.conf"), withROBind(hostsFile, "/etc/hosts"), ) + + s.Mounts = append(s.Mounts, specs.Mount{ + Destination: "/sys/fs/cgroup", + Type: "cgroup", + Source: "cgroup", + Options: []string{"ro", "nosuid", "noexec", "nodev"}, + }) + // TODO: User sm := &submounts{} diff --git a/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go b/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go index fbf827182..8080f5714 100644 --- a/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go +++ b/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go @@ -85,6 +85,10 @@ func New(opt Opt, networkProviders map[pb.NetMode]network.Provider) (executor.Ex return nil, err } + // clean up old hosts/resolv.conf file. ignore errors + os.RemoveAll(filepath.Join(root, "hosts")) + os.RemoveAll(filepath.Join(root, "resolv.conf")) + runtime := &runc.Runc{ Command: cmd, Log: filepath.Join(root, "runc-log.json"), @@ -263,7 +267,13 @@ func (w *runcExecutor) Exec(ctx context.Context, meta executor.Meta, root cache. } if status != 0 { - return errors.Errorf("exit code: %d", status) + err := errors.Errorf("exit code: %d", status) + select { + case <-ctx.Done(): + return errors.Wrapf(ctx.Err(), err.Error()) + default: + return err + } } return nil diff --git a/vendor/github.com/moby/buildkit/exporter/local/export.go b/vendor/github.com/moby/buildkit/exporter/local/export.go index 07b1e0fb4..8140af644 100644 --- a/vendor/github.com/moby/buildkit/exporter/local/export.go +++ b/vendor/github.com/moby/buildkit/exporter/local/export.go @@ -15,6 +15,7 @@ import ( "github.com/moby/buildkit/util/progress" "github.com/pkg/errors" "github.com/tonistiigi/fsutil" + fstypes "github.com/tonistiigi/fsutil/types" "golang.org/x/sync/errgroup" "golang.org/x/time/rate" ) @@ -92,7 +93,7 @@ func (e *localExporterInstance) Export(ctx context.Context, inp exporter.Source) lbl := "copying files" if isMap { lbl += " " + k - fs = fsutil.SubDirFS(fs, fsutil.Stat{ + fs = fsutil.SubDirFS(fs, fstypes.Stat{ Mode: uint32(os.ModeDir | 0755), Path: strings.Replace(k, "/", "_", -1), }) diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/builder/build.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/builder/build.go index bebe4852e..7e082df08 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/builder/build.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/builder/build.go @@ -48,6 +48,9 @@ var gitUrlPathWithFragmentSuffix = regexp.MustCompile("\\.git(?:#.+)?$") func Build(ctx context.Context, c client.Client) (*client.Result, error) { opts := c.BuildOpts().Opts + caps := c.BuildOpts().LLBCaps + + marshalOpts := []llb.ConstraintsOpt{llb.WithCaps(caps)} defaultBuildPlatform := platforms.DefaultSpec() if workers := c.BuildOpts().Workers; len(workers) > 0 && len(workers[0].Platforms) > 0 { @@ -93,10 +96,7 @@ func Build(ctx context.Context, c client.Client) (*client.Result, error) { } } - name := "load Dockerfile" - if filename != "Dockerfile" { - name += " from " + filename - } + name := "load build definition from " + filename src := llb.Local(LocalNameDockerfile, llb.IncludePatterns([]string{filename}), @@ -111,7 +111,7 @@ func Build(ctx context.Context, c client.Client) (*client.Result, error) { buildContext = &src } else if httpPrefix.MatchString(opts[LocalNameContext]) { httpContext := llb.HTTP(opts[LocalNameContext], llb.Filename("context"), dockerfile2llb.WithInternalName("load remote build context")) - def, err := httpContext.Marshal() + def, err := httpContext.Marshal(marshalOpts...) if err != nil { return nil, errors.Wrapf(err, "failed to marshal httpcontext") } @@ -154,7 +154,7 @@ func Build(ctx context.Context, c client.Client) (*client.Result, error) { } } - def, err := src.Marshal() + def, err := src.Marshal(marshalOpts...) if err != nil { return nil, errors.Wrapf(err, "failed to marshal local source") } @@ -195,7 +195,7 @@ func Build(ctx context.Context, c client.Client) (*client.Result, error) { ) dockerignoreState = &st } - def, err := dockerignoreState.Marshal() + def, err := dockerignoreState.Marshal(marshalOpts...) if err != nil { return err } @@ -272,6 +272,7 @@ func Build(ctx context.Context, c client.Client) (*client.Result, error) { ExtraHosts: extraHosts, ForceNetMode: defaultNetMode, OverrideCopyImage: opts[keyOverrideCopyImage], + LLBCaps: &caps, }) if err != nil { diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go index b2fe8b293..5342046d7 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go @@ -23,6 +23,7 @@ import ( "github.com/moby/buildkit/frontend/dockerfile/shell" gw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/solver/pb" + "github.com/moby/buildkit/util/apicaps" "github.com/moby/buildkit/util/system" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" @@ -34,7 +35,7 @@ const ( localNameContext = "context" historyComment = "buildkit.dockerfile.v0" - DefaultCopyImage = "tonistiigi/copy:v0.1.4@sha256:d9d49bedbbe2b27df88115e6aff7b9cd11ed2fbd8d9013f02d3da735c08c92e5" + DefaultCopyImage = "tonistiigi/copy:v0.1.7@sha256:9aab7d9ab369c6daf4831bf0653f7592110ab4b7e8a33fee2b9dca546e9d3089" ) type ConvertOpt struct { @@ -57,6 +58,7 @@ type ConvertOpt struct { ExtraHosts []llb.HostIP ForceNetMode pb.NetMode OverrideCopyImage string + LLBCaps *apicaps.CapSet } func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State, *Image, error) { @@ -210,7 +212,7 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State, eg.Go(func() error { ref, err := reference.ParseNormalizedNamed(d.stage.BaseName) if err != nil { - return err + return errors.Wrapf(err, "failed to parse stage name %q", d.stage.BaseName) } platform := d.platform if platform == nil { @@ -368,7 +370,13 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State, } buildContext.Output = bc.Output() - st := target.state.SetMarshalDefaults(llb.Platform(platformOpt.targetPlatform)) + defaults := []llb.ConstraintsOpt{ + llb.Platform(platformOpt.targetPlatform), + } + if opt.LLBCaps != nil { + defaults = append(defaults, llb.WithCaps(*opt.LLBCaps)) + } + st := target.state.SetMarshalDefaults(defaults...) if !platformOpt.implicitTarget { target.image.OS = platformOpt.targetPlatform.OS @@ -600,8 +608,10 @@ func dispatchRun(d *dispatchState, c *instructions.RunCommand, proxy *llb.ProxyE if c.PrependShell { args = withShell(d.image, args) } + env := d.state.Env() opt := []llb.RunOption{llb.Args(args)} for _, arg := range d.buildArgs { + env = append(env, fmt.Sprintf("%s=%s", arg.Key, arg.ValueString())) opt = append(opt, llb.AddEnv(arg.Key, arg.ValueString())) } opt = append(opt, dfCmd(c)) @@ -617,7 +627,7 @@ func dispatchRun(d *dispatchState, c *instructions.RunCommand, proxy *llb.ProxyE return err } opt = append(opt, runMounts...) - opt = append(opt, llb.WithCustomName(prefixCommand(d, uppercaseCmd(processCmdEnv(dopt.shlex, c.String(), d.state.Run(opt...).Env())), d.prefixPlatform, d.state.GetPlatform()))) + opt = append(opt, llb.WithCustomName(prefixCommand(d, uppercaseCmd(processCmdEnv(dopt.shlex, c.String(), env)), d.prefixPlatform, d.state.GetPlatform()))) for _, h := range dopt.extraHosts { opt = append(opt, llb.AddExtraHost(h.Host, h.IP)) } @@ -643,7 +653,7 @@ func dispatchCopy(d *dispatchState, c instructions.SourcesAndDest, sourceState l img := llb.Image(opt.copyImage, llb.MarkImageInternal, llb.Platform(opt.buildPlatforms[0]), WithInternalName("helper image for file operations")) dest := path.Join(".", pathRelativeToWorkingDir(d.state, c.Dest())) - if c.Dest() == "." || c.Dest()[len(c.Dest())-1] == filepath.Separator { + if c.Dest() == "." || c.Dest() == "" || c.Dest()[len(c.Dest())-1] == filepath.Separator { dest += string(filepath.Separator) } args := []string{"copy"} diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_norunmount.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_norunmount.go index d7643405a..5f0cd0860 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_norunmount.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_norunmount.go @@ -1,4 +1,4 @@ -// +build !dfrunmount,!dfextall +// +build !dfrunmount package dockerfile2llb diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_nossh.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_nossh.go new file mode 100644 index 000000000..8b8afdc38 --- /dev/null +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_nossh.go @@ -0,0 +1,13 @@ +// +build dfrunmount,!dfssh + +package dockerfile2llb + +import ( + "github.com/moby/buildkit/client/llb" + "github.com/moby/buildkit/frontend/dockerfile/instructions" + "github.com/pkg/errors" +) + +func dispatchSSH(m *instructions.Mount) (llb.RunOption, error) { + return nil, errors.Errorf("ssh mounts not allowed") +} diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_runmount.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_runmount.go index e42c8614e..8214e188e 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_runmount.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_runmount.go @@ -1,4 +1,4 @@ -// +build dfrunmount dfextall +// +build dfrunmount package dockerfile2llb @@ -65,6 +65,14 @@ func dispatchRunMounts(d *dispatchState, c *instructions.RunCommand, sources []* out = append(out, secret) continue } + if mount.Type == instructions.MountTypeSSH { + ssh, err := dispatchSSH(mount) + if err != nil { + return nil, err + } + out = append(out, ssh) + continue + } if mount.ReadOnly { mountOpts = append(mountOpts, llb.Readonly) } diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_secrets.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_secrets.go index 2f6ba584f..3e354d5b6 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_secrets.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_secrets.go @@ -1,4 +1,4 @@ -// +build dfsecrets dfextall +// +build dfsecrets package dockerfile2llb diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_ssh.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_ssh.go new file mode 100644 index 000000000..e7606ff5a --- /dev/null +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_ssh.go @@ -0,0 +1,27 @@ +// +build dfssh + +package dockerfile2llb + +import ( + "github.com/moby/buildkit/client/llb" + "github.com/moby/buildkit/frontend/dockerfile/instructions" + "github.com/pkg/errors" +) + +func dispatchSSH(m *instructions.Mount) (llb.RunOption, error) { + if m.Source != "" { + return nil, errors.Errorf("ssh does not support source") + } + opts := []llb.SSHOption{llb.SSHID(m.CacheID)} + + if m.Target != "" { + // TODO(AkihiroSuda): support specifying permission bits + opts = append(opts, llb.SSHSocketTarget(m.Target)) + } + + if !m.Required { + opts = append(opts, llb.SSHOptional) + } + + return llb.AddSSHSocket(opts...), nil +} diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_nossh.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_nossh.go new file mode 100644 index 000000000..a131a273c --- /dev/null +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_nossh.go @@ -0,0 +1,7 @@ +// +build !dfssh + +package instructions + +func isSSHMountsSupported() bool { + return false +} diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_runmount.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_runmount.go index 8cccb76ae..c5db70fec 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_runmount.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_runmount.go @@ -1,4 +1,4 @@ -// +build dfrunmount dfextall +// +build dfrunmount package instructions @@ -14,12 +14,14 @@ const MountTypeBind = "bind" const MountTypeCache = "cache" const MountTypeTmpfs = "tmpfs" const MountTypeSecret = "secret" +const MountTypeSSH = "ssh" var allowedMountTypes = map[string]struct{}{ MountTypeBind: {}, MountTypeCache: {}, MountTypeTmpfs: {}, MountTypeSecret: {}, + MountTypeSSH: {}, } const MountSharingShared = "shared" @@ -47,6 +49,11 @@ func isValidMountType(s string) bool { return false } } + if s == "ssh" { + if !isSSHMountsSupported() { + return false + } + } _, ok := allowedMountTypes[s] return ok } @@ -129,7 +136,7 @@ func parseMount(value string) (*Mount, error) { roAuto = false continue case "required": - if m.Type == "secret" { + if m.Type == "secret" || m.Type == "ssh" { m.Required = true continue } diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_secrets.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_secrets.go index 63b3e215a..6cce1191d 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_secrets.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_secrets.go @@ -1,4 +1,4 @@ -// +build dfsecrets dfextall +// +build dfsecrets package instructions diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_ssh.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_ssh.go new file mode 100644 index 000000000..0b94a5644 --- /dev/null +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_ssh.go @@ -0,0 +1,7 @@ +// +build dfssh + +package instructions + +func isSSHMountsSupported() bool { + return true +} diff --git a/vendor/github.com/moby/buildkit/frontend/gateway/client/client.go b/vendor/github.com/moby/buildkit/frontend/gateway/client/client.go index a300a1208..372353879 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/client/client.go +++ b/vendor/github.com/moby/buildkit/frontend/gateway/client/client.go @@ -4,8 +4,10 @@ import ( "context" "github.com/moby/buildkit/solver/pb" + "github.com/moby/buildkit/util/apicaps" digest "github.com/opencontainers/go-digest" specs "github.com/opencontainers/image-spec/specs-go/v1" + fstypes "github.com/tonistiigi/fsutil/types" ) type Client interface { @@ -16,8 +18,8 @@ type Client interface { type Reference interface { ReadFile(ctx context.Context, req ReadRequest) ([]byte, error) - // StatFile(ctx context.Context, req StatRequest) (*StatResponse, error) - // ReadDir(ctx context.Context, req ReadDirRequest) ([]*StatResponse, error) + StatFile(ctx context.Context, req StatRequest) (*fstypes.Stat, error) + ReadDir(ctx context.Context, req ReadDirRequest) ([]*fstypes.Stat, error) } type ReadRequest struct { @@ -30,6 +32,15 @@ type FileRange struct { Length int } +type ReadDirRequest struct { + Path string + IncludePattern string +} + +type StatRequest struct { + Path string +} + // SolveRequest is same as frontend.SolveRequest but avoiding dependency type SolveRequest struct { Definition *pb.Definition @@ -49,6 +60,8 @@ type BuildOpts struct { SessionID string Workers []WorkerInfo Product string + LLBCaps apicaps.CapSet + Caps apicaps.CapSet } type ResolveImageConfigOpt struct { diff --git a/vendor/github.com/moby/buildkit/frontend/gateway/forwarder/forward.go b/vendor/github.com/moby/buildkit/frontend/gateway/forwarder/forward.go index a95f7bbaa..23eb227fb 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/forwarder/forward.go +++ b/vendor/github.com/moby/buildkit/frontend/gateway/forwarder/forward.go @@ -5,14 +5,18 @@ import ( "sync" "github.com/moby/buildkit/cache" + cacheutil "github.com/moby/buildkit/cache/util" clienttypes "github.com/moby/buildkit/client" "github.com/moby/buildkit/frontend" "github.com/moby/buildkit/frontend/gateway/client" + gwpb "github.com/moby/buildkit/frontend/gateway/pb" "github.com/moby/buildkit/session" "github.com/moby/buildkit/solver" + opspb "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/util/apicaps" "github.com/moby/buildkit/worker" "github.com/pkg/errors" + fstypes "github.com/tonistiigi/fsutil/types" ) func llbBridgeToGatewayClient(ctx context.Context, llbBridge frontend.FrontendLLBBridge, opts map[string]string, workerInfos []clienttypes.WorkerInfo) (*bridgeClient, error) { @@ -79,6 +83,8 @@ func (c *bridgeClient) BuildOpts() client.BuildOpts { SessionID: c.sid, Workers: workers, Product: apicaps.ExportedProduct, + Caps: gwpb.Caps.CapSet(gwpb.Caps.All()), + LLBCaps: opspb.Caps.CapSet(opspb.Caps.All()), } } @@ -132,16 +138,36 @@ func (r *ref) ReadFile(ctx context.Context, req client.ReadRequest) ([]byte, err if err != nil { return nil, err } - newReq := cache.ReadRequest{ + newReq := cacheutil.ReadRequest{ Filename: req.Filename, } if r := req.Range; r != nil { - newReq.Range = &cache.FileRange{ + newReq.Range = &cacheutil.FileRange{ Offset: r.Offset, Length: r.Length, } } - return cache.ReadFile(ctx, ref, newReq) + return cacheutil.ReadFile(ctx, ref, newReq) +} + +func (r *ref) ReadDir(ctx context.Context, req client.ReadDirRequest) ([]*fstypes.Stat, error) { + ref, err := r.getImmutableRef() + if err != nil { + return nil, err + } + newReq := cacheutil.ReadDirRequest{ + Path: req.Path, + IncludePattern: req.IncludePattern, + } + return cacheutil.ReadDir(ctx, ref, newReq) +} + +func (r *ref) StatFile(ctx context.Context, req client.StatRequest) (*fstypes.Stat, error) { + ref, err := r.getImmutableRef() + if err != nil { + return nil, err + } + return cacheutil.StatFile(ctx, ref, req.Path) } func (r *ref) getImmutableRef() (cache.ImmutableRef, error) { diff --git a/vendor/github.com/moby/buildkit/frontend/gateway/gateway.go b/vendor/github.com/moby/buildkit/frontend/gateway/gateway.go index f5cceeb8b..18a28b018 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/gateway.go +++ b/vendor/github.com/moby/buildkit/frontend/gateway/gateway.go @@ -14,6 +14,7 @@ import ( "github.com/docker/distribution/reference" apitypes "github.com/moby/buildkit/api/types" "github.com/moby/buildkit/cache" + cacheutil "github.com/moby/buildkit/cache/util" "github.com/moby/buildkit/client" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/executor" @@ -479,24 +480,24 @@ func (lbf *llbBridgeForwarder) ReadFile(ctx context.Context, req *pb.ReadFileReq return nil, errors.Errorf("no such ref: %v", req.Ref) } if ref == nil { - return nil, errors.Wrapf(os.ErrNotExist, "%s no found", req.FilePath) + return nil, errors.Wrapf(os.ErrNotExist, "%s not found", req.FilePath) } workerRef, ok := ref.Sys().(*worker.WorkerRef) if !ok { return nil, errors.Errorf("invalid ref: %T", ref.Sys()) } - newReq := cache.ReadRequest{ + newReq := cacheutil.ReadRequest{ Filename: req.FilePath, } if r := req.Range; r != nil { - newReq.Range = &cache.FileRange{ + newReq.Range = &cacheutil.FileRange{ Offset: int(r.Offset), Length: int(r.Length), } } - dt, err := cache.ReadFile(ctx, workerRef.ImmutableRef, newReq) + dt, err := cacheutil.ReadFile(ctx, workerRef.ImmutableRef, newReq) if err != nil { return nil, err } @@ -504,6 +505,58 @@ func (lbf *llbBridgeForwarder) ReadFile(ctx context.Context, req *pb.ReadFileReq return &pb.ReadFileResponse{Data: dt}, nil } +func (lbf *llbBridgeForwarder) ReadDir(ctx context.Context, req *pb.ReadDirRequest) (*pb.ReadDirResponse, error) { + ctx = tracing.ContextWithSpanFromContext(ctx, lbf.callCtx) + lbf.mu.Lock() + ref, ok := lbf.refs[req.Ref] + lbf.mu.Unlock() + if !ok { + return nil, errors.Errorf("no such ref: %v", req.Ref) + } + if ref == nil { + return nil, errors.Wrapf(os.ErrNotExist, "%s not found", req.DirPath) + } + workerRef, ok := ref.Sys().(*worker.WorkerRef) + if !ok { + return nil, errors.Errorf("invalid ref: %T", ref.Sys()) + } + + newReq := cacheutil.ReadDirRequest{ + Path: req.DirPath, + IncludePattern: req.IncludePattern, + } + entries, err := cacheutil.ReadDir(ctx, workerRef.ImmutableRef, newReq) + if err != nil { + return nil, err + } + + return &pb.ReadDirResponse{Entries: entries}, nil +} + +func (lbf *llbBridgeForwarder) StatFile(ctx context.Context, req *pb.StatFileRequest) (*pb.StatFileResponse, error) { + ctx = tracing.ContextWithSpanFromContext(ctx, lbf.callCtx) + lbf.mu.Lock() + ref, ok := lbf.refs[req.Ref] + lbf.mu.Unlock() + if !ok { + return nil, errors.Errorf("no such ref: %v", req.Ref) + } + if ref == nil { + return nil, errors.Wrapf(os.ErrNotExist, "%s not found", req.Path) + } + workerRef, ok := ref.Sys().(*worker.WorkerRef) + if !ok { + return nil, errors.Errorf("invalid ref: %T", ref.Sys()) + } + + st, err := cacheutil.StatFile(ctx, workerRef.ImmutableRef, req.Path) + if err != nil { + return nil, err + } + + return &pb.StatFileResponse{Stat: st}, nil +} + func (lbf *llbBridgeForwarder) Ping(context.Context, *pb.PingRequest) (*pb.PongResponse, error) { workers := lbf.workers.WorkerInfos() diff --git a/vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go b/vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go index deb81008b..d4e0525d8 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go +++ b/vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go @@ -16,6 +16,7 @@ import ( "github.com/moby/buildkit/util/apicaps" digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" + fstypes "github.com/tonistiigi/fsutil/types" "google.golang.org/grpc" "google.golang.org/grpc/status" ) @@ -207,7 +208,7 @@ func defaultLLBCaps() []apicaps.PBCap { {ID: string(opspb.CapExecMountCacheSharing), Enabled: true}, {ID: string(opspb.CapExecMountSelector), Enabled: true}, {ID: string(opspb.CapExecMountTmpfs), Enabled: true}, - {ID: string(opspb.CapMountSecret), Enabled: true}, + {ID: string(opspb.CapExecMountSecret), Enabled: true}, {ID: string(opspb.CapConstraints), Enabled: true}, {ID: string(opspb.CapPlatform), Enabled: true}, {ID: string(opspb.CapMetaIgnoreCache), Enabled: true}, @@ -329,21 +330,11 @@ func (c *grpcClient) BuildOpts() client.BuildOpts { SessionID: c.sessionID, Workers: c.workers, Product: c.product, + LLBCaps: c.llbCaps, + Caps: c.caps, } } -func (c *grpcClient) Opts() map[string]string { - return c.opts -} - -func (c *grpcClient) SessionID() string { - return c.sessionID -} - -func (c *grpcClient) WorkerInfos() []client.WorkerInfo { - return c.workers -} - type reference struct { id string c *grpcClient @@ -364,6 +355,37 @@ func (r *reference) ReadFile(ctx context.Context, req client.ReadRequest) ([]byt return resp.Data, nil } +func (r *reference) ReadDir(ctx context.Context, req client.ReadDirRequest) ([]*fstypes.Stat, error) { + if err := r.c.caps.Supports(pb.CapReadDir); err != nil { + return nil, err + } + rdr := &pb.ReadDirRequest{ + DirPath: req.Path, + IncludePattern: req.IncludePattern, + Ref: r.id, + } + resp, err := r.c.client.ReadDir(ctx, rdr) + if err != nil { + return nil, err + } + return resp.Entries, nil +} + +func (r *reference) StatFile(ctx context.Context, req client.StatRequest) (*fstypes.Stat, error) { + if err := r.c.caps.Supports(pb.CapStatFile); err != nil { + return nil, err + } + rdr := &pb.StatFileRequest{ + Path: req.Path, + Ref: r.id, + } + resp, err := r.c.client.StatFile(ctx, rdr) + if err != nil { + return nil, err + } + return resp.Stat, nil +} + func grpcClientConn(ctx context.Context) (context.Context, *grpc.ClientConn, error) { dialOpt := grpc.WithDialer(func(addr string, d time.Duration) (net.Conn, error) { return stdioConn(), nil diff --git a/vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go b/vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go index f44076899..fd05e4c81 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go +++ b/vendor/github.com/moby/buildkit/frontend/gateway/pb/caps.go @@ -16,6 +16,8 @@ const ( CapReadFile apicaps.CapID = "readfile" CapReturnResult apicaps.CapID = "return" CapReturnMap apicaps.CapID = "returnmap" + CapReadDir apicaps.CapID = "readdir" + CapStatFile apicaps.CapID = "statfile" ) func init() { @@ -69,4 +71,17 @@ func init() { Status: apicaps.CapStatusExperimental, }) + Caps.Init(apicaps.Cap{ + ID: CapReadDir, + Name: "read static directory", + Enabled: true, + Status: apicaps.CapStatusExperimental, + }) + + Caps.Init(apicaps.Cap{ + ID: CapStatFile, + Name: "stat a file", + Enabled: true, + Status: apicaps.CapStatusExperimental, + }) } diff --git a/vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.pb.go b/vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.pb.go index 2895a4b77..cf90c8a26 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.pb.go +++ b/vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.pb.go @@ -19,6 +19,10 @@ ReadFileRequest FileRange ReadFileResponse + ReadDirRequest + ReadDirResponse + StatFileRequest + StatFileResponse PingRequest PongResponse */ @@ -32,6 +36,7 @@ import google_rpc "github.com/gogo/googleapis/google/rpc" import pb "github.com/moby/buildkit/solver/pb" import moby_buildkit_v1_types "github.com/moby/buildkit/api/types" import moby_buildkit_v1_apicaps "github.com/moby/buildkit/util/apicaps/pb" +import fsutil_types "github.com/tonistiigi/fsutil/types" import github_com_opencontainers_go_digest "github.com/opencontainers/go-digest" @@ -448,13 +453,101 @@ func (m *ReadFileResponse) GetData() []byte { return nil } +type ReadDirRequest struct { + Ref string `protobuf:"bytes,1,opt,name=Ref,proto3" json:"Ref,omitempty"` + DirPath string `protobuf:"bytes,2,opt,name=DirPath,proto3" json:"DirPath,omitempty"` + IncludePattern string `protobuf:"bytes,3,opt,name=IncludePattern,proto3" json:"IncludePattern,omitempty"` +} + +func (m *ReadDirRequest) Reset() { *m = ReadDirRequest{} } +func (m *ReadDirRequest) String() string { return proto.CompactTextString(m) } +func (*ReadDirRequest) ProtoMessage() {} +func (*ReadDirRequest) Descriptor() ([]byte, []int) { return fileDescriptorGateway, []int{11} } + +func (m *ReadDirRequest) GetRef() string { + if m != nil { + return m.Ref + } + return "" +} + +func (m *ReadDirRequest) GetDirPath() string { + if m != nil { + return m.DirPath + } + return "" +} + +func (m *ReadDirRequest) GetIncludePattern() string { + if m != nil { + return m.IncludePattern + } + return "" +} + +type ReadDirResponse struct { + Entries []*fsutil_types.Stat `protobuf:"bytes,1,rep,name=entries" json:"entries,omitempty"` +} + +func (m *ReadDirResponse) Reset() { *m = ReadDirResponse{} } +func (m *ReadDirResponse) String() string { return proto.CompactTextString(m) } +func (*ReadDirResponse) ProtoMessage() {} +func (*ReadDirResponse) Descriptor() ([]byte, []int) { return fileDescriptorGateway, []int{12} } + +func (m *ReadDirResponse) GetEntries() []*fsutil_types.Stat { + if m != nil { + return m.Entries + } + return nil +} + +type StatFileRequest struct { + Ref string `protobuf:"bytes,1,opt,name=Ref,proto3" json:"Ref,omitempty"` + Path string `protobuf:"bytes,2,opt,name=Path,proto3" json:"Path,omitempty"` +} + +func (m *StatFileRequest) Reset() { *m = StatFileRequest{} } +func (m *StatFileRequest) String() string { return proto.CompactTextString(m) } +func (*StatFileRequest) ProtoMessage() {} +func (*StatFileRequest) Descriptor() ([]byte, []int) { return fileDescriptorGateway, []int{13} } + +func (m *StatFileRequest) GetRef() string { + if m != nil { + return m.Ref + } + return "" +} + +func (m *StatFileRequest) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +type StatFileResponse struct { + Stat *fsutil_types.Stat `protobuf:"bytes,1,opt,name=stat" json:"stat,omitempty"` +} + +func (m *StatFileResponse) Reset() { *m = StatFileResponse{} } +func (m *StatFileResponse) String() string { return proto.CompactTextString(m) } +func (*StatFileResponse) ProtoMessage() {} +func (*StatFileResponse) Descriptor() ([]byte, []int) { return fileDescriptorGateway, []int{14} } + +func (m *StatFileResponse) GetStat() *fsutil_types.Stat { + if m != nil { + return m.Stat + } + return nil +} + type PingRequest struct { } func (m *PingRequest) Reset() { *m = PingRequest{} } func (m *PingRequest) String() string { return proto.CompactTextString(m) } func (*PingRequest) ProtoMessage() {} -func (*PingRequest) Descriptor() ([]byte, []int) { return fileDescriptorGateway, []int{11} } +func (*PingRequest) Descriptor() ([]byte, []int) { return fileDescriptorGateway, []int{15} } type PongResponse struct { FrontendAPICaps []moby_buildkit_v1_apicaps.APICap `protobuf:"bytes,1,rep,name=FrontendAPICaps" json:"FrontendAPICaps"` @@ -465,7 +558,7 @@ type PongResponse struct { func (m *PongResponse) Reset() { *m = PongResponse{} } func (m *PongResponse) String() string { return proto.CompactTextString(m) } func (*PongResponse) ProtoMessage() {} -func (*PongResponse) Descriptor() ([]byte, []int) { return fileDescriptorGateway, []int{12} } +func (*PongResponse) Descriptor() ([]byte, []int) { return fileDescriptorGateway, []int{16} } func (m *PongResponse) GetFrontendAPICaps() []moby_buildkit_v1_apicaps.APICap { if m != nil { @@ -500,6 +593,10 @@ func init() { proto.RegisterType((*ReadFileRequest)(nil), "moby.buildkit.v1.frontend.ReadFileRequest") proto.RegisterType((*FileRange)(nil), "moby.buildkit.v1.frontend.FileRange") proto.RegisterType((*ReadFileResponse)(nil), "moby.buildkit.v1.frontend.ReadFileResponse") + proto.RegisterType((*ReadDirRequest)(nil), "moby.buildkit.v1.frontend.ReadDirRequest") + proto.RegisterType((*ReadDirResponse)(nil), "moby.buildkit.v1.frontend.ReadDirResponse") + proto.RegisterType((*StatFileRequest)(nil), "moby.buildkit.v1.frontend.StatFileRequest") + proto.RegisterType((*StatFileResponse)(nil), "moby.buildkit.v1.frontend.StatFileResponse") proto.RegisterType((*PingRequest)(nil), "moby.buildkit.v1.frontend.PingRequest") proto.RegisterType((*PongResponse)(nil), "moby.buildkit.v1.frontend.PongResponse") } @@ -521,6 +618,10 @@ type LLBBridgeClient interface { Solve(ctx context.Context, in *SolveRequest, opts ...grpc.CallOption) (*SolveResponse, error) // apicaps:CapReadFile ReadFile(ctx context.Context, in *ReadFileRequest, opts ...grpc.CallOption) (*ReadFileResponse, error) + // apicaps:CapReadDir + ReadDir(ctx context.Context, in *ReadDirRequest, opts ...grpc.CallOption) (*ReadDirResponse, error) + // apicaps:CapStatFile + StatFile(ctx context.Context, in *StatFileRequest, opts ...grpc.CallOption) (*StatFileResponse, error) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error) Return(ctx context.Context, in *ReturnRequest, opts ...grpc.CallOption) (*ReturnResponse, error) } @@ -560,6 +661,24 @@ func (c *lLBBridgeClient) ReadFile(ctx context.Context, in *ReadFileRequest, opt return out, nil } +func (c *lLBBridgeClient) ReadDir(ctx context.Context, in *ReadDirRequest, opts ...grpc.CallOption) (*ReadDirResponse, error) { + out := new(ReadDirResponse) + err := grpc.Invoke(ctx, "/moby.buildkit.v1.frontend.LLBBridge/ReadDir", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *lLBBridgeClient) StatFile(ctx context.Context, in *StatFileRequest, opts ...grpc.CallOption) (*StatFileResponse, error) { + out := new(StatFileResponse) + err := grpc.Invoke(ctx, "/moby.buildkit.v1.frontend.LLBBridge/StatFile", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *lLBBridgeClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error) { out := new(PongResponse) err := grpc.Invoke(ctx, "/moby.buildkit.v1.frontend.LLBBridge/Ping", in, out, c.cc, opts...) @@ -587,6 +706,10 @@ type LLBBridgeServer interface { Solve(context.Context, *SolveRequest) (*SolveResponse, error) // apicaps:CapReadFile ReadFile(context.Context, *ReadFileRequest) (*ReadFileResponse, error) + // apicaps:CapReadDir + ReadDir(context.Context, *ReadDirRequest) (*ReadDirResponse, error) + // apicaps:CapStatFile + StatFile(context.Context, *StatFileRequest) (*StatFileResponse, error) Ping(context.Context, *PingRequest) (*PongResponse, error) Return(context.Context, *ReturnRequest) (*ReturnResponse, error) } @@ -649,6 +772,42 @@ func _LLBBridge_ReadFile_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _LLBBridge_ReadDir_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReadDirRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LLBBridgeServer).ReadDir(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/moby.buildkit.v1.frontend.LLBBridge/ReadDir", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LLBBridgeServer).ReadDir(ctx, req.(*ReadDirRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _LLBBridge_StatFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LLBBridgeServer).StatFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/moby.buildkit.v1.frontend.LLBBridge/StatFile", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LLBBridgeServer).StatFile(ctx, req.(*StatFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _LLBBridge_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PingRequest) if err := dec(in); err != nil { @@ -701,6 +860,14 @@ var _LLBBridge_serviceDesc = grpc.ServiceDesc{ MethodName: "ReadFile", Handler: _LLBBridge_ReadFile_Handler, }, + { + MethodName: "ReadDir", + Handler: _LLBBridge_ReadDir_Handler, + }, + { + MethodName: "StatFile", + Handler: _LLBBridge_StatFile_Handler, + }, { MethodName: "Ping", Handler: _LLBBridge_Ping_Handler, @@ -1169,6 +1336,130 @@ func (m *ReadFileResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *ReadDirRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ReadDirRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Ref) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintGateway(dAtA, i, uint64(len(m.Ref))) + i += copy(dAtA[i:], m.Ref) + } + if len(m.DirPath) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintGateway(dAtA, i, uint64(len(m.DirPath))) + i += copy(dAtA[i:], m.DirPath) + } + if len(m.IncludePattern) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintGateway(dAtA, i, uint64(len(m.IncludePattern))) + i += copy(dAtA[i:], m.IncludePattern) + } + return i, nil +} + +func (m *ReadDirResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ReadDirResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Entries) > 0 { + for _, msg := range m.Entries { + dAtA[i] = 0xa + i++ + i = encodeVarintGateway(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *StatFileRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StatFileRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Ref) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintGateway(dAtA, i, uint64(len(m.Ref))) + i += copy(dAtA[i:], m.Ref) + } + if len(m.Path) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintGateway(dAtA, i, uint64(len(m.Path))) + i += copy(dAtA[i:], m.Path) + } + return i, nil +} + +func (m *StatFileResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StatFileResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Stat != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintGateway(dAtA, i, uint64(m.Stat.Size())) + n9, err := m.Stat.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + return i, nil +} + func (m *PingRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1449,6 +1740,60 @@ func (m *ReadFileResponse) Size() (n int) { return n } +func (m *ReadDirRequest) Size() (n int) { + var l int + _ = l + l = len(m.Ref) + if l > 0 { + n += 1 + l + sovGateway(uint64(l)) + } + l = len(m.DirPath) + if l > 0 { + n += 1 + l + sovGateway(uint64(l)) + } + l = len(m.IncludePattern) + if l > 0 { + n += 1 + l + sovGateway(uint64(l)) + } + return n +} + +func (m *ReadDirResponse) Size() (n int) { + var l int + _ = l + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovGateway(uint64(l)) + } + } + return n +} + +func (m *StatFileRequest) Size() (n int) { + var l int + _ = l + l = len(m.Ref) + if l > 0 { + n += 1 + l + sovGateway(uint64(l)) + } + l = len(m.Path) + if l > 0 { + n += 1 + l + sovGateway(uint64(l)) + } + return n +} + +func (m *StatFileResponse) Size() (n int) { + var l int + _ = l + if m.Stat != nil { + l = m.Stat.Size() + n += 1 + l + sovGateway(uint64(l)) + } + return n +} + func (m *PingRequest) Size() (n int) { var l int _ = l @@ -3088,6 +3433,415 @@ func (m *ReadFileResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *ReadDirRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ReadDirRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ReadDirRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ref", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGateway + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ref = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DirPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGateway + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DirPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IncludePattern", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGateway + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IncludePattern = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGateway(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGateway + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ReadDirResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ReadDirResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ReadDirResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGateway + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Entries = append(m.Entries, &fsutil_types.Stat{}) + if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGateway(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGateway + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StatFileRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StatFileRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StatFileRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ref", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGateway + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ref = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGateway + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Path = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGateway(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGateway + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StatFileResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StatFileResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StatFileResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stat", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGateway + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGateway + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Stat == nil { + m.Stat = &fsutil_types.Stat{} + } + if err := m.Stat.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGateway(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGateway + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *PingRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3389,68 +4143,77 @@ var ( func init() { proto.RegisterFile("gateway.proto", fileDescriptorGateway) } var fileDescriptorGateway = []byte{ - // 999 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcf, 0x6f, 0xdb, 0x36, - 0x14, 0x8e, 0x22, 0xdb, 0xb1, 0x9f, 0xed, 0xc6, 0x23, 0x86, 0x41, 0xd5, 0x21, 0xf5, 0x84, 0xa1, - 0xd3, 0xfa, 0x43, 0xc2, 0xdc, 0x0d, 0xed, 0x5a, 0xa0, 0x5b, 0x9d, 0x34, 0x68, 0x36, 0x67, 0x35, - 0xd8, 0x43, 0x81, 0x62, 0x3b, 0xd0, 0x36, 0xa5, 0x08, 0x91, 0x45, 0x8d, 0xa2, 0x93, 0x19, 0xbb, - 0x6c, 0x3b, 0xf5, 0xbe, 0x7f, 0xaa, 0xc7, 0x9d, 0x77, 0x08, 0x86, 0xdc, 0xf6, 0x5f, 0x0c, 0xa4, - 0x28, 0x47, 0xf9, 0xe5, 0x24, 0x27, 0xf3, 0x51, 0xef, 0x7b, 0xef, 0xe3, 0x7b, 0xdf, 0x23, 0x0d, - 0xed, 0x90, 0x08, 0x7a, 0x48, 0xe6, 0x5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, 0x7f, 0x29, - 0x58, 0x32, 0xf0, 0x76, 0x35, 0xe2, 0x65, 0x22, 0xf8, 0x1c, 0x2f, 0x02, 0xd8, 0xcf, 0xa0, 0x7d, - 0xea, 0x13, 0xea, 0x80, 0xb9, 0x4f, 0xe7, 0x39, 0x55, 0x2c, 0x97, 0xe8, 0x63, 0xa8, 0x1e, 0x90, - 0x78, 0x46, 0x15, 0xd3, 0x16, 0xce, 0x8d, 0xa7, 0xab, 0x4f, 0x8c, 0x7e, 0x1d, 0x6a, 0x5c, 0x85, - 0x77, 0xfe, 0x54, 0x67, 0x95, 0x34, 0xd1, 0xb7, 0xfa, 0x5c, 0x86, 0xa2, 0x76, 0xff, 0xca, 0x73, - 0xc9, 0x9f, 0x2c, 0xa7, 0xa5, 0x80, 0xf6, 0x63, 0x68, 0x2c, 0xb6, 0xae, 0xa2, 0xd3, 0x28, 0xd1, - 0x71, 0x04, 0xb4, 0x31, 0x15, 0x33, 0x9e, 0x60, 0xfa, 0xcb, 0x8c, 0x66, 0x02, 0x7d, 0x53, 0xf0, - 0x53, 0xf8, 0xab, 0x8a, 0x2c, 0x1d, 0xb1, 0x06, 0x20, 0x17, 0xaa, 0x94, 0x73, 0xc6, 0x75, 0x7b, - 0x90, 0x97, 0x2b, 0xcf, 0xe3, 0xe9, 0xd8, 0x7b, 0xa3, 0x94, 0x87, 0x73, 0x07, 0xa7, 0x03, 0xb7, - 0x8a, 0xac, 0x59, 0xca, 0x92, 0x8c, 0x3a, 0x7f, 0x19, 0x70, 0x1b, 0x53, 0x25, 0xbc, 0x9d, 0x29, - 0x09, 0xe9, 0x26, 0x4b, 0x82, 0x28, 0x2c, 0x48, 0x75, 0xc0, 0xc4, 0x85, 0x16, 0xb0, 0x5c, 0x22, - 0x17, 0xea, 0xc3, 0x98, 0x88, 0x80, 0xf1, 0xa9, 0x4e, 0xd7, 0xf2, 0xd2, 0x91, 0x57, 0xec, 0xe1, - 0xc5, 0x57, 0xd4, 0x85, 0xa6, 0x0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da, 0x60, 0xd0, 0x57, 0x91, 0x56, 0x6f, 0x14, 0xa9, 0x80, 0xa1, 0xe7, 0xb0, 0xf6, - 0x56, 0xbd, 0x6a, 0x99, 0x9e, 0x8e, 0x0b, 0xca, 0xaa, 0x1e, 0x3f, 0x2f, 0x77, 0xc3, 0x74, 0xcc, - 0xf8, 0x04, 0x17, 0xa0, 0xde, 0xfb, 0x0a, 0x34, 0x06, 0x83, 0x7e, 0x9f, 0x47, 0x93, 0x90, 0xa2, - 0x3f, 0x0c, 0x40, 0xe7, 0xef, 0x13, 0xf4, 0xd5, 0x72, 0x95, 0x5c, 0x7c, 0x29, 0xda, 0x5f, 0xdf, - 0x10, 0xa5, 0xab, 0xfc, 0x0e, 0xaa, 0x4a, 0xc5, 0xe8, 0xf3, 0x6b, 0xce, 0xb9, 0xed, 0x5e, 0xed, - 0xa8, 0x63, 0x8f, 0xa1, 0x5e, 0x28, 0x01, 0xdd, 0x5b, 0x4a, 0xef, 0x94, 0xd0, 0xed, 0xfb, 0xd7, - 0xf2, 0xd5, 0x49, 0xde, 0x42, 0x45, 0xca, 0x08, 0xdd, 0x5d, 0x02, 0x2a, 0xe9, 0xcc, 0x5e, 0x76, - 0xce, 0x53, 0xfa, 0xfb, 0x59, 0xbe, 0xc7, 0xea, 0x8e, 0x71, 0x97, 0xf2, 0x29, 0x3d, 0x97, 0xf6, - 0x17, 0xd7, 0xf0, 0xcc, 0xc3, 0xf7, 0x5b, 0x1f, 0x8e, 0x37, 0x8c, 0xbf, 0x8f, 0x37, 0x8c, 0x7f, - 0x8f, 0x37, 0x8c, 0x51, 0x4d, 0xfd, 0xe1, 0x79, 0xf4, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0f, - 0xfd, 0x24, 0x08, 0x13, 0x0a, 0x00, 0x00, + // 1144 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcf, 0x4f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ce, 0x36, 0x54, 0x27, 0x5b, + 0x37, 0xd1, 0xa9, 0xe6, 0xe8, 0xb8, 0x02, 0x96, 0x31, 0x11, 0x63, 0x1e, 0x63, 0xf2, 0xe3, 0x98, + 0xa4, 0x02, 0x7d, 0x99, 0xf1, 0x53, 0xf8, 0x9b, 0x2e, 0x59, 0x2a, 0x62, 0x03, 0x40, 0x2d, 0x28, + 0x11, 0xce, 0x19, 0x37, 0xe9, 0x41, 0x9e, 0x2e, 0x54, 0x8f, 0x27, 0x7d, 0xef, 0x8d, 0x2a, 0x54, + 0xac, 0x15, 0xdc, 0x06, 0xac, 0x64, 0x5e, 0xd3, 0x84, 0xc5, 0x29, 0x71, 0xff, 0xb0, 0xe0, 0x1e, + 0x26, 0xaa, 0x4e, 0x0f, 0x46, 0x41, 0x48, 0x76, 0x59, 0x3c, 0xa4, 0x61, 0x46, 0xaa, 0x01, 0x05, + 0x9c, 0xd5, 0x02, 0x96, 0x4b, 0xd4, 0x82, 0x4a, 0x37, 0x0a, 0xc4, 0x90, 0xf1, 0x91, 0x71, 0x57, + 0xf7, 0x92, 0x9e, 0x97, 0xed, 0xe1, 0xc9, 0x29, 0x6a, 0x42, 0xcd, 0x18, 0x3e, 0x64, 0x03, 0x62, + 0x17, 0x94, 0x8d, 0xfc, 0x16, 0xb2, 0xa1, 0xdc, 0x61, 0xe1, 0xb7, 0xc1, 0x88, 0xd8, 0x45, 0x75, + 0x9a, 0x89, 0xee, 0x2f, 0x16, 0x38, 0x57, 0xb1, 0xd2, 0xa4, 0xd1, 0xd7, 0xb0, 0xb4, 0x47, 0x43, + 0x92, 0xea, 0xbb, 0xaa, 0xb6, 0xb7, 0xde, 0x7f, 0xb8, 0xbf, 0xf0, 0xf7, 0x87, 0xfb, 0x1b, 0xb9, + 0xa2, 0x67, 0x09, 0x89, 0xfb, 0x2c, 0x16, 0x01, 0x8d, 0x09, 0x97, 0xbd, 0xfb, 0x68, 0xa0, 0x20, + 0x9e, 0x46, 0x62, 0x63,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 0x76, 0xfd, 0xfd, 0xf9, 0x9a, 0xf5, 0xd7, 0xf9, 0x9a, + 0xf5, 0xcf, 0xf9, 0x9a, 0xd5, 0x5b, 0x52, 0xff, 0xb4, 0x8f, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, + 0x80, 0x7e, 0xd2, 0xb5, 0x25, 0x0c, 0x00, 0x00, } diff --git a/vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.proto b/vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.proto index ff1856c1f..7699959e5 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.proto +++ b/vendor/github.com/moby/buildkit/frontend/gateway/pb/gateway.proto @@ -7,6 +7,7 @@ import "github.com/gogo/googleapis/google/rpc/status.proto"; import "github.com/moby/buildkit/solver/pb/ops.proto"; import "github.com/moby/buildkit/api/types/worker.proto"; import "github.com/moby/buildkit/util/apicaps/pb/caps.proto"; +import "github.com/tonistiigi/fsutil/types/stat.proto"; option (gogoproto.sizer_all) = true; option (gogoproto.marshaler_all) = true; @@ -19,6 +20,10 @@ service LLBBridge { rpc Solve(SolveRequest) returns (SolveResponse); // apicaps:CapReadFile rpc ReadFile(ReadFileRequest) returns (ReadFileResponse); + // apicaps:CapReadDir + rpc ReadDir(ReadDirRequest) returns (ReadDirResponse); + // apicaps:CapStatFile + rpc StatFile(StatFileRequest) returns (StatFileResponse); rpc Ping(PingRequest) returns (PongResponse); rpc Return(ReturnRequest) returns (ReturnResponse); } @@ -92,6 +97,25 @@ message ReadFileResponse { bytes Data = 1; } +message ReadDirRequest { + string Ref = 1; + string DirPath = 2; + string IncludePattern = 3; +} + +message ReadDirResponse { + repeated fsutil.types.Stat entries = 1; +} + +message StatFileRequest { + string Ref = 1; + string Path = 2; +} + +message StatFileResponse { + fsutil.types.Stat stat = 1; +} + message PingRequest{ } message PongResponse{ diff --git a/vendor/github.com/moby/buildkit/session/filesync/diffcopy.go b/vendor/github.com/moby/buildkit/session/filesync/diffcopy.go index b50da2b33..8334ab60d 100644 --- a/vendor/github.com/moby/buildkit/session/filesync/diffcopy.go +++ b/vendor/github.com/moby/buildkit/session/filesync/diffcopy.go @@ -9,6 +9,7 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/tonistiigi/fsutil" + fstypes "github.com/tonistiigi/fsutil/types" "google.golang.org/grpc" ) @@ -81,10 +82,10 @@ func syncTargetDiffCopy(ds grpc.Stream, dest string) error { } return fsutil.Receive(ds.Context(), ds, dest, fsutil.ReceiveOpt{ Merge: true, - Filter: func() func(*fsutil.Stat) bool { + Filter: func() func(*fstypes.Stat) bool { uid := os.Getuid() gid := os.Getgid() - return func(st *fsutil.Stat) bool { + return func(st *fstypes.Stat) bool { st.Uid = uint32(uid) st.Gid = uint32(gid) return true diff --git a/vendor/github.com/moby/buildkit/session/filesync/filesync.go b/vendor/github.com/moby/buildkit/session/filesync/filesync.go index 8f0a7c1e0..ae6775f70 100644 --- a/vendor/github.com/moby/buildkit/session/filesync/filesync.go +++ b/vendor/github.com/moby/buildkit/session/filesync/filesync.go @@ -10,6 +10,7 @@ import ( "github.com/moby/buildkit/session" "github.com/pkg/errors" "github.com/tonistiigi/fsutil" + fstypes "github.com/tonistiigi/fsutil/types" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" @@ -34,7 +35,7 @@ type SyncedDir struct { Name string Dir string Excludes []string - Map func(*fsutil.Stat) bool + Map func(*fstypes.Stat) bool } // NewFSSyncProvider creates a new provider for sending files from client diff --git a/vendor/github.com/moby/buildkit/snapshot/blobmapping/snapshotter.go b/vendor/github.com/moby/buildkit/snapshot/blobmapping/snapshotter.go index d6861ae5d..e145235a2 100644 --- a/vendor/github.com/moby/buildkit/snapshot/blobmapping/snapshotter.go +++ b/vendor/github.com/moby/buildkit/snapshot/blobmapping/snapshotter.go @@ -107,10 +107,21 @@ func (s *Snapshotter) GetBlob(ctx context.Context, key string) (digest.Digest, d // Checks that there is a blob in the content store. // If same blob has already been set then this is a noop. func (s *Snapshotter) SetBlob(ctx context.Context, key string, diffID, blobsum digest.Digest) error { - _, err := s.opt.Content.Info(ctx, blobsum) + info, err := s.opt.Content.Info(ctx, blobsum) if err != nil { return err } + if _, ok := info.Labels["containerd.io/uncompressed"]; !ok { + labels := map[string]string{ + "containerd.io/uncompressed": diffID.String(), + } + if _, err := s.opt.Content.Update(ctx, content.Info{ + Digest: blobsum, + Labels: labels, + }, "labels.containerd.io/uncompressed"); err != nil { + return err + } + } md, _ := s.opt.MetadataStore.Get(key) v, err := metadata.NewValue(DiffPair{DiffID: diffID, Blobsum: blobsum}) diff --git a/vendor/github.com/moby/buildkit/snapshot/imagerefchecker/checker.go b/vendor/github.com/moby/buildkit/snapshot/imagerefchecker/checker.go index 21e4afee3..f31384c09 100644 --- a/vendor/github.com/moby/buildkit/snapshot/imagerefchecker/checker.go +++ b/vendor/github.com/moby/buildkit/snapshot/imagerefchecker/checker.go @@ -90,9 +90,13 @@ func (c *checker) init() { return } + var mu sync.Mutex + for _, img := range imgs { if err := images.Dispatch(context.TODO(), images.Handlers(layersHandler(c.opt.ContentStore, func(layers []specs.Descriptor) { + mu.Lock() c.registerLayers(layers) + mu.Unlock() })), img.Target); err != nil { return } diff --git a/vendor/github.com/moby/buildkit/solver/edge.go b/vendor/github.com/moby/buildkit/solver/edge.go index 0ea363277..07e67a3e1 100644 --- a/vendor/github.com/moby/buildkit/solver/edge.go +++ b/vendor/github.com/moby/buildkit/solver/edge.go @@ -271,7 +271,7 @@ func (e *edge) currentIndexKey() *CacheKey { func (e *edge) skipPhase2SlowCache(dep *dep) bool { isPhase1 := false for _, dep := range e.deps { - if !dep.slowCacheComplete && e.slowCacheFunc(dep) != nil && len(dep.keyMap) == 0 { + if (!dep.slowCacheComplete && e.slowCacheFunc(dep) != nil || dep.state < edgeStatusCacheSlow) && len(dep.keyMap) == 0 { isPhase1 = true break } diff --git a/vendor/github.com/moby/buildkit/solver/index.go b/vendor/github.com/moby/buildkit/solver/index.go index 1bb17d894..78a2cca25 100644 --- a/vendor/github.com/moby/buildkit/solver/index.go +++ b/vendor/github.com/moby/buildkit/solver/index.go @@ -211,10 +211,12 @@ func (ei *edgeIndex) getAllMatches(k *CacheKey) []string { for _, d := range dd { ll := CacheInfoLink{Input: Index(i), Digest: k.Digest(), Output: k.Output(), Selector: d.Selector} for _, ckID := range d.CacheKey.CacheKey.indexIDs { - if l, ok := ei.items[ckID].links[ll]; ok { - if _, ok := l[m]; ok { - found = true - break + if item, ok := ei.items[ckID]; ok { + if l, ok := item.links[ll]; ok { + if _, ok := l[m]; ok { + found = true + break + } } } } diff --git a/vendor/github.com/moby/buildkit/solver/jobs.go b/vendor/github.com/moby/buildkit/solver/jobs.go index 66a9a5162..371f43199 100644 --- a/vendor/github.com/moby/buildkit/solver/jobs.go +++ b/vendor/github.com/moby/buildkit/solver/jobs.go @@ -3,6 +3,7 @@ package solver import ( "context" "fmt" + "strings" "sync" "time" @@ -12,6 +13,7 @@ import ( "github.com/moby/buildkit/util/progress" "github.com/moby/buildkit/util/tracing" digest "github.com/opencontainers/go-digest" + opentracing "github.com/opentracing/opentracing-go" "github.com/pkg/errors" ) @@ -44,8 +46,10 @@ type state struct { parents map[digest.Digest]struct{} childVtx map[digest.Digest]struct{} - mpw *progress.MultiWriter - allPw map[progress.Writer]struct{} + mpw *progress.MultiWriter + allPw map[progress.Writer]struct{} + mspan *tracing.MultiSpan + allSpan map[opentracing.Span]struct{} vtx Vertex clientVertex client.Vertex @@ -167,7 +171,7 @@ func (sb *subBuilder) Build(ctx context.Context, e Edge) (CachedResult, error) { } func (sb *subBuilder) Context(ctx context.Context) context.Context { - return progress.WithProgress(ctx, sb.mpw) + return opentracing.ContextWithSpan(progress.WithProgress(ctx, sb.mpw), sb.mspan) } func (sb *subBuilder) EachValue(ctx context.Context, key string, fn func(interface{}) error) error { @@ -185,6 +189,7 @@ type Job struct { list *Solver pr *progress.MultiReader pw progress.Writer + span opentracing.Span values sync.Map progressCloser func() @@ -302,7 +307,9 @@ func (jl *Solver) loadUnlocked(v, parent Vertex, j *Job, cache map[Vertex]Vertex parents: map[digest.Digest]struct{}{}, childVtx: map[digest.Digest]struct{}{}, allPw: map[progress.Writer]struct{}{}, + allSpan: map[opentracing.Span]struct{}{}, mpw: progress.NewMultiWriter(progress.WithMetadata("vertex", dgst)), + mspan: tracing.NewMultiSpan(), vtx: v, clientVertex: initClientVertex(v), edges: map[Index]*edge{}, @@ -356,6 +363,8 @@ func (jl *Solver) connectProgressFromState(target, src *state) { target.mpw.Add(j.pw) target.allPw[j.pw] = struct{}{} j.pw.Write(target.clientVertex.Digest.String(), target.clientVertex) + target.mspan.Add(j.span) + target.allSpan[j.span] = struct{}{} } } for p := range src.parents { @@ -379,6 +388,7 @@ func (jl *Solver) NewJob(id string) (*Job, error) { pr: progress.NewMultiReader(pr), pw: pw, progressCloser: progressCloser, + span: (&opentracing.NoopTracer{}).StartSpan(""), } jl.jobs[id] = j @@ -427,6 +437,10 @@ func (jl *Solver) deleteIfUnreferenced(k digest.Digest, st *state) { } func (j *Job) Build(ctx context.Context, e Edge) (CachedResult, error) { + if span := opentracing.SpanFromContext(ctx); span != nil { + j.span = span + } + v, err := j.list.load(e.Vertex, nil, j) if err != nil { return nil, err @@ -452,6 +466,9 @@ func (j *Job) Discard() error { if _, ok := st.allPw[j.pw]; ok { delete(st.allPw, j.pw) } + if _, ok := st.allSpan[j.span]; ok { + delete(st.allSpan, j.span) + } st.mu.Unlock() } return nil @@ -533,7 +550,7 @@ func (s *sharedOp) Cache() CacheManager { } func (s *sharedOp) LoadCache(ctx context.Context, rec *CacheRecord) (Result, error) { - ctx = progress.WithProgress(ctx, s.st.mpw) + ctx = opentracing.ContextWithSpan(progress.WithProgress(ctx, s.st.mpw), s.st.mspan) // no cache hit. start evaluating the node span, ctx := tracing.StartSpan(ctx, "load cache: "+s.st.vtx.Name()) notifyStarted(ctx, &s.st.clientVertex, true) @@ -556,19 +573,18 @@ func (s *sharedOp) CalcSlowCache(ctx context.Context, index Index, f ResultBased return err, nil } s.slowMu.Unlock() - ctx = progress.WithProgress(ctx, s.st.mpw) + ctx = opentracing.ContextWithSpan(progress.WithProgress(ctx, s.st.mpw), s.st.mspan) key, err := f(ctx, res) complete := true if err != nil { - canceled := false select { case <-ctx.Done(): - canceled = true + if strings.Contains(err.Error(), context.Canceled.Error()) { + complete = false + err = errors.Wrap(ctx.Err(), err.Error()) + } default: } - if canceled && errors.Cause(err) == context.Canceled { - complete = false - } } s.slowMu.Lock() defer s.slowMu.Unlock() @@ -581,7 +597,7 @@ func (s *sharedOp) CalcSlowCache(ctx context.Context, index Index, f ResultBased return key, err }) if err != nil { - ctx = progress.WithProgress(ctx, s.st.mpw) + ctx = opentracing.ContextWithSpan(progress.WithProgress(ctx, s.st.mpw), s.st.mspan) notifyStarted(ctx, &s.st.clientVertex, false) notifyCompleted(ctx, &s.st.clientVertex, err, false) return "", err @@ -601,7 +617,7 @@ func (s *sharedOp) CacheMap(ctx context.Context, index int) (*cacheMapResp, erro if s.cacheErr != nil { return nil, s.cacheErr } - ctx = progress.WithProgress(ctx, s.st.mpw) + ctx = opentracing.ContextWithSpan(progress.WithProgress(ctx, s.st.mpw), s.st.mspan) ctx = session.NewContext(ctx, s.st.getSessionID()) if len(s.st.vtx.Inputs()) == 0 { // no cache hit. start evaluating the node @@ -615,15 +631,14 @@ func (s *sharedOp) CacheMap(ctx context.Context, index int) (*cacheMapResp, erro res, done, err := op.CacheMap(ctx, len(s.cacheRes)) complete := true if err != nil { - canceled := false select { case <-ctx.Done(): - canceled = true + if strings.Contains(err.Error(), context.Canceled.Error()) { + complete = false + err = errors.Wrap(ctx.Err(), err.Error()) + } default: } - if canceled && errors.Cause(err) == context.Canceled { - complete = false - } } if complete { if err == nil { @@ -655,7 +670,7 @@ func (s *sharedOp) Exec(ctx context.Context, inputs []Result) (outputs []Result, return s.execRes, s.execErr } - ctx = progress.WithProgress(ctx, s.st.mpw) + ctx = opentracing.ContextWithSpan(progress.WithProgress(ctx, s.st.mpw), s.st.mspan) ctx = session.NewContext(ctx, s.st.getSessionID()) // no cache hit. start evaluating the node @@ -669,15 +684,14 @@ func (s *sharedOp) Exec(ctx context.Context, inputs []Result) (outputs []Result, res, err := op.Exec(ctx, inputs) complete := true if err != nil { - canceled := false select { case <-ctx.Done(): - canceled = true + if strings.Contains(err.Error(), context.Canceled.Error()) { + complete = false + err = errors.Wrap(ctx.Err(), err.Error()) + } default: } - if canceled && errors.Cause(err) == context.Canceled { - complete = false - } } if complete { if res != nil { diff --git a/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go b/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go index ee9c3af7b..9eb9968a1 100644 --- a/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go +++ b/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go @@ -31,6 +31,7 @@ import ( "github.com/moby/buildkit/solver/llbsolver" "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/util/progress/logs" + utilsystem "github.com/moby/buildkit/util/system" "github.com/moby/buildkit/worker" digest "github.com/opencontainers/go-digest" "github.com/opencontainers/runc/libcontainer/system" @@ -301,7 +302,7 @@ func (e *execOp) getSSHMountable(ctx context.Context, m *pb.Mount) (cache.Mounta return nil, nil } if st, ok := status.FromError(err); ok && st.Code() == codes.Unimplemented { - return nil, errors.Errorf("no ssh forwarded from the client") + return nil, errors.Errorf("no SSH key %q forwarded from the client", m.SSHOpt.ID) } return nil, err } @@ -467,6 +468,15 @@ func (sm *secretMountInstance) Release() error { return nil } +func addDefaultEnvvar(env []string, k, v string) []string { + for _, e := range env { + if strings.HasPrefix(e, k+"=") { + return env + } + } + return append(env, k+"="+v) +} + func (e *execOp) Exec(ctx context.Context, inputs []solver.Result) ([]solver.Result, error) { var mounts []executor.Mount var root cache.Mountable @@ -626,6 +636,7 @@ func (e *execOp) Exec(ctx context.Context, inputs []solver.Result) ([]solver.Res if e.op.Meta.ProxyEnv != nil { meta.Env = append(meta.Env, proxyEnvList(e.op.Meta.ProxyEnv)...) } + meta.Env = addDefaultEnvvar(meta.Env, "PATH", utilsystem.DefaultPathEnv) stdout, stderr := logs.NewLogStreams(ctx, os.Getenv("BUILDKIT_DEBUG_EXEC_OUTPUT") == "1") defer stdout.Close() diff --git a/vendor/github.com/moby/buildkit/solver/pb/caps.go b/vendor/github.com/moby/buildkit/solver/pb/caps.go index 2fa161584..b81ec62c4 100644 --- a/vendor/github.com/moby/buildkit/solver/pb/caps.go +++ b/vendor/github.com/moby/buildkit/solver/pb/caps.go @@ -30,15 +30,18 @@ const ( CapBuildOpLLBFileName apicaps.CapID = "source.buildop.llbfilename" - CapExecMetaBase apicaps.CapID = "exec.meta.base" - CapExecMetaProxy apicaps.CapID = "exec.meta.proxyenv" - CapExecMetaNetwork apicaps.CapID = "exec.meta.network" - CapExecMountBind apicaps.CapID = "exec.mount.bind" - CapExecMountCache apicaps.CapID = "exec.mount.cache" - CapExecMountCacheSharing apicaps.CapID = "exec.mount.cache.sharing" - CapExecMountSelector apicaps.CapID = "exec.mount.selector" - CapExecMountTmpfs apicaps.CapID = "exec.mount.tmpfs" - CapMountSecret apicaps.CapID = "exec.mount.secret" + CapExecMetaBase apicaps.CapID = "exec.meta.base" + CapExecMetaProxy apicaps.CapID = "exec.meta.proxyenv" + CapExecMetaNetwork apicaps.CapID = "exec.meta.network" + CapExecMetaSetsDefaultPath apicaps.CapID = "exec.meta.setsdefaultpath" + CapExecMountBind apicaps.CapID = "exec.mount.bind" + CapExecMountCache apicaps.CapID = "exec.mount.cache" + CapExecMountCacheSharing apicaps.CapID = "exec.mount.cache.sharing" + CapExecMountSelector apicaps.CapID = "exec.mount.selector" + CapExecMountTmpfs apicaps.CapID = "exec.mount.tmpfs" + CapExecMountSecret apicaps.CapID = "exec.mount.secret" + CapExecMountSSH apicaps.CapID = "exec.mount.ssh" + CapExecCgroupsMounted apicaps.CapID = "exec.cgroup" CapConstraints apicaps.CapID = "constraints" CapPlatform apicaps.CapID = "platform" @@ -169,6 +172,12 @@ func init() { Status: apicaps.CapStatusExperimental, }) + Caps.Init(apicaps.Cap{ + ID: CapExecMetaSetsDefaultPath, + Enabled: true, + Status: apicaps.CapStatusExperimental, + }) + Caps.Init(apicaps.Cap{ ID: CapExecMountBind, Enabled: true, @@ -200,7 +209,19 @@ func init() { }) Caps.Init(apicaps.Cap{ - ID: CapMountSecret, + ID: CapExecMountSecret, + Enabled: true, + Status: apicaps.CapStatusExperimental, + }) + + Caps.Init(apicaps.Cap{ + ID: CapExecMountSSH, + Enabled: true, + Status: apicaps.CapStatusExperimental, + }) + + Caps.Init(apicaps.Cap{ + ID: CapExecCgroupsMounted, Enabled: true, Status: apicaps.CapStatusExperimental, }) diff --git a/vendor/github.com/moby/buildkit/util/contentutil/refs.go b/vendor/github.com/moby/buildkit/util/contentutil/refs.go index b3a10d150..e62d7987b 100644 --- a/vendor/github.com/moby/buildkit/util/contentutil/refs.go +++ b/vendor/github.com/moby/buildkit/util/contentutil/refs.go @@ -3,11 +3,16 @@ package contentutil import ( "context" "net/http" + "sync" "github.com/containerd/containerd/content" + "github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes/docker" + "github.com/docker/docker/pkg/locker" + digest "github.com/opencontainers/go-digest" ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" ) func ProviderFromRef(ref string) (ocispec.Descriptor, content.Provider, error) { @@ -38,11 +43,13 @@ func IngesterFromRef(ref string) (content.Ingester, error) { } return &ingester{ + locker: locker.New(), pusher: pusher, }, nil } type ingester struct { + locker *locker.Locker pusher remotes.Pusher } @@ -53,5 +60,39 @@ func (w *ingester) Writer(ctx context.Context, opts ...content.WriterOpt) (conte return nil, err } } - return w.pusher.Push(ctx, wo.Desc) + if wo.Ref == "" { + return nil, errors.Wrap(errdefs.ErrInvalidArgument, "ref must not be empty") + } + w.locker.Lock(wo.Ref) + var once sync.Once + unlock := func() { + once.Do(func() { + w.locker.Unlock(wo.Ref) + }) + } + writer, err := w.pusher.Push(ctx, wo.Desc) + if err != nil { + unlock() + return nil, err + } + return &lockedWriter{unlock: unlock, Writer: writer}, nil +} + +type lockedWriter struct { + unlock func() + content.Writer +} + +func (w *lockedWriter) Commit(ctx context.Context, size int64, expected digest.Digest, opts ...content.Opt) error { + err := w.Writer.Commit(ctx, size, expected, opts...) + if err == nil { + w.unlock() + } + return err +} + +func (w *lockedWriter) Close() error { + err := w.Writer.Close() + w.unlock() + return err } diff --git a/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go b/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go index d79231173..89866b76b 100644 --- a/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go +++ b/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go @@ -15,7 +15,10 @@ import ( // flightcontrol is like singleflight but with support for cancellation and // nested progress reporting -var errRetry = errors.Errorf("retry") +var ( + errRetry = errors.Errorf("retry") + errRetryTimeout = errors.Errorf("exceeded retry timeout") +) type contextKeyT string @@ -29,12 +32,28 @@ type Group struct { // Do executes a context function syncronized by the key func (g *Group) Do(ctx context.Context, key string, fn func(ctx context.Context) (interface{}, error)) (v interface{}, err error) { - defer func() { - if errors.Cause(err) == errRetry { - runtime.Gosched() - v, err = g.Do(ctx, key, fn) + var backoff time.Duration + for { + v, err = g.do(ctx, key, fn) + if err == nil || errors.Cause(err) != errRetry { + return v, err } - }() + // backoff logic + if backoff >= 3*time.Second { + err = errors.Wrapf(errRetryTimeout, "flightcontrol") + return v, err + } + runtime.Gosched() + if backoff > 0 { + time.Sleep(backoff) + backoff *= 2 + } else { + backoff = time.Millisecond + } + } +} + +func (g *Group) do(ctx context.Context, key string, fn func(ctx context.Context) (interface{}, error)) (interface{}, error) { g.mu.Lock() if g.m == nil { g.m = make(map[string]*call) diff --git a/vendor/github.com/moby/buildkit/util/pull/pull.go b/vendor/github.com/moby/buildkit/util/pull/pull.go index 21192b42a..350d77fd7 100644 --- a/vendor/github.com/moby/buildkit/util/pull/pull.go +++ b/vendor/github.com/moby/buildkit/util/pull/pull.go @@ -241,8 +241,7 @@ func unpack(ctx context.Context, desc ocispec.Descriptor, cs content.Store, csh var chain []digest.Digest for _, layer := range layers { labels := map[string]string{ - "containerd.io/gc.root": time.Now().UTC().Format(time.RFC3339Nano), - "containerd.io/uncompressed": layer.Diff.Digest.String(), + "containerd.io/gc.root": time.Now().UTC().Format(time.RFC3339Nano), } if _, err := rootfs.ApplyLayer(ctx, layer, chain, csh, applier, ctdsnapshot.WithLabels(labels)); err != nil { return "", err diff --git a/vendor/github.com/moby/buildkit/util/rootless/specconv/specconv_linux.go b/vendor/github.com/moby/buildkit/util/rootless/specconv/specconv_linux.go index 1b90219f1..12646e430 100644 --- a/vendor/github.com/moby/buildkit/util/rootless/specconv/specconv_linux.go +++ b/vendor/github.com/moby/buildkit/util/rootless/specconv/specconv_linux.go @@ -1,113 +1,40 @@ package specconv import ( - "os" - "sort" "strings" - "github.com/opencontainers/runc/libcontainer/system" - "github.com/opencontainers/runc/libcontainer/user" "github.com/opencontainers/runtime-spec/specs-go" - "github.com/pkg/errors" ) // ToRootless converts spec to be compatible with "rootless" runc. -// * Adds userns (Note: since we are already in userns, ideally we should not need to do this. runc-side issue is tracked at https://github.com/opencontainers/runc/issues/1837) -// * Fix up mount flags (same as above) -// * Replace /sys with bind-mount (FIXME: we don't need to do this if netns is unshared) +// * Remove /sys mount +// * Remove cgroups +// +// See docs/rootless.md for the supported runc revision. func ToRootless(spec *specs.Spec) error { - if !system.RunningInUserNS() { - return errors.New("needs to be in user namespace") - } - uidMap, err := user.CurrentProcessUIDMap() - if err != nil && !os.IsNotExist(err) { - return err - } - gidMap, err := user.CurrentProcessUIDMap() - if err != nil && !os.IsNotExist(err) { - return err - } - return toRootless(spec, uidMap, gidMap) -} - -// toRootless was forked from github.com/opencontainers/runc/libcontainer/specconv -func toRootless(spec *specs.Spec, uidMap, gidMap []user.IDMap) error { - if err := configureUserNS(spec, uidMap, gidMap); err != nil { - return err - } - if err := configureMounts(spec); err != nil { - return err - } - - // Remove cgroup settings. - spec.Linux.Resources = nil - spec.Linux.CgroupsPath = "" - return nil -} - -// configureUserNS add suserns and the current ID map to the spec. -// Since we are already in userns, ideally we should not need to add userns. -// However, currently rootless runc always requires userns to be added. -// https://github.com/opencontainers/runc/issues/1837 -func configureUserNS(spec *specs.Spec, uidMap, gidMap []user.IDMap) error { - spec.Linux.Namespaces = append(spec.Linux.Namespaces, specs.LinuxNamespace{ - Type: specs.UserNamespace, - }) - - sort.Slice(uidMap, func(i, j int) bool { return uidMap[i].ID < uidMap[j].ID }) - uNextContainerID := int64(0) - for _, u := range uidMap { - spec.Linux.UIDMappings = append(spec.Linux.UIDMappings, - specs.LinuxIDMapping{ - HostID: uint32(u.ID), - ContainerID: uint32(uNextContainerID), - Size: uint32(u.Count), - }) - uNextContainerID += int64(u.Count) - } - sort.Slice(gidMap, func(i, j int) bool { return gidMap[i].ID < gidMap[j].ID }) - gNextContainerID := int64(0) - for _, g := range gidMap { - spec.Linux.GIDMappings = append(spec.Linux.GIDMappings, - specs.LinuxIDMapping{ - HostID: uint32(g.ID), - ContainerID: uint32(gNextContainerID), - Size: uint32(g.Count), - }) - gNextContainerID += int64(g.Count) - } - return nil -} - -func configureMounts(spec *specs.Spec) error { + // Remove /sys mount because we can't mount /sys when the daemon netns + // is not unshared from the host. + // + // Instead, we could bind-mount /sys from the host, however, `rbind, ro` + // does not make /sys/fs/cgroup read-only (and we can't bind-mount /sys + // without rbind) + // + // PR for making /sys/fs/cgroup read-only is proposed, but it is very + // complicated: https://github.com/opencontainers/runc/pull/1869 + // + // For buildkit usecase, we suppose we don't need to provide /sys to + // containers and remove /sys mount as a workaround. var mounts []specs.Mount for _, mount := range spec.Mounts { - // Ignore all mounts that are under /sys, because we add /sys later. if strings.HasPrefix(mount.Destination, "/sys") { continue } - - // Remove all gid= and uid= mappings. - // Since we are already in userns, ideally we should not need to do this. - // https://github.com/opencontainers/runc/issues/1837 - var options []string - for _, option := range mount.Options { - if !strings.HasPrefix(option, "gid=") && !strings.HasPrefix(option, "uid=") { - options = append(options, option) - } - } - mount.Options = options mounts = append(mounts, mount) } - - // Add the sysfs mount as an rbind, because we can't mount /sys unless we have netns. - // TODO: keep original /sys mount when we have netns. - mounts = append(mounts, specs.Mount{ - Source: "/sys", - Destination: "/sys", - Type: "none", - Options: []string{"rbind", "nosuid", "noexec", "nodev", "ro"}, - }) spec.Mounts = mounts + + // Remove cgroups so as to avoid `container_linux.go:337: starting container process caused "process_linux.go:280: applying cgroup configuration for process caused \"mkdir /sys/fs/cgroup/cpuset/buildkit: permission denied\""` + spec.Linux.Resources = nil + spec.Linux.CgroupsPath = "" return nil } diff --git a/vendor/github.com/moby/buildkit/util/tracing/multispan.go b/vendor/github.com/moby/buildkit/util/tracing/multispan.go new file mode 100644 index 000000000..2b157a1de --- /dev/null +++ b/vendor/github.com/moby/buildkit/util/tracing/multispan.go @@ -0,0 +1,22 @@ +package tracing + +import ( + opentracing "github.com/opentracing/opentracing-go" +) + +// MultiSpan allows shared tracing to multiple spans. +// TODO: This is a temporary solution and doesn't really support shared tracing yet. Instead the first always wins. + +type MultiSpan struct { + opentracing.Span +} + +func NewMultiSpan() *MultiSpan { + return &MultiSpan{} +} + +func (ms *MultiSpan) Add(s opentracing.Span) { + if ms.Span == nil { + ms.Span = s + } +} diff --git a/vendor/github.com/moby/buildkit/worker/base/worker.go b/vendor/github.com/moby/buildkit/worker/base/worker.go index c841e55ee..2c666ef16 100644 --- a/vendor/github.com/moby/buildkit/worker/base/worker.go +++ b/vendor/github.com/moby/buildkit/worker/base/worker.go @@ -388,10 +388,7 @@ func (w *Worker) unpack(ctx context.Context, descs []ocispec.Descriptor, s cdsna var chain []digest.Digest for _, layer := range layers { - labels := map[string]string{ - "containerd.io/uncompressed": layer.Diff.Digest.String(), - } - if _, err := rootfs.ApplyLayer(ctx, layer, chain, s, w.Applier, cdsnapshot.WithLabels(labels)); err != nil { + if _, err := rootfs.ApplyLayer(ctx, layer, chain, s, w.Applier); err != nil { return nil, err } chain = append(chain, layer.Diff.Digest) diff --git a/vendor/github.com/tonistiigi/fsutil/.travis.yml b/vendor/github.com/tonistiigi/fsutil/.travis.yml index c9d9e87a2..c190362c7 100644 --- a/vendor/github.com/tonistiigi/fsutil/.travis.yml +++ b/vendor/github.com/tonistiigi/fsutil/.travis.yml @@ -7,8 +7,11 @@ services: language: go go: - - "1.10" + - "1.11" script: + - go build ./... - go test -c -o test ./ + - sudo ./test -test.v + - go test -c -o test ./copy - sudo ./test -test.v \ No newline at end of file diff --git a/vendor/github.com/tonistiigi/fsutil/diff.go b/vendor/github.com/tonistiigi/fsutil/diff.go index 340a0e48a..acad9f4f2 100644 --- a/vendor/github.com/tonistiigi/fsutil/diff.go +++ b/vendor/github.com/tonistiigi/fsutil/diff.go @@ -4,6 +4,8 @@ import ( "context" "hash" "os" + + "github.com/tonistiigi/fsutil/types" ) type walkerFn func(ctx context.Context, pathC chan<- *currentPath) error @@ -14,7 +16,7 @@ func Changes(ctx context.Context, a, b walkerFn, changeFn ChangeFunc) error { type HandleChangeFn func(ChangeKind, string, os.FileInfo, error) error -type ContentHasher func(*Stat) (hash.Hash, error) +type ContentHasher func(*types.Stat) (hash.Hash, error) func GetWalkerFn(root string) walkerFn { return func(ctx context.Context, pathC chan<- *currentPath) error { diff --git a/vendor/github.com/tonistiigi/fsutil/diff_containerd.go b/vendor/github.com/tonistiigi/fsutil/diff_containerd.go index 73c000504..e63ee916a 100644 --- a/vendor/github.com/tonistiigi/fsutil/diff_containerd.go +++ b/vendor/github.com/tonistiigi/fsutil/diff_containerd.go @@ -5,6 +5,7 @@ import ( "os" "strings" + "github.com/tonistiigi/fsutil/types" "golang.org/x/sync/errgroup" ) @@ -170,11 +171,11 @@ func sameFile(f1, f2 *currentPath) (same bool, retErr error) { } } - ls1, ok := f1.f.Sys().(*Stat) + ls1, ok := f1.f.Sys().(*types.Stat) if !ok { return false, nil } - ls2, ok := f2.f.Sys().(*Stat) + ls2, ok := f2.f.Sys().(*types.Stat) if !ok { return false, nil } @@ -185,7 +186,7 @@ func sameFile(f1, f2 *currentPath) (same bool, retErr error) { // compareStat returns whether the stats are equivalent, // whether the files are considered the same file, and // an error -func compareStat(ls1, ls2 *Stat) (bool, error) { +func compareStat(ls1, ls2 *types.Stat) (bool, error) { return ls1.Mode == ls2.Mode && ls1.Uid == ls2.Uid && ls1.Gid == ls2.Gid && ls1.Devmajor == ls2.Devmajor && ls1.Devminor == ls2.Devminor && ls1.Linkname == ls2.Linkname, nil } diff --git a/vendor/github.com/tonistiigi/fsutil/diskwriter.go b/vendor/github.com/tonistiigi/fsutil/diskwriter.go index 4b727ed44..3213113e0 100644 --- a/vendor/github.com/tonistiigi/fsutil/diskwriter.go +++ b/vendor/github.com/tonistiigi/fsutil/diskwriter.go @@ -12,6 +12,7 @@ import ( "github.com/opencontainers/go-digest" "github.com/pkg/errors" + "github.com/tonistiigi/fsutil/types" "golang.org/x/sync/errgroup" ) @@ -25,7 +26,7 @@ type DiskWriterOpt struct { Filter FilterFunc } -type FilterFunc func(*Stat) bool +type FilterFunc func(*types.Stat) bool type DiskWriter struct { opt DiskWriterOpt @@ -95,7 +96,7 @@ func (dw *DiskWriter) HandleChange(kind ChangeKind, p string, fi os.FileInfo, er return nil } - stat, ok := fi.Sys().(*Stat) + stat, ok := fi.Sys().(*types.Stat) if !ok { return errors.Errorf("%s invalid change without stat information", p) } @@ -246,7 +247,7 @@ type hashedWriter struct { } func newHashWriter(ch ContentHasher, fi os.FileInfo, w io.WriteCloser) (*hashedWriter, error) { - stat, ok := fi.Sys().(*Stat) + stat, ok := fi.Sys().(*types.Stat) if !ok { return nil, errors.Errorf("invalid change without stat information") } diff --git a/vendor/github.com/tonistiigi/fsutil/diskwriter_unix.go b/vendor/github.com/tonistiigi/fsutil/diskwriter_unix.go index 19dffabf7..ff0a22e3c 100644 --- a/vendor/github.com/tonistiigi/fsutil/diskwriter_unix.go +++ b/vendor/github.com/tonistiigi/fsutil/diskwriter_unix.go @@ -8,9 +8,10 @@ import ( "github.com/containerd/continuity/sysx" "github.com/pkg/errors" + "github.com/tonistiigi/fsutil/types" ) -func rewriteMetadata(p string, stat *Stat) error { +func rewriteMetadata(p string, stat *types.Stat) error { for key, value := range stat.Xattrs { sysx.Setxattr(p, key, value, 0) } @@ -34,7 +35,7 @@ func rewriteMetadata(p string, stat *Stat) error { // handleTarTypeBlockCharFifo is an OS-specific helper function used by // createTarFile to handle the following types of header: Block; Char; Fifo -func handleTarTypeBlockCharFifo(path string, stat *Stat) error { +func handleTarTypeBlockCharFifo(path string, stat *types.Stat) error { mode := uint32(stat.Mode & 07777) if os.FileMode(stat.Mode)&os.ModeCharDevice != 0 { mode |= syscall.S_IFCHR diff --git a/vendor/github.com/tonistiigi/fsutil/diskwriter_windows.go b/vendor/github.com/tonistiigi/fsutil/diskwriter_windows.go index c6d0d7bec..036544f0b 100644 --- a/vendor/github.com/tonistiigi/fsutil/diskwriter_windows.go +++ b/vendor/github.com/tonistiigi/fsutil/diskwriter_windows.go @@ -4,14 +4,15 @@ package fsutil import ( "github.com/pkg/errors" + "github.com/tonistiigi/fsutil/types" ) -func rewriteMetadata(p string, stat *Stat) error { +func rewriteMetadata(p string, stat *types.Stat) error { return chtimes(p, stat.ModTime) } // handleTarTypeBlockCharFifo is an OS-specific helper function used by // createTarFile to handle the following types of header: Block; Char; Fifo -func handleTarTypeBlockCharFifo(path string, stat *Stat) error { +func handleTarTypeBlockCharFifo(path string, stat *types.Stat) error { return errors.New("Not implemented on windows") } diff --git a/vendor/github.com/tonistiigi/fsutil/fs.go b/vendor/github.com/tonistiigi/fsutil/fs.go index 996f4e4a1..132850c90 100644 --- a/vendor/github.com/tonistiigi/fsutil/fs.go +++ b/vendor/github.com/tonistiigi/fsutil/fs.go @@ -9,6 +9,7 @@ import ( "strings" "github.com/pkg/errors" + "github.com/tonistiigi/fsutil/types" ) type FS interface { @@ -36,13 +37,13 @@ func (fs *fs) Open(p string) (io.ReadCloser, error) { return os.Open(filepath.Join(fs.root, p)) } -func SubDirFS(fs FS, stat Stat) FS { +func SubDirFS(fs FS, stat types.Stat) FS { return &subDirFS{fs: fs, stat: stat} } type subDirFS struct { fs FS - stat Stat + stat types.Stat } func (fs *subDirFS) Walk(ctx context.Context, fn filepath.WalkFunc) error { @@ -57,7 +58,7 @@ func (fs *subDirFS) Walk(ctx context.Context, fn filepath.WalkFunc) error { return err } return fs.fs.Walk(ctx, func(p string, fi os.FileInfo, err error) error { - stat, ok := fi.Sys().(*Stat) + stat, ok := fi.Sys().(*types.Stat) if !ok { return errors.Wrapf(err, "invalid fileinfo without stat info: %s", p) } diff --git a/vendor/github.com/tonistiigi/fsutil/hardlinks.go b/vendor/github.com/tonistiigi/fsutil/hardlinks.go index e598ead7e..d977f0d6b 100644 --- a/vendor/github.com/tonistiigi/fsutil/hardlinks.go +++ b/vendor/github.com/tonistiigi/fsutil/hardlinks.go @@ -4,6 +4,7 @@ import ( "os" "github.com/pkg/errors" + "github.com/tonistiigi/fsutil/types" ) // Hardlinks validates that all targets for links were part of the changes @@ -25,7 +26,7 @@ func (v *Hardlinks) HandleChange(kind ChangeKind, p string, fi os.FileInfo, err return nil } - stat, ok := fi.Sys().(*Stat) + stat, ok := fi.Sys().(*types.Stat) if !ok { return errors.Errorf("invalid change without stat info: %s", p) } diff --git a/vendor/github.com/tonistiigi/fsutil/receive.go b/vendor/github.com/tonistiigi/fsutil/receive.go index 14ccb6c7b..fd9ef9aa6 100644 --- a/vendor/github.com/tonistiigi/fsutil/receive.go +++ b/vendor/github.com/tonistiigi/fsutil/receive.go @@ -7,6 +7,7 @@ import ( "sync" "github.com/pkg/errors" + "github.com/tonistiigi/fsutil/types" "golang.org/x/sync/errgroup" ) @@ -119,7 +120,7 @@ func (r *receiver) run(ctx context.Context) error { g.Go(func() (retErr error) { defer func() { if retErr != nil { - r.conn.SendMsg(&Packet{Type: PACKET_ERR, Data: []byte(retErr.Error())}) + r.conn.SendMsg(&types.Packet{Type: types.PACKET_ERR, Data: []byte(retErr.Error())}) } }() destWalker := emptyWalker @@ -133,7 +134,7 @@ func (r *receiver) run(ctx context.Context) error { if err := dw.Wait(ctx); err != nil { return err } - r.conn.SendMsg(&Packet{Type: PACKET_FIN}) + r.conn.SendMsg(&types.Packet{Type: types.PACKET_FIN}) return nil }) @@ -146,9 +147,9 @@ func (r *receiver) run(ctx context.Context) error { r.progressCb(size, true) }() } - var p Packet + var p types.Packet for { - p = Packet{Data: p.Data[:0]} + p = types.Packet{Data: p.Data[:0]} if err := r.conn.RecvMsg(&p); err != nil { return err } @@ -158,9 +159,9 @@ func (r *receiver) run(ctx context.Context) error { } switch p.Type { - case PACKET_ERR: + case types.PACKET_ERR: return errors.Errorf("error from sender: %s", p.Data) - case PACKET_STAT: + case types.PACKET_STAT: if p.Stat == nil { if err := w.update(nil); err != nil { return err @@ -183,12 +184,12 @@ func (r *receiver) run(ctx context.Context) error { if err := w.update(cp); err != nil { return err } - case PACKET_DATA: + case types.PACKET_DATA: r.muPipes.Lock() pw, ok := r.pipes[p.ID] r.muPipes.Unlock() if !ok { - return errors.Errorf("invalid file request %s", p.ID) + return errors.Errorf("invalid file request %d", p.ID) } if len(p.Data) == 0 { if err := pw.Close(); err != nil { @@ -199,9 +200,9 @@ func (r *receiver) run(ctx context.Context) error { return err } } - case PACKET_FIN: + case types.PACKET_FIN: for { - var p Packet + var p types.Packet if err := r.conn.RecvMsg(&p); err != nil { if err == io.EOF { return nil @@ -229,7 +230,7 @@ func (r *receiver) asyncDataFunc(ctx context.Context, p string, wc io.WriteClose r.muPipes.Lock() r.pipes[id] = wwc r.muPipes.Unlock() - if err := r.conn.SendMsg(&Packet{Type: PACKET_REQ, ID: id}); err != nil { + if err := r.conn.SendMsg(&types.Packet{Type: types.PACKET_REQ, ID: id}); err != nil { return err } err := wwc.Wait(ctx) diff --git a/vendor/github.com/tonistiigi/fsutil/send.go b/vendor/github.com/tonistiigi/fsutil/send.go index e32f6827f..e7c5a37d1 100644 --- a/vendor/github.com/tonistiigi/fsutil/send.go +++ b/vendor/github.com/tonistiigi/fsutil/send.go @@ -7,6 +7,7 @@ import ( "sync" "github.com/pkg/errors" + "github.com/tonistiigi/fsutil/types" "golang.org/x/sync/errgroup" ) @@ -56,7 +57,7 @@ func (s *sender) run(ctx context.Context) error { g.Go(func() error { err := s.walk(ctx) if err != nil { - s.conn.SendMsg(&Packet{Type: PACKET_ERR, Data: []byte(err.Error())}) + s.conn.SendMsg(&types.Packet{Type: types.PACKET_ERR, Data: []byte(err.Error())}) } return err }) @@ -86,19 +87,19 @@ func (s *sender) run(ctx context.Context) error { return ctx.Err() default: } - var p Packet + var p types.Packet if err := s.conn.RecvMsg(&p); err != nil { return err } switch p.Type { - case PACKET_ERR: + case types.PACKET_ERR: return errors.Errorf("error from receiver: %s", p.Data) - case PACKET_REQ: + case types.PACKET_REQ: if err := s.queue(p.ID); err != nil { return err } - case PACKET_FIN: - return s.conn.SendMsg(&Packet{Type: PACKET_FIN}) + case types.PACKET_FIN: + return s.conn.SendMsg(&types.Packet{Type: types.PACKET_FIN}) } } }) @@ -136,7 +137,7 @@ func (s *sender) sendFile(h *sendHandle) error { return err } } - return s.conn.SendMsg(&Packet{ID: h.id, Type: PACKET_DATA}) + return s.conn.SendMsg(&types.Packet{ID: h.id, Type: types.PACKET_DATA}) } func (s *sender) walk(ctx context.Context) error { @@ -145,13 +146,13 @@ func (s *sender) walk(ctx context.Context) error { if err != nil { return err } - stat, ok := fi.Sys().(*Stat) + stat, ok := fi.Sys().(*types.Stat) if !ok { return errors.Wrapf(err, "invalid fileinfo without stat info: %s", path) } - p := &Packet{ - Type: PACKET_STAT, + p := &types.Packet{ + Type: types.PACKET_STAT, Stat: stat, } if fileCanRequestData(os.FileMode(stat.Mode)) { @@ -166,7 +167,7 @@ func (s *sender) walk(ctx context.Context) error { if err != nil { return err } - return errors.Wrapf(s.conn.SendMsg(&Packet{Type: PACKET_STAT}), "failed to send last stat") + return errors.Wrapf(s.conn.SendMsg(&types.Packet{Type: types.PACKET_STAT}), "failed to send last stat") } func fileCanRequestData(m os.FileMode) bool { @@ -184,7 +185,7 @@ func (fs *fileSender) Write(dt []byte) (int, error) { if len(dt) == 0 { return 0, nil } - p := &Packet{Type: PACKET_DATA, ID: fs.id, Data: dt} + p := &types.Packet{Type: types.PACKET_DATA, ID: fs.id, Data: dt} if err := fs.sender.conn.SendMsg(p); err != nil { return 0, err } diff --git a/vendor/github.com/tonistiigi/fsutil/stat.go b/vendor/github.com/tonistiigi/fsutil/stat.go new file mode 100644 index 000000000..573894da8 --- /dev/null +++ b/vendor/github.com/tonistiigi/fsutil/stat.go @@ -0,0 +1,61 @@ +package fsutil + +import ( + "os" + "path/filepath" + "runtime" + + "github.com/pkg/errors" + "github.com/tonistiigi/fsutil/types" +) + +// constructs a Stat object. path is where the path can be found right +// now, relpath is the desired path to be recorded in the stat (so +// relative to whatever base dir is relevant). fi is the os.Stat +// info. inodemap is used to calculate hardlinks over a series of +// mkstat calls and maps inode to the canonical (aka "first") path for +// a set of hardlinks to that inode. +func mkstat(path, relpath string, fi os.FileInfo, inodemap map[uint64]string) (*types.Stat, error) { + relpath = filepath.ToSlash(relpath) + + stat := &types.Stat{ + Path: relpath, + Mode: uint32(fi.Mode()), + ModTime: fi.ModTime().UnixNano(), + } + + setUnixOpt(fi, stat, relpath, inodemap) + + if !fi.IsDir() { + stat.Size_ = fi.Size() + if fi.Mode()&os.ModeSymlink != 0 { + link, err := os.Readlink(path) + if err != nil { + return nil, errors.Wrapf(err, "failed to readlink %s", path) + } + stat.Linkname = link + } + } + if err := loadXattr(path, stat); err != nil { + return nil, errors.Wrapf(err, "failed to xattr %s", relpath) + } + + if runtime.GOOS == "windows" { + permPart := stat.Mode & uint32(os.ModePerm) + noPermPart := stat.Mode &^ uint32(os.ModePerm) + // Add the x bit: make everything +x from windows + permPart |= 0111 + permPart &= 0755 + stat.Mode = noPermPart | permPart + } + + return stat, nil +} + +func Stat(path string) (*types.Stat, error) { + fi, err := os.Lstat(path) + if err != nil { + return nil, errors.Wrap(err, "os stat") + } + return mkstat(path, filepath.Base(path), fi, nil) +} diff --git a/vendor/github.com/tonistiigi/fsutil/walker_unix.go b/vendor/github.com/tonistiigi/fsutil/stat_unix.go similarity index 73% rename from vendor/github.com/tonistiigi/fsutil/walker_unix.go rename to vendor/github.com/tonistiigi/fsutil/stat_unix.go index f368ad492..b2e8fea2c 100644 --- a/vendor/github.com/tonistiigi/fsutil/walker_unix.go +++ b/vendor/github.com/tonistiigi/fsutil/stat_unix.go @@ -8,9 +8,10 @@ import ( "github.com/containerd/continuity/sysx" "github.com/pkg/errors" + "github.com/tonistiigi/fsutil/types" ) -func loadXattr(origpath string, stat *Stat) error { +func loadXattr(origpath string, stat *types.Stat) error { xattrs, err := sysx.LListxattr(origpath) if err != nil { if errors.Cause(err) == syscall.ENOTSUP { @@ -31,7 +32,7 @@ func loadXattr(origpath string, stat *Stat) error { return nil } -func setUnixOpt(fi os.FileInfo, stat *Stat, path string, seenFiles map[uint64]string) { +func setUnixOpt(fi os.FileInfo, stat *types.Stat, path string, seenFiles map[uint64]string) { s := fi.Sys().(*syscall.Stat_t) stat.Uid = s.Uid @@ -45,13 +46,15 @@ func setUnixOpt(fi os.FileInfo, stat *Stat, path string, seenFiles map[uint64]st } ino := s.Ino - if s.Nlink > 1 { - if oldpath, ok := seenFiles[ino]; ok { - stat.Linkname = oldpath - stat.Size_ = 0 + if seenFiles != nil { + if s.Nlink > 1 { + if oldpath, ok := seenFiles[ino]; ok { + stat.Linkname = oldpath + stat.Size_ = 0 + } } + seenFiles[ino] = path } - seenFiles[ino] = path } } diff --git a/vendor/github.com/tonistiigi/fsutil/stat_windows.go b/vendor/github.com/tonistiigi/fsutil/stat_windows.go new file mode 100644 index 000000000..66379bd84 --- /dev/null +++ b/vendor/github.com/tonistiigi/fsutil/stat_windows.go @@ -0,0 +1,16 @@ +// +build windows + +package fsutil + +import ( + "os" + + "github.com/tonistiigi/fsutil/types" +) + +func loadXattr(_ string, _ *types.Stat) error { + return nil +} + +func setUnixOpt(_ os.FileInfo, _ *types.Stat, _ string, _ map[uint64]string) { +} diff --git a/vendor/github.com/tonistiigi/fsutil/generate.go b/vendor/github.com/tonistiigi/fsutil/types/generate.go similarity index 80% rename from vendor/github.com/tonistiigi/fsutil/generate.go rename to vendor/github.com/tonistiigi/fsutil/types/generate.go index e43319566..5c03178f3 100644 --- a/vendor/github.com/tonistiigi/fsutil/generate.go +++ b/vendor/github.com/tonistiigi/fsutil/types/generate.go @@ -1,3 +1,3 @@ -package fsutil +package types //go:generate protoc --gogoslick_out=. stat.proto wire.proto diff --git a/vendor/github.com/tonistiigi/fsutil/stat.pb.go b/vendor/github.com/tonistiigi/fsutil/types/stat.pb.go similarity index 79% rename from vendor/github.com/tonistiigi/fsutil/stat.pb.go rename to vendor/github.com/tonistiigi/fsutil/types/stat.pb.go index 3f6925e4b..d8b984e65 100644 --- a/vendor/github.com/tonistiigi/fsutil/stat.pb.go +++ b/vendor/github.com/tonistiigi/fsutil/types/stat.pb.go @@ -1,9 +1,8 @@ -// Code generated by protoc-gen-gogo. +// Code generated by protoc-gen-gogo. DO NOT EDIT. // source: stat.proto -// DO NOT EDIT! /* - Package fsutil is a generated protocol buffer package. + Package types is a generated protocol buffer package. It is generated from these files: stat.proto @@ -13,7 +12,7 @@ Stat Packet */ -package fsutil +package types import proto "github.com/gogo/protobuf/proto" import fmt "fmt" @@ -23,7 +22,7 @@ import bytes "bytes" import strings "strings" import reflect "reflect" -import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" +import sortkeys "github.com/gogo/protobuf/sortkeys" import io "io" @@ -127,14 +126,11 @@ func (m *Stat) GetXattrs() map[string][]byte { } func init() { - proto.RegisterType((*Stat)(nil), "fsutil.Stat") + proto.RegisterType((*Stat)(nil), "fsutil.types.Stat") } func (this *Stat) Equal(that interface{}) bool { if that == nil { - if this == nil { - return true - } - return false + return this == nil } that1, ok := that.(*Stat) @@ -147,10 +143,7 @@ func (this *Stat) Equal(that interface{}) bool { } } if that1 == nil { - if this == nil { - return true - } - return false + return this == nil } else if this == nil { return false } @@ -196,7 +189,7 @@ func (this *Stat) GoString() string { return "nil" } s := make([]string, 0, 14) - s = append(s, "&fsutil.Stat{") + s = append(s, "&types.Stat{") s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") s = append(s, "Mode: "+fmt.Sprintf("%#v", this.Mode)+",\n") s = append(s, "Uid: "+fmt.Sprintf("%#v", this.Uid)+",\n") @@ -210,7 +203,7 @@ func (this *Stat) GoString() string { for k, _ := range this.Xattrs { keysForXattrs = append(keysForXattrs, k) } - github_com_gogo_protobuf_sortkeys.Strings(keysForXattrs) + sortkeys.Strings(keysForXattrs) mapStringForXattrs := "map[string][]byte{" for _, k := range keysForXattrs { mapStringForXattrs += fmt.Sprintf("%#v: %#v,", k, this.Xattrs[k]) @@ -318,24 +311,6 @@ func (m *Stat) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func encodeFixed64Stat(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Stat(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintStat(dAtA []byte, offset int, v uint64) int { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -413,7 +388,7 @@ func (this *Stat) String() string { for k, _ := range this.Xattrs { keysForXattrs = append(keysForXattrs, k) } - github_com_gogo_protobuf_sortkeys.Strings(keysForXattrs) + sortkeys.Strings(keysForXattrs) mapStringForXattrs := "map[string][]byte{" for _, k := range keysForXattrs { mapStringForXattrs += fmt.Sprintf("%v: %v,", k, this.Xattrs[k]) @@ -688,51 +663,14 @@ func (m *Stat) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var keykey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - keykey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthStat - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey if m.Xattrs == nil { m.Xattrs = make(map[string][]byte) } - if iNdEx < postIndex { - var valuekey uint64 + var mapkey string + mapvalue := []byte{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowStat @@ -742,42 +680,81 @@ func (m *Stat) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - valuekey |= (uint64(b) & 0x7F) << shift + wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } - var mapbyteLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStat + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthStat + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - mapbyteLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapbyteLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStat + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapbyteLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return ErrInvalidLengthStat + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = make([]byte, mapbyteLen) + copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipStat(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStat + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } - intMapbyteLen := int(mapbyteLen) - if intMapbyteLen < 0 { - return ErrInvalidLengthStat - } - postbytesIndex := iNdEx + intMapbyteLen - if postbytesIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue := make([]byte, mapbyteLen) - copy(mapvalue, dAtA[iNdEx:postbytesIndex]) - iNdEx = postbytesIndex - m.Xattrs[mapkey] = mapvalue - } else { - var mapvalue []byte - m.Xattrs[mapkey] = mapvalue } + m.Xattrs[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex @@ -908,24 +885,25 @@ var ( func init() { proto.RegisterFile("stat.proto", fileDescriptorStat) } var fileDescriptorStat = []byte{ - // 303 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x4c, 0x91, 0xb1, 0x4e, 0xf3, 0x30, - 0x14, 0x85, 0x73, 0x9b, 0x36, 0x6d, 0xdd, 0xff, 0x97, 0x90, 0xc5, 0x70, 0xd5, 0xc1, 0x8a, 0x98, - 0x32, 0xa0, 0x08, 0xc1, 0x02, 0x8c, 0x48, 0xbc, 0x40, 0x60, 0x60, 0x35, 0xb2, 0x29, 0xa6, 0x4d, - 0x5c, 0x25, 0x4e, 0x45, 0x99, 0x78, 0x04, 0x1e, 0x83, 0xd7, 0x60, 0x63, 0xec, 0xc8, 0x48, 0xcc, - 0xc2, 0xd8, 0x47, 0x40, 0x76, 0xda, 0xc2, 0x76, 0xce, 0x77, 0x7c, 0x65, 0x9d, 0x7b, 0x09, 0xa9, - 0x0c, 0x37, 0xe9, 0xbc, 0xd4, 0x46, 0xd3, 0xe8, 0xae, 0xaa, 0x8d, 0x9a, 0x1d, 0xbc, 0x75, 0x48, - 0xf7, 0xca, 0x70, 0x43, 0x29, 0xe9, 0xce, 0xb9, 0xb9, 0x47, 0x88, 0x21, 0x19, 0x66, 0x5e, 0x3b, - 0x96, 0x6b, 0x21, 0xb1, 0x13, 0x43, 0xf2, 0x3f, 0xf3, 0x9a, 0xee, 0x91, 0xb0, 0x56, 0x02, 0x43, - 0x8f, 0x9c, 0x74, 0x64, 0xa2, 0x04, 0x76, 0x5b, 0x32, 0x51, 0xc2, 0xcd, 0x55, 0xea, 0x49, 0x62, - 0x2f, 0x86, 0x24, 0xcc, 0xbc, 0xa6, 0x48, 0xfa, 0xb9, 0x16, 0xd7, 0x2a, 0x97, 0x18, 0x79, 0xbc, - 0xb5, 0x74, 0x4c, 0x06, 0x33, 0x55, 0x4c, 0x0b, 0x9e, 0x4b, 0xec, 0xfb, 0xdf, 0x77, 0xde, 0x65, - 0x42, 0x2e, 0x72, 0xfe, 0xa0, 0x4b, 0x1c, 0xf8, 0xb1, 0x9d, 0xdf, 0x66, 0xaa, 0xd0, 0x25, 0x0e, - 0x7f, 0x33, 0xe7, 0xe9, 0x11, 0x89, 0x1e, 0xb9, 0x31, 0x65, 0x85, 0x24, 0x0e, 0x93, 0xd1, 0x31, - 0xa6, 0x6d, 0xdf, 0xd4, 0x75, 0x4d, 0x6f, 0x7c, 0x74, 0x59, 0x98, 0x72, 0x99, 0x6d, 0xde, 0x8d, - 0xcf, 0xc8, 0xe8, 0x0f, 0x76, 0xa5, 0xa6, 0x72, 0xb9, 0xd9, 0x86, 0x93, 0x74, 0x9f, 0xf4, 0x16, - 0x7c, 0x56, 0xb7, 0xdb, 0xf8, 0x97, 0xb5, 0xe6, 0xbc, 0x73, 0x0a, 0x17, 0x87, 0xab, 0x86, 0x05, - 0x1f, 0x0d, 0x0b, 0xd6, 0x0d, 0x83, 0x67, 0xcb, 0xe0, 0xd5, 0x32, 0x78, 0xb7, 0x0c, 0x56, 0x96, - 0xc1, 0xa7, 0x65, 0xf0, 0x6d, 0x59, 0xb0, 0xb6, 0x0c, 0x5e, 0xbe, 0x58, 0x70, 0x1b, 0xf9, 0x03, - 0x9c, 0xfc, 0x04, 0x00, 0x00, 0xff, 0xff, 0x19, 0x97, 0x14, 0xf4, 0x8e, 0x01, 0x00, 0x00, + // 310 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xbd, 0x4e, 0xc3, 0x30, + 0x14, 0x85, 0x73, 0x9b, 0xfe, 0xba, 0x45, 0x42, 0x16, 0x83, 0xd5, 0xe1, 0x2a, 0x62, 0xca, 0x94, + 0x81, 0x4a, 0x08, 0x18, 0x91, 0x78,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, 0x2a, 0x37, + 0xc5, 0x32, 0xdd, 0x4c, 0x0f, 0xcf, 0x49, 0x7f, 0x0f, 0xbb, 0x6a, 0x13, 0xb9, 0xdc, 0xdc, 0xc4, + 0x49, 0x7a, 0x44, 0x5a, 0x0b, 0x3e, 0x9d, 0xd7, 0x37, 0x19, 0xa4, 0xb5, 0xb9, 0x68, 0x9c, 0xc1, + 0xe5, 0x68, 0x55, 0x61, 0xf0, 0x55, 0x61, 0xb0, 0xae, 0x10, 0x5e, 0x2d, 0xc2, 0xbb, 0x45, 0xf8, + 0xb4, 0x08, 0x2b, 0x8b, 0xf0, 0x6d, 0x11, 0x7e, 0x2d, 0x06, 0x6b, 0x8b, 0xf0, 0xf6, 0x83, 0xc1, + 0x5d, 0xcb, 0xff, 0xc8, 0x7d, 0xdb, 0xbf, 0xc9, 0xe8, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x90, 0xc2, + 0xcf, 0x79, 0xa1, 0x01, 0x00, 0x00, } diff --git a/vendor/github.com/tonistiigi/fsutil/stat.proto b/vendor/github.com/tonistiigi/fsutil/types/stat.proto similarity index 84% rename from vendor/github.com/tonistiigi/fsutil/stat.proto rename to vendor/github.com/tonistiigi/fsutil/types/stat.proto index e27941307..4138be694 100644 --- a/vendor/github.com/tonistiigi/fsutil/stat.proto +++ b/vendor/github.com/tonistiigi/fsutil/types/stat.proto @@ -1,6 +1,8 @@ syntax = "proto3"; -package fsutil; +package fsutil.types; + +option go_package = "types"; message Stat { string path = 1; diff --git a/vendor/github.com/tonistiigi/fsutil/wire.pb.go b/vendor/github.com/tonistiigi/fsutil/types/wire.pb.go similarity index 80% rename from vendor/github.com/tonistiigi/fsutil/wire.pb.go rename to vendor/github.com/tonistiigi/fsutil/types/wire.pb.go index 9d334bbdb..47db09479 100644 --- a/vendor/github.com/tonistiigi/fsutil/wire.pb.go +++ b/vendor/github.com/tonistiigi/fsutil/types/wire.pb.go @@ -1,8 +1,7 @@ -// Code generated by protoc-gen-gogo. +// Code generated by protoc-gen-gogo. DO NOT EDIT. // source: wire.proto -// DO NOT EDIT! -package fsutil +package types import proto "github.com/gogo/protobuf/proto" import fmt "fmt" @@ -50,7 +49,7 @@ var Packet_PacketType_value = map[string]int32{ func (Packet_PacketType) EnumDescriptor() ([]byte, []int) { return fileDescriptorWire, []int{0, 0} } type Packet struct { - Type Packet_PacketType `protobuf:"varint,1,opt,name=type,proto3,enum=fsutil.Packet_PacketType" json:"type,omitempty"` + Type Packet_PacketType `protobuf:"varint,1,opt,name=type,proto3,enum=fsutil.types.Packet_PacketType" json:"type,omitempty"` Stat *Stat `protobuf:"bytes,2,opt,name=stat" json:"stat,omitempty"` ID uint32 `protobuf:"varint,3,opt,name=ID,proto3" json:"ID,omitempty"` Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` @@ -89,8 +88,8 @@ func (m *Packet) GetData() []byte { } func init() { - proto.RegisterType((*Packet)(nil), "fsutil.Packet") - proto.RegisterEnum("fsutil.Packet_PacketType", Packet_PacketType_name, Packet_PacketType_value) + proto.RegisterType((*Packet)(nil), "fsutil.types.Packet") + proto.RegisterEnum("fsutil.types.Packet_PacketType", Packet_PacketType_name, Packet_PacketType_value) } func (x Packet_PacketType) String() string { s, ok := Packet_PacketType_name[int32(x)] @@ -101,10 +100,7 @@ func (x Packet_PacketType) String() string { } func (this *Packet) Equal(that interface{}) bool { if that == nil { - if this == nil { - return true - } - return false + return this == nil } that1, ok := that.(*Packet) @@ -117,10 +113,7 @@ func (this *Packet) Equal(that interface{}) bool { } } if that1 == nil { - if this == nil { - return true - } - return false + return this == nil } else if this == nil { return false } @@ -143,7 +136,7 @@ func (this *Packet) GoString() string { return "nil" } s := make([]string, 0, 8) - s = append(s, "&fsutil.Packet{") + s = append(s, "&types.Packet{") s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") if this.Stat != nil { s = append(s, "Stat: "+fmt.Sprintf("%#v", this.Stat)+",\n") @@ -205,24 +198,6 @@ func (m *Packet) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func encodeFixed64Wire(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Wire(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintWire(dAtA []byte, offset int, v uint64) int { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -546,22 +521,22 @@ var ( func init() { proto.RegisterFile("wire.proto", fileDescriptorWire) } var fileDescriptorWire = []byte{ - // 259 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0xcf, 0x2c, 0x4a, - 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4b, 0x2b, 0x2e, 0x2d, 0xc9, 0xcc, 0x91, 0xe2, - 0x2a, 0x2e, 0x49, 0x2c, 0x81, 0x88, 0x29, 0xdd, 0x65, 0xe4, 0x62, 0x0b, 0x48, 0x4c, 0xce, 0x4e, - 0x2d, 0x11, 0xd2, 0xe5, 0x62, 0x29, 0xa9, 0x2c, 0x48, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x33, - 0x92, 0xd4, 0x83, 0xa8, 0xd6, 0x83, 0xc8, 0x42, 0xa9, 0x90, 0xca, 0x82, 0xd4, 0x20, 0xb0, 0x32, - 0x21, 0x05, 0x2e, 0x16, 0x90, 0x39, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x3c, 0x30, 0xe5, - 0xc1, 0x25, 0x89, 0x25, 0x41, 0x60, 0x19, 0x21, 0x3e, 0x2e, 0x26, 0x4f, 0x17, 0x09, 0x66, 0x05, - 0x46, 0x0d, 0xde, 0x20, 0x26, 0x4f, 0x17, 0x21, 0x21, 0x2e, 0x96, 0x94, 0xc4, 0x92, 0x44, 0x09, - 0x16, 0x05, 0x46, 0x0d, 0x9e, 0x20, 0x30, 0x5b, 0x29, 0x8e, 0x8b, 0x0b, 0x61, 0xb2, 0x10, 0x3f, - 0x17, 0x77, 0x80, 0xa3, 0xb3, 0xb7, 0x6b, 0x48, 0x7c, 0x70, 0x88, 0x63, 0x88, 0x00, 0x83, 0x10, - 0x1f, 0x17, 0x17, 0x54, 0x20, 0xc8, 0x35, 0x50, 0x80, 0x11, 0x49, 0x81, 0x8b, 0x63, 0x88, 0xa3, - 0x00, 0x13, 0x92, 0x02, 0x37, 0x4f, 0x3f, 0x01, 0x66, 0x24, 0xbe, 0x6b, 0x50, 0x90, 0x00, 0x8b, - 0x93, 0xce, 0x85, 0x87, 0x72, 0x0c, 0x37, 0x1e, 0xca, 0x31, 0x7c, 0x78, 0x28, 0xc7, 0xd8, 0xf0, - 0x48, 0x8e, 0x71, 0xc5, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, - 0xf0, 0x48, 0x8e, 0xf1, 0xc5, 0x23, 0x39, 0x86, 0x0f, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, - 0x48, 0x62, 0x03, 0x07, 0x8a, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x8b, 0xce, 0x55, 0x3b, 0x36, - 0x01, 0x00, 0x00, + // 268 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0xcf, 0x2c, 0x4a, + 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x49, 0x2b, 0x2e, 0x2d, 0xc9, 0xcc, 0xd1, 0x2b, + 0xa9, 0x2c, 0x48, 0x2d, 0x96, 0xe2, 0x2a, 0x2e, 0x49, 0x2c, 0x81, 0xc8, 0x28, 0xbd, 0x64, 0xe4, + 0x62, 0x0b, 0x48, 0x4c, 0xce, 0x4e, 0x2d, 0x11, 0x32, 0xe6, 0x62, 0x01, 0xc9, 0x4b, 0x30, 0x2a, + 0x30, 0x6a, 0xf0, 0x19, 0xc9, 0xeb, 0x21, 0xeb, 0xd1, 0x83, 0xa8, 0x81, 0x52, 0x21, 0x95, 0x05, + 0xa9, 0x41, 0x60, 0xc5, 0x42, 0x6a, 0x5c, 0x2c, 0x20, 0xd3, 0x24, 0x98, 0x14, 0x18, 0x35, 0xb8, + 0x8d, 0x84, 0x50, 0x35, 0x05, 0x97, 0x24, 0x96, 0x04, 0x81, 0xe5, 0x85, 0xf8, 0xb8, 0x98, 0x3c, + 0x5d, 0x24, 0x98, 0x15, 0x18, 0x35, 0x78, 0x83, 0x98, 0x3c, 0x5d, 0x84, 0x84, 0xb8, 0x58, 0x52, + 0x12, 0x4b, 0x12, 0x25, 0x58, 0x14, 0x18, 0x35, 0x78, 0x82, 0xc0, 0x6c, 0xa5, 0x38, 0x2e, 0x2e, + 0x84, 0xf9, 0x42, 0xfc, 0x5c, 0xdc, 0x01, 0x8e, 0xce, 0xde, 0xae, 0x21, 0xf1, 0xc1, 0x21, 0x8e, + 0x21, 0x02, 0x0c, 0x42, 0x7c, 0x5c, 0x5c, 0x50, 0x81, 0x20, 0xd7, 0x40, 0x01, 0x46, 0x24, 0x05, + 0x2e, 0x8e, 0x21, 0x8e, 0x02, 0x4c, 0x48, 0x0a, 0xdc, 0x3c, 0xfd, 0x04, 0x98, 0x91, 0xf8, 0xae, + 0x41, 0x41, 0x02, 0x2c, 0x4e, 0xc6, 0x17, 0x1e, 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xf0, 0xe1, + 0xa1, 0x1c, 0x63, 0xc3, 0x23, 0x39, 0xc6, 0x15, 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, + 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x17, 0x8f, 0xe4, 0x18, 0x3e, 0x3c, 0x92, 0x63, + 0x9c, 0xf0, 0x58, 0x8e, 0x21, 0x8a, 0x15, 0xec, 0x87, 0x24, 0x36, 0x70, 0x38, 0x19, 0x03, 0x02, + 0x00, 0x00, 0xff, 0xff, 0xce, 0x0f, 0xe2, 0x94, 0x4f, 0x01, 0x00, 0x00, } diff --git a/vendor/github.com/tonistiigi/fsutil/wire.proto b/vendor/github.com/tonistiigi/fsutil/types/wire.proto similarity index 84% rename from vendor/github.com/tonistiigi/fsutil/wire.proto rename to vendor/github.com/tonistiigi/fsutil/types/wire.proto index f9b33f312..3e85000c5 100644 --- a/vendor/github.com/tonistiigi/fsutil/wire.proto +++ b/vendor/github.com/tonistiigi/fsutil/types/wire.proto @@ -1,6 +1,8 @@ syntax = "proto3"; -package fsutil; +package fsutil.types; + +option go_package = "types"; import "stat.proto"; diff --git a/vendor/github.com/tonistiigi/fsutil/walker.go b/vendor/github.com/tonistiigi/fsutil/walker.go index aa5099145..d78340dfe 100644 --- a/vendor/github.com/tonistiigi/fsutil/walker.go +++ b/vendor/github.com/tonistiigi/fsutil/walker.go @@ -4,12 +4,13 @@ import ( "context" "os" "path/filepath" - "runtime" "strings" + "syscall" "time" "github.com/docker/docker/pkg/fileutils" "github.com/pkg/errors" + "github.com/tonistiigi/fsutil/types" ) type WalkOpt struct { @@ -18,7 +19,7 @@ type WalkOpt struct { // FollowPaths contains symlinks that are resolved into include patterns // before performing the fs walk FollowPaths []string - Map func(*Stat) bool + Map func(*types.Stat) bool } func Walk(ctx context.Context, p string, opt *WalkOpt, fn filepath.WalkFunc) error { @@ -71,7 +72,7 @@ func Walk(ctx context.Context, p string, opt *WalkOpt, fn filepath.WalkFunc) err return err } defer func() { - if retErr != nil && os.IsNotExist(errors.Cause(retErr)) { + if retErr != nil && isNotExist(retErr) { retErr = filepath.SkipDir } }() @@ -146,37 +147,9 @@ func Walk(ctx context.Context, p string, opt *WalkOpt, fn filepath.WalkFunc) err } passedFilter: - path = filepath.ToSlash(path) - - stat := &Stat{ - Path: path, - Mode: uint32(fi.Mode()), - ModTime: fi.ModTime().UnixNano(), - } - - setUnixOpt(fi, stat, path, seenFiles) - - if !fi.IsDir() { - stat.Size_ = fi.Size() - if fi.Mode()&os.ModeSymlink != 0 { - link, err := os.Readlink(origpath) - if err != nil { - return errors.Wrapf(err, "failed to readlink %s", origpath) - } - stat.Linkname = link - } - } - if err := loadXattr(origpath, stat); err != nil { - return errors.Wrapf(err, "failed to xattr %s", path) - } - - if runtime.GOOS == "windows" { - permPart := stat.Mode & uint32(os.ModePerm) - noPermPart := stat.Mode &^ uint32(os.ModePerm) - // Add the x bit: make everything +x from windows - permPart |= 0111 - permPart &= 0755 - stat.Mode = noPermPart | permPart + stat, err := mkstat(origpath, path, fi, seenFiles) + if err != nil { + return err } select { @@ -197,7 +170,7 @@ func Walk(ctx context.Context, p string, opt *WalkOpt, fn filepath.WalkFunc) err } type StatInfo struct { - *Stat + *types.Stat } func (s *StatInfo) Name() string { @@ -244,3 +217,14 @@ func trimUntilIndex(str, sep string, count int) string { } } } + +func isNotExist(err error) bool { + err = errors.Cause(err) + if os.IsNotExist(err) { + return true + } + if pe, ok := err.(*os.PathError); ok { + err = pe.Err + } + return err == syscall.ENOTDIR +} diff --git a/vendor/github.com/tonistiigi/fsutil/walker_windows.go b/vendor/github.com/tonistiigi/fsutil/walker_windows.go deleted file mode 100644 index a1a2b4556..000000000 --- a/vendor/github.com/tonistiigi/fsutil/walker_windows.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build windows - -package fsutil - -import ( - "os" -) - -func loadXattr(_ string, _ *Stat) error { - return nil -} - -func setUnixOpt(_ os.FileInfo, _ *Stat, _ string, _ map[uint64]string) { -} diff --git a/vendor/modules.txt b/vendor/modules.txt index f462faf1c..f3ac4c18d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -64,10 +64,10 @@ github.com/containerd/containerd/events github.com/containerd/continuity github.com/containerd/continuity/fs github.com/containerd/continuity/pathdriver -github.com/containerd/continuity/sysx github.com/containerd/continuity/devices github.com/containerd/continuity/driver github.com/containerd/continuity/proto +github.com/containerd/continuity/sysx github.com/containerd/continuity/syscallx # github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3 github.com/containerd/go-runc @@ -174,7 +174,7 @@ github.com/gorilla/context github.com/gorilla/mux # github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc -# github.com/hashicorp/go-immutable-radix v1.0.0 => ../../tonistiigi/go-immutable-radix +# github.com/hashicorp/go-immutable-radix v1.0.0 => github.com/tonistiigi/go-immutable-radix v0.0.0-20170803185627-826af9ccf0fe github.com/hashicorp/go-immutable-radix # github.com/hashicorp/golang-lru v0.5.0 github.com/hashicorp/golang-lru/simplelru @@ -182,7 +182,7 @@ github.com/hashicorp/golang-lru/simplelru github.com/matttproud/golang_protobuf_extensions/pbutil # github.com/mitchellh/hashstructure v1.0.0 github.com/mitchellh/hashstructure -# github.com/moby/buildkit v0.0.0-20180925011041-a927eaf23a2e +# github.com/moby/buildkit v0.3.1-0.20181016065855-0d80bd17a30e github.com/moby/buildkit/api/services/control github.com/moby/buildkit/client github.com/moby/buildkit/identity @@ -238,6 +238,7 @@ github.com/moby/buildkit/cache/blobs github.com/moby/buildkit/exporter/containerimage/exptypes github.com/moby/buildkit/util/progress github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb +github.com/moby/buildkit/cache/util github.com/moby/buildkit/util/tracing github.com/moby/buildkit/session/auth github.com/moby/buildkit/snapshot/blobmapping @@ -307,7 +308,8 @@ github.com/prometheus/procfs/internal/util github.com/sirupsen/logrus # github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 github.com/syndtr/gocapability/capability -# github.com/tonistiigi/fsutil v0.0.0-20180925004926-70b709f90a17 +# github.com/tonistiigi/fsutil v0.0.0-20181011223333-2862f6bc5ac9 +github.com/tonistiigi/fsutil/types github.com/tonistiigi/fsutil # github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea github.com/tonistiigi/units