From 837b9c6214cd43828473d15175b0a3c6e1db8507 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Fri, 5 Oct 2018 18:04:52 +0900 Subject: [PATCH] bump up buildkit Signed-off-by: Akihiro Suda --- builder/fscache/fscache.go | 3 +- vendor.conf | 6 +- .../buildkit/cache/contenthash/checksum.go | 3 +- .../buildkit/cache/contenthash/filehash.go | 8 +- .../cache/contenthash/filehash_unix.go | 4 +- .../cache/contenthash/filehash_windows.go | 4 +- .../github.com/moby/buildkit/cache/fsutil.go | 71 -- .../moby/buildkit/cache/util/fsutil.go | 139 +++ .../github.com/moby/buildkit/client/build.go | 10 + .../moby/buildkit/client/llb/exec.go | 26 +- .../moby/buildkit/client/llb/meta.go | 11 +- .../moby/buildkit/client/llb/state.go | 2 - .../github.com/moby/buildkit/client/solve.go | 4 +- .../moby/buildkit/control/gateway/gateway.go | 16 + .../moby/buildkit/executor/oci/hosts.go | 2 +- .../moby/buildkit/executor/oci/spec_unix.go | 10 + .../executor/runcexecutor/executor.go | 4 + .../frontend/dockerfile/builder/build.go | 5 +- .../dockerfile/dockerfile2llb/convert.go | 4 +- .../dockerfile2llb/convert_nossh.go | 13 + .../dockerfile2llb/convert_runmount.go | 8 + .../dockerfile/dockerfile2llb/convert_ssh.go | 27 + .../instructions/commands_nosecrets.go | 2 +- .../dockerfile/instructions/commands_nossh.go | 7 + .../instructions/commands_runmount.go | 7 + .../dockerfile/instructions/commands_ssh.go | 7 + .../frontend/gateway/client/client.go | 14 +- .../frontend/gateway/forwarder/forward.go | 28 +- .../moby/buildkit/frontend/gateway/gateway.go | 61 +- .../frontend/gateway/grpcclient/client.go | 28 +- .../moby/buildkit/frontend/gateway/pb/caps.go | 15 + .../frontend/gateway/pb/gateway.pb.go | 895 ++++++++++++++++-- .../frontend/gateway/pb/gateway.proto | 24 + .../buildkit/session/filesync/diffcopy.go | 5 +- .../buildkit/session/filesync/filesync.go | 3 +- .../github.com/moby/buildkit/solver/jobs.go | 32 +- .../buildkit/solver/llbsolver/ops/exec.go | 11 + .../moby/buildkit/solver/pb/caps.go | 41 +- .../util/flightcontrol/flightcontrol.go | 31 +- .../moby/buildkit/util/tracing/multispan.go | 22 + vendor/github.com/moby/buildkit/vendor.conf | 2 +- vendor/github.com/tonistiigi/fsutil/diff.go | 4 +- .../tonistiigi/fsutil/diff_containerd.go | 7 +- .../tonistiigi/fsutil/diskwriter.go | 7 +- .../tonistiigi/fsutil/diskwriter_unix.go | 5 +- .../tonistiigi/fsutil/diskwriter_windows.go | 5 +- vendor/github.com/tonistiigi/fsutil/fs.go | 7 +- .../github.com/tonistiigi/fsutil/hardlinks.go | 3 +- .../github.com/tonistiigi/fsutil/receive.go | 23 +- vendor/github.com/tonistiigi/fsutil/send.go | 25 +- vendor/github.com/tonistiigi/fsutil/stat.go | 61 ++ .../fsutil/{walker_unix.go => stat_unix.go} | 20 +- .../tonistiigi/fsutil/stat_windows.go | 16 + .../tonistiigi/fsutil/{ => types}/generate.go | 2 +- .../tonistiigi/fsutil/{ => types}/stat.pb.go | 224 ++--- .../tonistiigi/fsutil/{ => types}/stat.proto | 4 +- .../tonistiigi/fsutil/{ => types}/wire.pb.go | 77 +- .../tonistiigi/fsutil/{ => types}/wire.proto | 4 +- vendor/github.com/tonistiigi/fsutil/walker.go | 40 +- .../tonistiigi/fsutil/walker_windows.go | 14 - 60 files changed, 1686 insertions(+), 477 deletions(-) delete mode 100644 vendor/github.com/moby/buildkit/cache/fsutil.go create mode 100644 vendor/github.com/moby/buildkit/cache/util/fsutil.go create mode 100644 vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_nossh.go create mode 100644 vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_ssh.go create mode 100644 vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_nossh.go create mode 100644 vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_ssh.go create mode 100644 vendor/github.com/moby/buildkit/util/tracing/multispan.go create mode 100644 vendor/github.com/tonistiigi/fsutil/stat.go rename vendor/github.com/tonistiigi/fsutil/{walker_unix.go => stat_unix.go} (68%) create mode 100644 vendor/github.com/tonistiigi/fsutil/stat_windows.go rename vendor/github.com/tonistiigi/fsutil/{ => types}/generate.go (80%) rename vendor/github.com/tonistiigi/fsutil/{ => types}/stat.pb.go (79%) rename vendor/github.com/tonistiigi/fsutil/{ => types}/stat.proto (83%) rename vendor/github.com/tonistiigi/fsutil/{ => types}/wire.pb.go (80%) rename vendor/github.com/tonistiigi/fsutil/{ => types}/wire.proto (84%) delete mode 100644 vendor/github.com/tonistiigi/fsutil/walker_windows.go diff --git a/builder/fscache/fscache.go b/builder/fscache/fscache.go index 2216c338b7..8897fe16d8 100644 --- a/builder/fscache/fscache.go +++ b/builder/fscache/fscache.go @@ -22,6 +22,7 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/tonistiigi/fsutil" + fsutiltypes "github.com/tonistiigi/fsutil/types" bolt "go.etcd.io/bbolt" "golang.org/x/sync/singleflight" ) @@ -614,7 +615,7 @@ func (s sortableCacheSources) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -func newTarsumHash(stat *fsutil.Stat) (hash.Hash, error) { +func newTarsumHash(stat *fsutiltypes.Stat) (hash.Hash, error) { fi := &fsutil.StatInfo{Stat: stat} p := stat.Path if fi.IsDir() { diff --git a/vendor.conf b/vendor.conf index abf3027ec5..b664a47a5c 100644 --- a/vendor.conf +++ b/vendor.conf @@ -26,8 +26,8 @@ github.com/imdario/mergo v0.3.6 golang.org/x/sync 1d60e4601c6fd243af51cc01ddf169918a5407ca # buildkit -github.com/moby/buildkit 8f4dff0d16ea91cb43315d5f5aa4b27f4fe4e1f2 -github.com/tonistiigi/fsutil b19464cd1b6a00773b4f2eb7acf9c30426f9df42 +github.com/moby/buildkit 520201006c9dc676da9cf9655337ac711f7f127d +github.com/tonistiigi/fsutil f567071bed2416e4d87d260d3162722651182317 github.com/grpc-ecosystem/grpc-opentracing 8e809c8a86450a29b90dcc9efbf062d0fe6d9746 github.com/opentracing/opentracing-go 1361b9cd60be79c4c3a7fa9841b3c132e40066a7 github.com/google/shlex 6f45313302b9c56850fc17f99e40caebce98c716 @@ -130,7 +130,7 @@ github.com/gogo/protobuf v1.0.0 github.com/cloudflare/cfssl 1.3.2 github.com/fernet/fernet-go 1b2437bc582b3cfbb341ee5a29f8ef5b42912ff2 github.com/google/certificate-transparency-go v1.0.20 -golang.org/x/crypto a2144134853fc9a27a7b1e3eb4f19f1a76df13c9 +golang.org/x/crypto 0709b304e793a5edb4a2c0145f281ecdc20838a4 golang.org/x/time fbb02b2291d28baffd63558aa44b4b56f178d650 github.com/hashicorp/go-memdb cb9a474f84cc5e41b273b20c6927680b2a8776ad github.com/hashicorp/go-immutable-radix 826af9ccf0feeee615d546d69b11f8e98da8c8f1 git://github.com/tonistiigi/go-immutable-radix.git diff --git a/vendor/github.com/moby/buildkit/cache/contenthash/checksum.go b/vendor/github.com/moby/buildkit/cache/contenthash/checksum.go index 478901c765..35199e02f9 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 46c15cc6df..84018e7852 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 0939112cb7..4f610d772d 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 340954aa36..e15bf1e5ab 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 ec757d5e88..0000000000 --- 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 0000000000..b7aa6730d6 --- /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 93059d1394..f23df4450e 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 a34e75ea1a..8233b076e7 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 25b7885399..702ea14565 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 12ee97a813..15639fd3ee 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 } diff --git a/vendor/github.com/moby/buildkit/client/solve.go b/vendor/github.com/moby/buildkit/client/solve.go index a4267c09f1..b8da069721 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 475d18b4a4..074e739445 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 405d758d32..c350a6de27 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 8a0610ee9a..3e1976a690 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 dca82ffdfa..8080f5714c 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"), 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 3a7c62423a..7e082df082 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/builder/build.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/builder/build.go @@ -96,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}), 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 f32316b2a2..e6a52d8c5f 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go @@ -608,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)) @@ -625,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)) } 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 0000000000..8b8afdc38c --- /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 e42c8614e2..a06ab9a7cb 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 @@ -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_ssh.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_ssh.go new file mode 100644 index 0000000000..b651ad6605 --- /dev/null +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert_ssh.go @@ -0,0 +1,27 @@ +// +build dfssh dfextall + +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_nosecrets.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_nosecrets.go index 58780648db..b0989b2880 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_nosecrets.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_nosecrets.go @@ -1,4 +1,4 @@ -// +build !dfsecrets +// +build !dfsecrets,!dfextall package instructions 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 0000000000..de80958452 --- /dev/null +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_nossh.go @@ -0,0 +1,7 @@ +// +build !dfssh,!dfextall + +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 8cccb76aea..1c33ceed85 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 @@ -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 } 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 0000000000..8e591d3e31 --- /dev/null +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_ssh.go @@ -0,0 +1,7 @@ +// +build dfssh dfextall + +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 18a26c13d0..3723538794 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/client/client.go +++ b/vendor/github.com/moby/buildkit/frontend/gateway/client/client.go @@ -7,6 +7,7 @@ import ( "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 { @@ -17,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 { @@ -31,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 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 d270aedee6..23eb227fb1 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/forwarder/forward.go +++ b/vendor/github.com/moby/buildkit/frontend/gateway/forwarder/forward.go @@ -5,6 +5,7 @@ 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" @@ -15,6 +16,7 @@ import ( "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) { @@ -136,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 f5cceeb8b2..18a28b0183 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 e30c259cda..5e87fa57e5 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}, @@ -354,6 +355,31 @@ 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) { + 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) { + 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 f44076899e..fd05e4c819 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 2895a4b771..cf90c8a26e 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, 0x5e, 0xca, 0x99, 0x60, 0xe8, 0xf6, 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x6f, 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, 0x1b, 0xc7, + 0x17, 0x67, 0xb1,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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, 0x01, 0x7d, 0x04, 0x4b, 0xda, 0x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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 ff1856c1f2..7699959e53 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 b50da2b331..8334ab60db 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 8f0a7c1e07..ae6775f70b 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/solver/jobs.go b/vendor/github.com/moby/buildkit/solver/jobs.go index 6b2ef6194f..371f43199b 100644 --- a/vendor/github.com/moby/buildkit/solver/jobs.go +++ b/vendor/github.com/moby/buildkit/solver/jobs.go @@ -13,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" ) @@ -45,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 @@ -168,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 { @@ -186,6 +189,7 @@ type Job struct { list *Solver pr *progress.MultiReader pw progress.Writer + span opentracing.Span values sync.Map progressCloser func() @@ -303,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{}, @@ -357,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 { @@ -380,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 @@ -428,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 @@ -453,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 @@ -534,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) @@ -557,7 +573,7 @@ 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 { @@ -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 @@ -654,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 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 ee9c3af7bf..e91872459a 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" @@ -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 2fa161584d..b81ec62c41 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/flightcontrol/flightcontrol.go b/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go index d79231173f..89866b76bb 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/tracing/multispan.go b/vendor/github.com/moby/buildkit/util/tracing/multispan.go new file mode 100644 index 0000000000..2b157a1de3 --- /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/vendor.conf b/vendor/github.com/moby/buildkit/vendor.conf index 00f8c83244..ba9a01ed3c 100644 --- a/vendor/github.com/moby/buildkit/vendor.conf +++ b/vendor/github.com/moby/buildkit/vendor.conf @@ -40,7 +40,7 @@ golang.org/x/time f51c12702a4d776e4c1fa9b0fabab841babae631 github.com/docker/docker 71cd53e4a197b303c6ba086bd584ffd67a884281 github.com/pkg/profile 5b67d428864e92711fcbd2f8629456121a56d91f -github.com/tonistiigi/fsutil 7e391b0e788f9b925f22bd3cf88e0210d1643673 +github.com/tonistiigi/fsutil f567071bed2416e4d87d260d3162722651182317 github.com/hashicorp/go-immutable-radix 826af9ccf0feeee615d546d69b11f8e98da8c8f1 git://github.com/tonistiigi/go-immutable-radix.git github.com/hashicorp/golang-lru a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4 github.com/mitchellh/hashstructure 2bca23e0e452137f789efbc8610126fd8b94f73b diff --git a/vendor/github.com/tonistiigi/fsutil/diff.go b/vendor/github.com/tonistiigi/fsutil/diff.go index 340a0e48a4..acad9f4f22 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 73c0005040..e63ee916a6 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 4b727ed446..3213113e0d 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 19dffabf74..ff0a22e3ca 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 c6d0d7bec7..036544f0b6 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 996f4e4a18..132850c904 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 e598ead7e6..d977f0d6bb 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 14ccb6c7bf..fd9ef9aa60 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 e32f6827fb..e7c5a37d1b 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 0000000000..573894da80 --- /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 68% rename from vendor/github.com/tonistiigi/fsutil/walker_unix.go rename to vendor/github.com/tonistiigi/fsutil/stat_unix.go index 7e8ee80346..b2e8fea2cb 100644 --- a/vendor/github.com/tonistiigi/fsutil/walker_unix.go +++ b/vendor/github.com/tonistiigi/fsutil/stat_unix.go @@ -8,11 +8,15 @@ 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 { + return nil + } return errors.Wrapf(err, "failed to xattr %s", origpath) } if len(xattrs) > 0 { @@ -28,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 @@ -42,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 0000000000..66379bd84c --- /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 e433195669..5c03178f36 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 3f6925e4b0..d8b984e65f 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, 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ff, 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, 0x81, 0xc0, 0x80, 0xd8, 0x8c, 0x6c, 0x8a, 0x69, 0x13, 0x57, + 0x89, 0x5b, 0x51, 0x26, 0x1e, 0x81, 0xc7, 0xe0, 0x4d, 0x60, 0xec, 0xc8, 0x48, 0xcc, 0xc2, 0xd8, + 0x47, 0x40, 0x76, 0xda, 0xd2, 0xed, 0x9c, 0xef, 0xdc, 0xab, 0xe4, 0x5c, 0x13, 0x52, 0x1a, 0x6e, + 0x92, 0x59, 0xa1, 0x8d, 0xa6, 0x83, 0x87, 0x72, 0x6e, 0xd4, 0x34, 0x31, 0xcb, 0x99, 0x2c, 0x8f, + 0x3f, 0x1a, 0xa4, 0x79, 0x6d, 0xb8, 0xa1, 0x94, 0x34, 0x67, 0xdc, 0x3c, 0x32, 0x88, 0x20, 0xee, + 0xa5, 0x5e, 0x3b, 0x96, 0x69, 0x21, 0x59, 0x23, 0x82, 0xf8, 0x20, 0xf5, 0x9a, 0x1e, 0x92, 0x70, + 0xae, 0x04, 0x0b, 0x3d, 0x72, 0xd2, 0x91, 0xb1, 0x12, 0xac, 0x59, 0x93, 0xb1, 0x12, 0x6e, 0xaf, + 0x54, 0x2f, 0x92, 0xb5, 0x22, 0x88, 0xc3, 0xd4, 0x6b, 0xca, 0x48, 0x27, 0xd3, 0xe2, 0x46, 0x65, + 0x92, 0xb5, 0x3d, 0xde, 0x5a, 0x3a, 0x24, 0xdd, 0xa9, 0xca, 0x27, 0x39, 0xcf, 0x24, 0xeb, 0xf8, + 0xaf, 0xef, 0xbc, 0xcb, 0x84, 0x5c, 0x64, 0xfc, 0x49, 0x17, 0xac, 0xeb, 0xd7, 0x76, 0x7e, 0x9b, + 0xa9, 0x5c, 0x17, 0xac, 0xf7, 0x9f, 0x39, 0x4f, 0x4f, 0x49, 0xfb, 0x99, 0x1b, 0x53, 0x94, 0x8c, + 0x44, 0x61, 0xdc, 0x3f, 0xc1, 0x64, 0xbf, 0x75, 0xe2, 0x1a, 0x27, 0xb7, 0x7e, 0xe0, 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 83% rename from vendor/github.com/tonistiigi/fsutil/stat.proto rename to vendor/github.com/tonistiigi/fsutil/types/stat.proto index e279413074..4138be6945 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 9d334bbdba..47db09479a 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 f9b33f312c..3e85000c58 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 aa50991455..39e6c94047 100644 --- a/vendor/github.com/tonistiigi/fsutil/walker.go +++ b/vendor/github.com/tonistiigi/fsutil/walker.go @@ -4,12 +4,12 @@ import ( "context" "os" "path/filepath" - "runtime" "strings" "time" "github.com/docker/docker/pkg/fileutils" "github.com/pkg/errors" + "github.com/tonistiigi/fsutil/types" ) type WalkOpt struct { @@ -18,7 +18,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 { @@ -146,37 +146,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 +169,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 { 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 a1a2b45569..0000000000 --- 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) { -}