From d0f00bc1fb2c349ad72ecc2394b8474937de84dd Mon Sep 17 00:00:00 2001 From: Tibor Vass Date: Fri, 21 Sep 2018 20:43:26 +0000 Subject: [PATCH] builder: vendor buildkit to 39404586a50d1b9d0fb1c578cf0f4de7bdb7afe5 Signed-off-by: Tibor Vass --- builder/builder-next/controller.go | 4 +- builder/builder-next/worker/worker.go | 8 +- vendor.conf | 2 +- vendor/github.com/moby/buildkit/cache/gc.go | 27 - .../github.com/moby/buildkit/cache/manager.go | 45 +- .../moby/buildkit/cache/metadata.go | 2 +- .../moby/buildkit/cache/metadata/metadata.go | 2 +- vendor/github.com/moby/buildkit/cache/refs.go | 72 +- .../github.com/moby/buildkit/client/client.go | 12 +- .../moby/buildkit/client/llb/exec.go | 79 ++ .../moby/buildkit/client/llb/resolver.go | 2 + .../moby/buildkit/client/llb/state.go | 1 + .../moby/buildkit/client/workers.go | 4 + .../moby/buildkit/control/control.go | 2 +- .../executor/runcexecutor/executor.go | 134 +-- .../dockerfile/dockerfile2llb/convert.go | 40 +- .../dockerfile2llb/convert_runmount.go | 7 +- .../dockerfile/dockerfile2llb/image.go | 1 + .../buildkit/session/grpchijack/hijack.go | 1 + .../moby/buildkit/session/sshforward/copy.go | 61 ++ .../buildkit/session/sshforward/generate.go | 3 + .../moby/buildkit/session/sshforward/ssh.go | 113 +++ .../buildkit/session/sshforward/ssh.pb.go | 816 ++++++++++++++++++ .../buildkit/session/sshforward/ssh.proto | 22 + .../snapshot/blobmapping/snapshotter.go | 2 +- .../storage.go | 4 +- .../moby/buildkit/solver/cachemanager.go | 4 +- .../github.com/moby/buildkit/solver/jobs.go | 2 +- .../moby/buildkit/solver/llbsolver/bridge.go | 11 +- .../buildkit/solver/llbsolver/ops/exec.go | 95 +- .../moby/buildkit/solver/llbsolver/solver.go | 11 +- .../moby/buildkit/solver/pb/const.go | 13 + .../moby/buildkit/solver/pb/ops.pb.go | 605 ++++++++++--- .../moby/buildkit/solver/pb/ops.proto | 18 + .../moby/buildkit/solver/scheduler.go | 2 +- .../moby/buildkit/source/git/gitsource.go | 2 +- .../moby/buildkit/source/http/httpsource.go | 2 +- .../moby/buildkit/source/local/local.go | 2 +- .../moby/buildkit/util/contentutil/copy.go | 38 + .../moby/buildkit/util/contentutil/fetcher.go | 3 + .../util/contentutil/multiprovider.go | 4 + .../moby/buildkit/util/contentutil/refs.go | 57 ++ .../util/flightcontrol/flightcontrol.go | 12 +- .../moby/buildkit/util/imageutil/config.go | 18 +- .../moby/buildkit/util/imageutil/schema1.go | 87 ++ vendor/github.com/moby/buildkit/vendor.conf | 18 +- .../moby/buildkit/worker/cacheresult.go | 10 +- .../github.com/moby/buildkit/worker/worker.go | 2 +- 48 files changed, 2140 insertions(+), 342 deletions(-) delete mode 100644 vendor/github.com/moby/buildkit/cache/gc.go create mode 100644 vendor/github.com/moby/buildkit/session/sshforward/copy.go create mode 100644 vendor/github.com/moby/buildkit/session/sshforward/generate.go create mode 100644 vendor/github.com/moby/buildkit/session/sshforward/ssh.go create mode 100644 vendor/github.com/moby/buildkit/session/sshforward/ssh.pb.go create mode 100644 vendor/github.com/moby/buildkit/session/sshforward/ssh.proto rename vendor/github.com/moby/buildkit/solver/{boltdbcachestorage => bboltcachestorage}/storage.go (99%) create mode 100644 vendor/github.com/moby/buildkit/util/contentutil/refs.go create mode 100644 vendor/github.com/moby/buildkit/util/imageutil/schema1.go diff --git a/builder/builder-next/controller.go b/builder/builder-next/controller.go index cb9819cdd6..7e0b6bbca3 100644 --- a/builder/builder-next/controller.go +++ b/builder/builder-next/controller.go @@ -22,7 +22,7 @@ import ( "github.com/moby/buildkit/frontend/gateway" "github.com/moby/buildkit/frontend/gateway/forwarder" "github.com/moby/buildkit/snapshot/blobmapping" - "github.com/moby/buildkit/solver/boltdbcachestorage" + "github.com/moby/buildkit/solver/bboltcachestorage" "github.com/moby/buildkit/worker" "github.com/pkg/errors" ) @@ -122,7 +122,7 @@ func newController(rt http.RoundTripper, opt Opt) (*control.Controller, error) { return nil, err } - cacheStorage, err := boltdbcachestorage.NewStore(filepath.Join(opt.Root, "cache.db")) + cacheStorage, err := bboltcachestorage.NewStore(filepath.Join(opt.Root, "cache.db")) if err != nil { return nil, err } diff --git a/builder/builder-next/worker/worker.go b/builder/builder-next/worker/worker.go index e2aae3a63f..28d0d8bea6 100644 --- a/builder/builder-next/worker/worker.go +++ b/builder/builder-next/worker/worker.go @@ -137,8 +137,12 @@ func (w *Worker) GCPolicy() []client.PruneInfo { } // LoadRef loads a reference by ID -func (w *Worker) LoadRef(id string) (cache.ImmutableRef, error) { - return w.CacheManager.Get(context.TODO(), id) +func (w *Worker) LoadRef(id string, hidden bool) (cache.ImmutableRef, error) { + var opts []cache.RefOption + if hidden { + opts = append(opts, cache.NoUpdateLastUsed) + } + return w.CacheManager.Get(context.TODO(), id, opts...) } // ResolveOp converts a LLB vertex into a LLB operation diff --git a/vendor.conf b/vendor.conf index dfdbfa772f..9f26a824fa 100644 --- a/vendor.conf +++ b/vendor.conf @@ -26,7 +26,7 @@ github.com/imdario/mergo v0.3.6 golang.org/x/sync 1d60e4601c6fd243af51cc01ddf169918a5407ca # buildkit -github.com/moby/buildkit d88354f7856a1fafef6f23bc9c5a538c246f4023 +github.com/moby/buildkit 39404586a50d1b9d0fb1c578cf0f4de7bdb7afe5 github.com/tonistiigi/fsutil b19464cd1b6a00773b4f2eb7acf9c30426f9df42 github.com/grpc-ecosystem/grpc-opentracing 8e809c8a86450a29b90dcc9efbf062d0fe6d9746 github.com/opentracing/opentracing-go 1361b9cd60be79c4c3a7fa9841b3c132e40066a7 diff --git a/vendor/github.com/moby/buildkit/cache/gc.go b/vendor/github.com/moby/buildkit/cache/gc.go deleted file mode 100644 index 31a98b93c8..0000000000 --- a/vendor/github.com/moby/buildkit/cache/gc.go +++ /dev/null @@ -1,27 +0,0 @@ -package cache - -import ( - "context" - "errors" - "time" -) - -// GCPolicy defines policy for garbage collection -type GCPolicy struct { - MaxSize uint64 - MaxKeepDuration time.Duration -} - -// // CachePolicy defines policy for keeping a resource in cache -// type CachePolicy struct { -// Priority int -// LastUsed time.Time -// } -// -// func defaultCachePolicy() CachePolicy { -// return CachePolicy{Priority: 10, LastUsed: time.Now()} -// } - -func (cm *cacheManager) GC(ctx context.Context) error { - return errors.New("GC not implemented") -} diff --git a/vendor/github.com/moby/buildkit/cache/manager.go b/vendor/github.com/moby/buildkit/cache/manager.go index e73de71f3a..948eb8df8b 100644 --- a/vendor/github.com/moby/buildkit/cache/manager.go +++ b/vendor/github.com/moby/buildkit/cache/manager.go @@ -25,7 +25,6 @@ var ( type ManagerOpt struct { Snapshotter snapshot.SnapshotterBase - GCPolicy GCPolicy MetadataStore *metadata.Store PruneRefChecker ExternalRefCheckerFunc } @@ -40,7 +39,6 @@ type Accessor interface { type Controller interface { DiskUsage(ctx context.Context, info client.DiskUsageInfo) ([]*client.UsageInfo, error) Prune(ctx context.Context, ch chan client.UsageInfo, info ...client.PruneInfo) error - GC(ctx context.Context) error } type Manager interface { @@ -128,17 +126,24 @@ func (cm *cacheManager) get(ctx context.Context, id string, fromSnapshotter bool rec.mu.Lock() defer rec.mu.Unlock() + triggerUpdate := true + for _, o := range opts { + if o == NoUpdateLastUsed { + triggerUpdate = false + } + } + if rec.mutable { if len(rec.refs) != 0 { return nil, errors.Wrapf(ErrLocked, "%s is locked", id) } if rec.equalImmutable != nil { - return rec.equalImmutable.ref(), nil + return rec.equalImmutable.ref(triggerUpdate), nil } - return rec.mref().commit(ctx) + return rec.mref(triggerUpdate).commit(ctx) } - return rec.ref(), nil + return rec.ref(triggerUpdate), nil } // getRecord returns record for id. Requires manager lock. @@ -166,8 +171,8 @@ func (cm *cacheManager) getRecord(ctx context.Context, id string, fromSnapshotte rec := &cacheRecord{ mu: &sync.Mutex{}, cm: cm, - refs: make(map[Mountable]struct{}), - parent: mutable.Parent(), + refs: make(map[ref]struct{}), + parent: mutable.parentRef(false), md: md, equalMutable: &mutableRef{cacheRecord: mutable}, } @@ -183,7 +188,7 @@ func (cm *cacheManager) getRecord(ctx context.Context, id string, fromSnapshotte var parent ImmutableRef if info.Parent != "" { - parent, err = cm.get(ctx, info.Parent, fromSnapshotter, opts...) + parent, err = cm.get(ctx, info.Parent, fromSnapshotter, append(opts, NoUpdateLastUsed)...) if err != nil { return nil, err } @@ -198,7 +203,7 @@ func (cm *cacheManager) getRecord(ctx context.Context, id string, fromSnapshotte mu: &sync.Mutex{}, mutable: info.Kind != snapshots.KindCommitted, cm: cm, - refs: make(map[Mountable]struct{}), + refs: make(map[ref]struct{}), parent: parent, md: md, } @@ -229,7 +234,7 @@ func (cm *cacheManager) New(ctx context.Context, s ImmutableRef, opts ...RefOpti var parentID string if s != nil { var err error - parent, err = cm.Get(ctx, s.ID()) + parent, err = cm.Get(ctx, s.ID(), NoUpdateLastUsed) if err != nil { return nil, err } @@ -252,7 +257,7 @@ func (cm *cacheManager) New(ctx context.Context, s ImmutableRef, opts ...RefOpti mu: &sync.Mutex{}, mutable: true, cm: cm, - refs: make(map[Mountable]struct{}), + refs: make(map[ref]struct{}), parent: parent, md: md, } @@ -269,7 +274,7 @@ func (cm *cacheManager) New(ctx context.Context, s ImmutableRef, opts ...RefOpti cm.records[id] = rec // TODO: save to db - return rec.mref(), nil + return rec.mref(true), nil } func (cm *cacheManager) GetMutable(ctx context.Context, id string) (MutableRef, error) { cm.mu.Lock() @@ -301,7 +306,7 @@ func (cm *cacheManager) GetMutable(ctx context.Context, id string) (MutableRef, rec.equalImmutable = nil } - return rec.mref(), nil + return rec.mref(true), nil } func (cm *cacheManager) Prune(ctx context.Context, ch chan client.UsageInfo, opts ...client.PruneInfo) error { @@ -669,7 +674,7 @@ func (cm *cacheManager) DiskUsage(ctx context.Context, opt client.DiskUsageInfo) if d.Size == sizeUnknown { func(d *client.UsageInfo) { eg.Go(func() error { - ref, err := cm.Get(ctx, d.ID) + ref, err := cm.Get(ctx, d.ID, NoUpdateLastUsed) if err != nil { d.Size = 0 return nil @@ -700,7 +705,7 @@ func IsNotFound(err error) bool { return errors.Cause(err) == errNotFound } -type RefOption func(withMetadata) error +type RefOption interface{} type cachePolicy int @@ -713,6 +718,10 @@ type withMetadata interface { Metadata() *metadata.StorageItem } +type noUpdateLastUsed struct{} + +var NoUpdateLastUsed noUpdateLastUsed + func HasCachePolicyRetain(m withMetadata) bool { return getCachePolicy(m.Metadata()) == cachePolicyRetain } @@ -750,8 +759,10 @@ func initializeMetadata(m withMetadata, opts ...RefOption) error { } for _, opt := range opts { - if err := opt(m); err != nil { - return err + if fn, ok := opt.(func(withMetadata) error); ok { + if err := fn(m); err != nil { + return err + } } } diff --git a/vendor/github.com/moby/buildkit/cache/metadata.go b/vendor/github.com/moby/buildkit/cache/metadata.go index ae26699dcd..9929868844 100644 --- a/vendor/github.com/moby/buildkit/cache/metadata.go +++ b/vendor/github.com/moby/buildkit/cache/metadata.go @@ -3,10 +3,10 @@ package cache import ( "time" - "github.com/boltdb/bolt" "github.com/moby/buildkit/cache/metadata" "github.com/moby/buildkit/client" "github.com/pkg/errors" + bolt "go.etcd.io/bbolt" ) const sizeUnknown int64 = -1 diff --git a/vendor/github.com/moby/buildkit/cache/metadata/metadata.go b/vendor/github.com/moby/buildkit/cache/metadata/metadata.go index 461ff6cfd7..9da270b4e6 100644 --- a/vendor/github.com/moby/buildkit/cache/metadata/metadata.go +++ b/vendor/github.com/moby/buildkit/cache/metadata/metadata.go @@ -6,9 +6,9 @@ import ( "strings" "sync" - "github.com/boltdb/bolt" "github.com/pkg/errors" "github.com/sirupsen/logrus" + bolt "go.etcd.io/bbolt" ) const ( diff --git a/vendor/github.com/moby/buildkit/cache/refs.go b/vendor/github.com/moby/buildkit/cache/refs.go index af92b80977..7521e0aa9a 100644 --- a/vendor/github.com/moby/buildkit/cache/refs.go +++ b/vendor/github.com/moby/buildkit/cache/refs.go @@ -38,12 +38,16 @@ type Mountable interface { Mount(ctx context.Context, readonly bool) (snapshot.Mountable, error) } +type ref interface { + updateLastUsed() bool +} + type cacheRecord struct { cm *cacheManager mu *sync.Mutex // the mutex is shared by records sharing data mutable bool - refs map[Mountable]struct{} + refs map[ref]struct{} parent ImmutableRef md *metadata.StorageItem @@ -61,15 +65,15 @@ type cacheRecord struct { } // hold ref lock before calling -func (cr *cacheRecord) ref() *immutableRef { - ref := &immutableRef{cacheRecord: cr} +func (cr *cacheRecord) ref(triggerLastUsed bool) *immutableRef { + ref := &immutableRef{cacheRecord: cr, triggerLastUsed: triggerLastUsed} cr.refs[ref] = struct{}{} return ref } // hold ref lock before calling -func (cr *cacheRecord) mref() *mutableRef { - ref := &mutableRef{cacheRecord: cr} +func (cr *cacheRecord) mref(triggerLastUsed bool) *mutableRef { + ref := &mutableRef{cacheRecord: cr, triggerLastUsed: triggerLastUsed} cr.refs[ref] = struct{}{} return ref } @@ -116,13 +120,17 @@ func (cr *cacheRecord) Size(ctx context.Context) (int64, error) { } func (cr *cacheRecord) Parent() ImmutableRef { + return cr.parentRef(true) +} + +func (cr *cacheRecord) parentRef(hidden bool) ImmutableRef { if cr.parent == nil { return nil } p := cr.parent.(*immutableRef) p.mu.Lock() defer p.mu.Unlock() - return p.ref() + return p.ref(hidden) } func (cr *cacheRecord) Mount(ctx context.Context, readonly bool) (snapshot.Mountable, error) { @@ -188,15 +196,17 @@ func (cr *cacheRecord) ID() string { type immutableRef struct { *cacheRecord + triggerLastUsed bool } type mutableRef struct { *cacheRecord + triggerLastUsed bool } func (sr *immutableRef) Clone() ImmutableRef { sr.mu.Lock() - ref := sr.ref() + ref := sr.ref(false) sr.mu.Unlock() return ref } @@ -211,11 +221,33 @@ func (sr *immutableRef) Release(ctx context.Context) error { return sr.release(ctx) } +func (sr *immutableRef) updateLastUsed() bool { + return sr.triggerLastUsed +} + +func (sr *immutableRef) updateLastUsedNow() bool { + if !sr.triggerLastUsed { + return false + } + for r := range sr.refs { + if r.updateLastUsed() { + return false + } + } + return true +} + func (sr *immutableRef) release(ctx context.Context) error { delete(sr.refs, sr) - if len(sr.refs) == 0 { + if sr.updateLastUsedNow() { updateLastUsed(sr.md) + if sr.equalMutable != nil { + sr.equalMutable.triggerLastUsed = true + } + } + + if len(sr.refs) == 0 { if sr.viewMount != nil { // TODO: release viewMount earlier if possible if err := sr.cm.Snapshotter.Remove(ctx, sr.view); err != nil { return err @@ -273,6 +305,10 @@ func (cr *cacheRecord) finalize(ctx context.Context, commit bool) error { return cr.md.Commit() } +func (sr *mutableRef) updateLastUsed() bool { + return sr.triggerLastUsed +} + func (sr *mutableRef) commit(ctx context.Context) (ImmutableRef, error) { if !sr.mutable || len(sr.refs) == 0 { return nil, errors.Wrapf(errInvalid, "invalid mutable ref") @@ -280,13 +316,12 @@ func (sr *mutableRef) commit(ctx context.Context) (ImmutableRef, error) { id := identity.NewID() md, _ := sr.cm.md.Get(id) - rec := &cacheRecord{ mu: sr.mu, cm: sr.cm, - parent: sr.Parent(), + parent: sr.parentRef(false), equalMutable: sr, - refs: make(map[Mountable]struct{}), + refs: make(map[ref]struct{}), md: md, } @@ -312,11 +347,15 @@ func (sr *mutableRef) commit(ctx context.Context) (ImmutableRef, error) { return nil, err } - ref := rec.ref() + ref := rec.ref(true) sr.equalImmutable = ref return ref, nil } +func (sr *mutableRef) updatesLastUsed() bool { + return sr.triggerLastUsed +} + func (sr *mutableRef) Commit(ctx context.Context) (ImmutableRef, error) { sr.cm.mu.Lock() defer sr.cm.mu.Unlock() @@ -342,6 +381,10 @@ func (sr *mutableRef) release(ctx context.Context) error { if getCachePolicy(sr.md) != cachePolicyRetain { if sr.equalImmutable != nil { if getCachePolicy(sr.equalImmutable.md) == cachePolicyRetain { + if sr.updateLastUsed() { + updateLastUsed(sr.md) + sr.triggerLastUsed = false + } return nil } if err := sr.equalImmutable.remove(ctx, false); err != nil { @@ -355,7 +398,10 @@ func (sr *mutableRef) release(ctx context.Context) error { } return sr.remove(ctx, true) } else { - updateLastUsed(sr.md) + if sr.updateLastUsed() { + updateLastUsed(sr.md) + sr.triggerLastUsed = false + } } return nil } diff --git a/vendor/github.com/moby/buildkit/client/client.go b/vendor/github.com/moby/buildkit/client/client.go index 403ed52a8c..6126acdc1b 100644 --- a/vendor/github.com/moby/buildkit/client/client.go +++ b/vendor/github.com/moby/buildkit/client/client.go @@ -25,12 +25,11 @@ type ClientOpt interface{} func New(ctx context.Context, address string, opts ...ClientOpt) (*Client, error) { gopts := []grpc.DialOption{ grpc.WithDialer(dialer), - grpc.FailOnNonTempDialError(true), } needWithInsecure := true for _, o := range opts { - if _, ok := o.(*withBlockOpt); ok { - gopts = append(gopts, grpc.WithBlock(), grpc.FailOnNonTempDialError(true)) + if _, ok := o.(*withFailFast); ok { + gopts = append(gopts, grpc.FailOnNonTempDialError(true)) } if credInfo, ok := o.(*withCredentials); ok { opt, err := loadCredentials(credInfo) @@ -52,7 +51,6 @@ func New(ctx context.Context, address string, opts ...ClientOpt) (*Client, error if address == "" { address = appdefaults.Address } - conn, err := grpc.DialContext(ctx, address, gopts...) if err != nil { return nil, errors.Wrapf(err, "failed to dial %q . make sure buildkitd is running", address) @@ -71,10 +69,10 @@ func (c *Client) Close() error { return c.conn.Close() } -type withBlockOpt struct{} +type withFailFast struct{} -func WithBlock() ClientOpt { - return &withBlockOpt{} +func WithFailFast() ClientOpt { + return &withFailFast{} } type withCredentials struct { diff --git a/vendor/github.com/moby/buildkit/client/llb/exec.go b/vendor/github.com/moby/buildkit/client/llb/exec.go index ebb5b7123f..a34e75ea1a 100644 --- a/vendor/github.com/moby/buildkit/client/llb/exec.go +++ b/vendor/github.com/moby/buildkit/client/llb/exec.go @@ -2,6 +2,7 @@ package llb import ( _ "crypto/sha256" + "fmt" "net" "sort" @@ -61,6 +62,7 @@ type ExecOp struct { constraints Constraints isValidated bool secrets []SecretInfo + ssh []SSHInfo } func (e *ExecOp) AddMount(target string, source Output, opt ...MountOption) Output { @@ -130,6 +132,17 @@ func (e *ExecOp) Marshal(c *Constraints) (digest.Digest, []byte, *pb.OpMetadata, return e.mounts[i].target < e.mounts[j].target }) + if len(e.ssh) > 0 { + for i, s := range e.ssh { + if s.Target == "" { + e.ssh[i].Target = fmt.Sprintf("/run/buildkit/ssh_agent.%d", i) + } + } + if _, ok := e.meta.Env.Get("SSH_AUTH_SOCK"); !ok { + e.meta.Env = e.meta.Env.AddOrReplace("SSH_AUTH_SOCK", e.ssh[0].Target) + } + } + meta := &pb.Meta{ Args: e.meta.Args, Env: e.meta.Env.ToArray(), @@ -264,6 +277,21 @@ func (e *ExecOp) Marshal(c *Constraints) (digest.Digest, []byte, *pb.OpMetadata, peo.Mounts = append(peo.Mounts, pm) } + for _, s := range e.ssh { + pm := &pb.Mount{ + Dest: s.Target, + MountType: pb.MountType_SSH, + SSHOpt: &pb.SSHOpt{ + ID: s.ID, + Uid: uint32(s.UID), + Gid: uint32(s.GID), + Mode: uint32(s.Mode), + Optional: s.Optional, + }, + } + peo.Mounts = append(peo.Mounts, pm) + } + dt, err := pop.Marshal() if err != nil { return "", nil, nil, err @@ -432,6 +460,56 @@ func AddMount(dest string, mountState State, opts ...MountOption) RunOption { }) } +func AddSSHSocket(opts ...SSHOption) RunOption { + return runOptionFunc(func(ei *ExecInfo) { + s := &SSHInfo{ + Mode: 0600, + } + for _, opt := range opts { + opt.SetSSHOption(s) + } + ei.SSH = append(ei.SSH, *s) + }) +} + +type SSHOption interface { + SetSSHOption(*SSHInfo) +} + +type sshOptionFunc func(*SSHInfo) + +func (fn sshOptionFunc) SetSSHOption(si *SSHInfo) { + fn(si) +} + +func SSHID(id string) SSHOption { + return sshOptionFunc(func(si *SSHInfo) { + si.ID = id + }) +} + +func SSHSocketOpt(target string, uid, gid, mode int) SSHOption { + return sshOptionFunc(func(si *SSHInfo) { + si.Target = target + si.UID = uid + si.GID = gid + si.Mode = mode + }) +} + +var SSHOptional = sshOptionFunc(func(si *SSHInfo) { + si.Optional = true +}) + +type SSHInfo struct { + ID string + Target string + Mode int + UID int + GID int + Optional bool +} + func AddSecret(dest string, opts ...SecretOption) RunOption { return runOptionFunc(func(ei *ExecInfo) { s := &SecretInfo{ID: dest, Target: dest, Mode: 0400} @@ -498,6 +576,7 @@ type ExecInfo struct { ReadonlyRootFS bool ProxyEnv *ProxyEnv Secrets []SecretInfo + SSH []SSHInfo } type MountInfo struct { diff --git a/vendor/github.com/moby/buildkit/client/llb/resolver.go b/vendor/github.com/moby/buildkit/client/llb/resolver.go index 45240f0224..d670a99188 100644 --- a/vendor/github.com/moby/buildkit/client/llb/resolver.go +++ b/vendor/github.com/moby/buildkit/client/llb/resolver.go @@ -7,12 +7,14 @@ import ( digest "github.com/opencontainers/go-digest" ) +// WithMetaResolver adds a metadata resolver to an image func WithMetaResolver(mr ImageMetaResolver) ImageOption { return imageOptionFunc(func(ii *ImageInfo) { ii.metaResolver = mr }) } +// ImageMetaResolver can resolve image config metadata from a reference type ImageMetaResolver interface { ResolveImageConfig(ctx context.Context, ref string, opt gw.ResolveImageConfigOpt) (digest.Digest, []byte, error) } diff --git a/vendor/github.com/moby/buildkit/client/llb/state.go b/vendor/github.com/moby/buildkit/client/llb/state.go index e8972dfdba..b5b8f1e111 100644 --- a/vendor/github.com/moby/buildkit/client/llb/state.go +++ b/vendor/github.com/moby/buildkit/client/llb/state.go @@ -196,6 +196,7 @@ func (s State) Run(ro ...RunOption) ExecState { exec.AddMount(m.Target, m.Source, m.Opts...) } exec.secrets = ei.Secrets + exec.ssh = ei.SSH return ExecState{ State: s.WithOutput(exec.Output()), diff --git a/vendor/github.com/moby/buildkit/client/workers.go b/vendor/github.com/moby/buildkit/client/workers.go index 50654897ed..b011ee2efd 100644 --- a/vendor/github.com/moby/buildkit/client/workers.go +++ b/vendor/github.com/moby/buildkit/client/workers.go @@ -11,6 +11,7 @@ import ( "github.com/pkg/errors" ) +// WorkerInfo contains information about a worker type WorkerInfo struct { ID string Labels map[string]string @@ -18,6 +19,7 @@ type WorkerInfo struct { GCPolicy []PruneInfo } +// ListWorkers lists all active workers func (c *Client) ListWorkers(ctx context.Context, opts ...ListWorkersOption) ([]*WorkerInfo, error) { info := &ListWorkersInfo{} for _, o := range opts { @@ -44,10 +46,12 @@ func (c *Client) ListWorkers(ctx context.Context, opts ...ListWorkersOption) ([] return wi, nil } +// ListWorkersOption is an option for a worker list query type ListWorkersOption interface { SetListWorkersOption(*ListWorkersInfo) } +// ListWorkersInfo is a payload for worker list query type ListWorkersInfo struct { Filter []string } diff --git a/vendor/github.com/moby/buildkit/control/control.go b/vendor/github.com/moby/buildkit/control/control.go index 8b3b7bd8ac..96862ed680 100644 --- a/vendor/github.com/moby/buildkit/control/control.go +++ b/vendor/github.com/moby/buildkit/control/control.go @@ -127,7 +127,7 @@ func (c *Controller) Prune(req *controlapi.PruneRequest, stream controlapi.Contr ReleaseUnreferenced() error }); ok { if err := c.ReleaseUnreferenced(); err != nil { - logrus.Errorf("failed to release cache metadata: %+v") + logrus.Errorf("failed to release cache metadata: %+v", err) } } } diff --git a/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go b/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go index cdb0d28ab3..fbf8271821 100644 --- a/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go +++ b/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go @@ -11,6 +11,7 @@ import ( "strconv" "strings" "syscall" + "time" "github.com/containerd/containerd/contrib/seccomp" "github.com/containerd/containerd/mount" @@ -88,7 +89,7 @@ func New(opt Opt, networkProviders map[pb.NetMode]network.Provider) (executor.Ex Command: cmd, Log: filepath.Join(root, "runc-log.json"), LogFormat: runc.JSON, - PdeathSignal: syscall.SIGKILL, + PdeathSignal: syscall.SIGKILL, // this can still leak the process Setpgid: true, // we don't execute runc with --rootless=(true|false) explicitly, // so as to support non-runc runtimes @@ -220,16 +221,43 @@ func (w *runcExecutor) Exec(ctx context.Context, meta executor.Meta, root cache. return err } - forwardIO, err := newForwardIO(stdin, stdout, stderr) - if err != nil { - return errors.Wrap(err, "creating new forwarding IO") - } - defer forwardIO.Close() + // runCtx/killCtx is used for extra check in case the kill command blocks + runCtx, cancelRun := context.WithCancel(context.Background()) + defer cancelRun() + + done := make(chan struct{}) + go func() { + for { + select { + case <-ctx.Done(): + killCtx, timeout := context.WithTimeout(context.Background(), 7*time.Second) + if err := w.runc.Kill(killCtx, id, int(syscall.SIGKILL), nil); err != nil { + logrus.Errorf("failed to kill runc %s: %+v", id, err) + select { + case <-killCtx.Done(): + timeout() + cancelRun() + return + default: + } + } + timeout() + select { + case <-time.After(50 * time.Millisecond): + case <-done: + return + } + case <-done: + return + } + } + }() logrus.Debugf("> creating %s %v", id, meta.Args) - status, err := w.runc.Run(ctx, id, bundle, &runc.CreateOpts{ - IO: forwardIO, + status, err := w.runc.Run(runCtx, id, bundle, &runc.CreateOpts{ + IO: &forwardIO{stdin: stdin, stdout: stdout, stderr: stderr}, }) + close(done) if err != nil { return err } @@ -242,57 +270,11 @@ func (w *runcExecutor) Exec(ctx context.Context, meta executor.Meta, root cache. } type forwardIO struct { - stdin, stdout, stderr *os.File - toRelease []io.Closer - toClose []io.Closer -} - -func newForwardIO(stdin io.ReadCloser, stdout, stderr io.WriteCloser) (f *forwardIO, err error) { - fio := &forwardIO{} - defer func() { - if err != nil { - fio.Close() - } - }() - if stdin != nil { - fio.stdin, err = fio.readCloserToFile(stdin) - if err != nil { - return nil, err - } - } - if stdout != nil { - fio.stdout, err = fio.writeCloserToFile(stdout) - if err != nil { - return nil, err - } - } - if stderr != nil { - fio.stderr, err = fio.writeCloserToFile(stderr) - if err != nil { - return nil, err - } - } - return fio, nil + stdin io.ReadCloser + stdout, stderr io.WriteCloser } func (s *forwardIO) Close() error { - s.CloseAfterStart() - var err error - for _, cl := range s.toClose { - if err1 := cl.Close(); err == nil { - err = err1 - } - } - s.toClose = nil - return err -} - -// release releases active FDs if the process doesn't need them any more -func (s *forwardIO) CloseAfterStart() error { - for _, cl := range s.toRelease { - cl.Close() - } - s.toRelease = nil return nil } @@ -302,46 +284,6 @@ func (s *forwardIO) Set(cmd *exec.Cmd) { cmd.Stderr = s.stderr } -func (s *forwardIO) readCloserToFile(rc io.ReadCloser) (*os.File, error) { - if f, ok := rc.(*os.File); ok { - return f, nil - } - pr, pw, err := os.Pipe() - if err != nil { - return nil, err - } - s.toClose = append(s.toClose, pw) - s.toRelease = append(s.toRelease, pr) - go func() { - _, err := io.Copy(pw, rc) - if err1 := pw.Close(); err == nil { - err = err1 - } - _ = err - }() - return pr, nil -} - -func (s *forwardIO) writeCloserToFile(wc io.WriteCloser) (*os.File, error) { - if f, ok := wc.(*os.File); ok { - return f, nil - } - pr, pw, err := os.Pipe() - if err != nil { - return nil, err - } - s.toClose = append(s.toClose, pr) - s.toRelease = append(s.toRelease, pw) - go func() { - _, err := io.Copy(wc, pr) - if err1 := pw.Close(); err == nil { - err = err1 - } - _ = err - }() - return pw, nil -} - func (s *forwardIO) Stdin() io.WriteCloser { return nil } diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go index 19d017dabc..b2fe8b2937 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/convert.go @@ -23,6 +23,7 @@ import ( "github.com/moby/buildkit/frontend/dockerfile/shell" gw "github.com/moby/buildkit/frontend/gateway/client" "github.com/moby/buildkit/solver/pb" + "github.com/moby/buildkit/util/system" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "golang.org/x/sync/errgroup" @@ -133,8 +134,12 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State, } ds.platform = &p } + allDispatchStates.addState(ds) - total := 1 + total := 0 + if ds.stage.BaseName != emptyImageName && ds.base == nil { + total = 1 + } for _, cmd := range ds.stage.Commands { switch cmd.(type) { case *instructions.AddCommand, *instructions.CopyCommand, *instructions.RunCommand: @@ -143,7 +148,6 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State, } ds.cmdTotal = total - allDispatchStates.addState(ds) if opt.IgnoreCache != nil { if len(opt.IgnoreCache) == 0 { ds.ignoreCache = true @@ -215,10 +219,15 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State, d.stage.BaseName = reference.TagNameOnly(ref).String() var isScratch bool if metaResolver != nil && reachable && !d.unregistered { + prefix := "[" + if opt.PrefixPlatform && platform != nil { + prefix += platforms.Format(*platform) + " " + } + prefix += "internal]" dgst, dt, err := metaResolver.ResolveImageConfig(ctx, d.stage.BaseName, gw.ResolveImageConfigOpt{ Platform: platform, ResolveMode: opt.ImageResolveMode.String(), - LogName: fmt.Sprintf("[internal] load metadata for %s", d.stage.BaseName), + LogName: fmt.Sprintf("%s load metadata for %s", prefix, d.stage.BaseName), }) if err == nil { // handle the error while builder is actually running var img Image @@ -242,6 +251,13 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State, _ = ref if len(img.RootFS.DiffIDs) == 0 { isScratch = true + // schema1 images can't return diffIDs so double check :( + for _, h := range img.History { + if !h.EmptyLayer { + isScratch = false + break + } + } } } } @@ -274,6 +290,11 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State, d.image = clone(d.base.image) } + // make sure that PATH is always set + if _, ok := shell.BuildEnvs(d.image.Config.Env)["PATH"]; !ok { + d.image.Config.Env = append(d.image.Config.Env, "PATH="+system.DefaultPathEnv) + } + // initialize base metadata from image conf for _, env := range d.image.Config.Env { k, v := parseKeyValue(env) @@ -689,16 +710,17 @@ func dispatchCopy(d *dispatchState, c instructions.SourcesAndDest, sourceState l args = append(args[:1], append([]string{"--unpack"}, args[1:]...)...) } - runOpt := []llb.RunOption{llb.Args(args), llb.Dir("/dest"), llb.ReadonlyRootFS(), dfCmd(cmdToPrint), llb.WithCustomName(prefixCommand(d, uppercaseCmd(processCmdEnv(opt.shlex, cmdToPrint.String(), d.state.Env())), d.prefixPlatform, d.state.GetPlatform()))} + platform := opt.targetPlatform + if d.platform != nil { + platform = *d.platform + } + + runOpt := []llb.RunOption{llb.Args(args), llb.Dir("/dest"), llb.ReadonlyRootFS(), dfCmd(cmdToPrint), llb.WithCustomName(prefixCommand(d, uppercaseCmd(processCmdEnv(opt.shlex, cmdToPrint.String(), d.state.Env())), d.prefixPlatform, &platform))} if d.ignoreCache { runOpt = append(runOpt, llb.IgnoreCache) } run := img.Run(append(runOpt, mounts...)...) - d.state = run.AddMount("/dest", d.state).Platform(opt.targetPlatform) - - if d.platform != nil { - d.state = d.state.Platform(*d.platform) - } + d.state = run.AddMount("/dest", d.state).Platform(platform) return commitToHistory(&d.image, commitMessage.String(), true, &d.state) } 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 c726b15c03..e42c8614e2 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 @@ -78,9 +78,12 @@ func dispatchRunMounts(d *dispatchState, c *instructions.RunCommand, sources []* } mountOpts = append(mountOpts, llb.AsPersistentCacheDir(opt.cacheIDNamespace+"/"+mount.CacheID, sharing)) } - target := path.Join("/", mount.Target) + target := mount.Target + if !filepath.IsAbs(filepath.Clean(mount.Target)) { + target = filepath.Join("/", d.state.GetDir(), mount.Target) + } if target == "/" { - return nil, errors.Errorf("invalid mount target %q", mount.Target) + return nil, errors.Errorf("invalid mount target %q", target) } if src := path.Join("/", mount.Source); src != "/" { mountOpts = append(mountOpts, llb.SourcePath(src)) diff --git a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/image.go b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/image.go index 6085d1e4d2..e83e58b657 100644 --- a/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/image.go +++ b/vendor/github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb/image.go @@ -29,6 +29,7 @@ type HealthConfig struct { Retries int `json:",omitempty"` } +// ImageConfig is a docker compatible config for an image type ImageConfig struct { specs.ImageConfig diff --git a/vendor/github.com/moby/buildkit/session/grpchijack/hijack.go b/vendor/github.com/moby/buildkit/session/grpchijack/hijack.go index 6e34b2164e..096a9e806f 100644 --- a/vendor/github.com/moby/buildkit/session/grpchijack/hijack.go +++ b/vendor/github.com/moby/buildkit/session/grpchijack/hijack.go @@ -7,6 +7,7 @@ import ( "google.golang.org/grpc/metadata" ) +// Hijack hijacks session to a connection. func Hijack(stream controlapi.Control_SessionServer) (net.Conn, <-chan struct{}, map[string][]string) { md, _ := metadata.FromIncomingContext(stream.Context()) c, closeCh := streamToConn(stream) diff --git a/vendor/github.com/moby/buildkit/session/sshforward/copy.go b/vendor/github.com/moby/buildkit/session/sshforward/copy.go new file mode 100644 index 0000000000..c101f3b455 --- /dev/null +++ b/vendor/github.com/moby/buildkit/session/sshforward/copy.go @@ -0,0 +1,61 @@ +package sshforward + +import ( + io "io" + + context "golang.org/x/net/context" + "golang.org/x/sync/errgroup" + "google.golang.org/grpc" +) + +func Copy(ctx context.Context, conn io.ReadWriteCloser, stream grpc.Stream) error { + g, ctx := errgroup.WithContext(ctx) + + g.Go(func() (retErr error) { + p := &BytesMessage{} + for { + if err := stream.RecvMsg(p); err != nil { + if err == io.EOF { + return nil + } + conn.Close() + return err + } + select { + case <-ctx.Done(): + conn.Close() + return ctx.Err() + default: + } + if _, err := conn.Write(p.Data); err != nil { + conn.Close() + return err + } + p.Data = p.Data[:0] + } + }) + + g.Go(func() (retErr error) { + for { + buf := make([]byte, 32*1024) + n, err := conn.Read(buf) + switch { + case err == io.EOF: + return nil + case err != nil: + return err + } + select { + case <-ctx.Done(): + return ctx.Err() + default: + } + p := &BytesMessage{Data: buf[:n]} + if err := stream.SendMsg(p); err != nil { + return err + } + } + }) + + return g.Wait() +} diff --git a/vendor/github.com/moby/buildkit/session/sshforward/generate.go b/vendor/github.com/moby/buildkit/session/sshforward/generate.go new file mode 100644 index 0000000000..feecc7743c --- /dev/null +++ b/vendor/github.com/moby/buildkit/session/sshforward/generate.go @@ -0,0 +1,3 @@ +package sshforward + +//go:generate protoc --gogoslick_out=plugins=grpc:. ssh.proto diff --git a/vendor/github.com/moby/buildkit/session/sshforward/ssh.go b/vendor/github.com/moby/buildkit/session/sshforward/ssh.go new file mode 100644 index 0000000000..a4effef604 --- /dev/null +++ b/vendor/github.com/moby/buildkit/session/sshforward/ssh.go @@ -0,0 +1,113 @@ +package sshforward + +import ( + "io/ioutil" + "net" + "os" + "path/filepath" + + "github.com/moby/buildkit/session" + context "golang.org/x/net/context" + "golang.org/x/sync/errgroup" + "google.golang.org/grpc/metadata" +) + +// DefaultID is the default ssh ID +const DefaultID = "default" + +const KeySSHID = "buildkit.ssh.id" + +type server struct { + caller session.Caller +} + +func (s *server) run(ctx context.Context, l net.Listener, id string) error { + eg, ctx := errgroup.WithContext(ctx) + + eg.Go(func() error { + <-ctx.Done() + return ctx.Err() + }) + + eg.Go(func() error { + for { + conn, err := l.Accept() + if err != nil { + return err + } + + client := NewSSHClient(s.caller.Conn()) + + opts := make(map[string][]string) + opts[KeySSHID] = []string{id} + ctx = metadata.NewOutgoingContext(ctx, opts) + + stream, err := client.ForwardAgent(ctx) + if err != nil { + conn.Close() + return err + } + + go Copy(ctx, conn, stream) + } + }) + + return eg.Wait() +} + +type SocketOpt struct { + ID string + UID int + GID int + Mode int +} + +func MountSSHSocket(ctx context.Context, c session.Caller, opt SocketOpt) (sockPath string, closer func() error, err error) { + dir, err := ioutil.TempDir("", ".buildkit-ssh-sock") + if err != nil { + return "", nil, err + } + + defer func() { + if err != nil { + os.RemoveAll(dir) + } + }() + + sockPath = filepath.Join(dir, "ssh_auth_sock") + + l, err := net.Listen("unix", sockPath) + if err != nil { + return "", nil, err + } + + if err := os.Chown(sockPath, opt.UID, opt.GID); err != nil { + l.Close() + return "", nil, err + } + if err := os.Chmod(sockPath, os.FileMode(opt.Mode)); err != nil { + l.Close() + return "", nil, err + } + + s := &server{caller: c} + + id := opt.ID + if id == "" { + id = DefaultID + } + + go s.run(ctx, l, id) // erroring per connection allowed + + return sockPath, func() error { + err := l.Close() + os.RemoveAll(sockPath) + return err + }, nil +} + +func CheckSSHID(ctx context.Context, c session.Caller, id string) error { + client := NewSSHClient(c.Conn()) + _, err := client.CheckAgent(ctx, &CheckAgentRequest{ID: id}) + return err +} diff --git a/vendor/github.com/moby/buildkit/session/sshforward/ssh.pb.go b/vendor/github.com/moby/buildkit/session/sshforward/ssh.pb.go new file mode 100644 index 0000000000..3fb36c9d34 --- /dev/null +++ b/vendor/github.com/moby/buildkit/session/sshforward/ssh.pb.go @@ -0,0 +1,816 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ssh.proto + +/* +Package sshforward is a generated protocol buffer package. + +It is generated from these files: + ssh.proto + +It has these top-level messages: + BytesMessage + CheckAgentRequest + CheckAgentResponse +*/ +package sshforward + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import bytes "bytes" + +import strings "strings" +import reflect "reflect" + +import context "golang.org/x/net/context" +import grpc "google.golang.org/grpc" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// BytesMessage contains a chunk of byte data +type BytesMessage struct { + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *BytesMessage) Reset() { *m = BytesMessage{} } +func (*BytesMessage) ProtoMessage() {} +func (*BytesMessage) Descriptor() ([]byte, []int) { return fileDescriptorSsh, []int{0} } + +func (m *BytesMessage) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +type CheckAgentRequest struct { + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` +} + +func (m *CheckAgentRequest) Reset() { *m = CheckAgentRequest{} } +func (*CheckAgentRequest) ProtoMessage() {} +func (*CheckAgentRequest) Descriptor() ([]byte, []int) { return fileDescriptorSsh, []int{1} } + +func (m *CheckAgentRequest) GetID() string { + if m != nil { + return m.ID + } + return "" +} + +type CheckAgentResponse struct { +} + +func (m *CheckAgentResponse) Reset() { *m = CheckAgentResponse{} } +func (*CheckAgentResponse) ProtoMessage() {} +func (*CheckAgentResponse) Descriptor() ([]byte, []int) { return fileDescriptorSsh, []int{2} } + +func init() { + proto.RegisterType((*BytesMessage)(nil), "moby.sshforward.v1.BytesMessage") + proto.RegisterType((*CheckAgentRequest)(nil), "moby.sshforward.v1.CheckAgentRequest") + proto.RegisterType((*CheckAgentResponse)(nil), "moby.sshforward.v1.CheckAgentResponse") +} +func (this *BytesMessage) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*BytesMessage) + if !ok { + that2, ok := that.(BytesMessage) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.Data, that1.Data) { + return false + } + return true +} +func (this *CheckAgentRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CheckAgentRequest) + if !ok { + that2, ok := that.(CheckAgentRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ID != that1.ID { + return false + } + return true +} +func (this *CheckAgentResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CheckAgentResponse) + if !ok { + that2, ok := that.(CheckAgentResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +func (this *BytesMessage) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&sshforward.BytesMessage{") + s = append(s, "Data: "+fmt.Sprintf("%#v", this.Data)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *CheckAgentRequest) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&sshforward.CheckAgentRequest{") + s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *CheckAgentResponse) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 4) + s = append(s, "&sshforward.CheckAgentResponse{") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringSsh(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for SSH service + +type SSHClient interface { + CheckAgent(ctx context.Context, in *CheckAgentRequest, opts ...grpc.CallOption) (*CheckAgentResponse, error) + ForwardAgent(ctx context.Context, opts ...grpc.CallOption) (SSH_ForwardAgentClient, error) +} + +type sSHClient struct { + cc *grpc.ClientConn +} + +func NewSSHClient(cc *grpc.ClientConn) SSHClient { + return &sSHClient{cc} +} + +func (c *sSHClient) CheckAgent(ctx context.Context, in *CheckAgentRequest, opts ...grpc.CallOption) (*CheckAgentResponse, error) { + out := new(CheckAgentResponse) + err := grpc.Invoke(ctx, "/moby.sshforward.v1.SSH/CheckAgent", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sSHClient) ForwardAgent(ctx context.Context, opts ...grpc.CallOption) (SSH_ForwardAgentClient, error) { + stream, err := grpc.NewClientStream(ctx, &_SSH_serviceDesc.Streams[0], c.cc, "/moby.sshforward.v1.SSH/ForwardAgent", opts...) + if err != nil { + return nil, err + } + x := &sSHForwardAgentClient{stream} + return x, nil +} + +type SSH_ForwardAgentClient interface { + Send(*BytesMessage) error + Recv() (*BytesMessage, error) + grpc.ClientStream +} + +type sSHForwardAgentClient struct { + grpc.ClientStream +} + +func (x *sSHForwardAgentClient) Send(m *BytesMessage) error { + return x.ClientStream.SendMsg(m) +} + +func (x *sSHForwardAgentClient) Recv() (*BytesMessage, error) { + m := new(BytesMessage) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for SSH service + +type SSHServer interface { + CheckAgent(context.Context, *CheckAgentRequest) (*CheckAgentResponse, error) + ForwardAgent(SSH_ForwardAgentServer) error +} + +func RegisterSSHServer(s *grpc.Server, srv SSHServer) { + s.RegisterService(&_SSH_serviceDesc, srv) +} + +func _SSH_CheckAgent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CheckAgentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SSHServer).CheckAgent(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/moby.sshforward.v1.SSH/CheckAgent", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SSHServer).CheckAgent(ctx, req.(*CheckAgentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SSH_ForwardAgent_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(SSHServer).ForwardAgent(&sSHForwardAgentServer{stream}) +} + +type SSH_ForwardAgentServer interface { + Send(*BytesMessage) error + Recv() (*BytesMessage, error) + grpc.ServerStream +} + +type sSHForwardAgentServer struct { + grpc.ServerStream +} + +func (x *sSHForwardAgentServer) Send(m *BytesMessage) error { + return x.ServerStream.SendMsg(m) +} + +func (x *sSHForwardAgentServer) Recv() (*BytesMessage, error) { + m := new(BytesMessage) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _SSH_serviceDesc = grpc.ServiceDesc{ + ServiceName: "moby.sshforward.v1.SSH", + HandlerType: (*SSHServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CheckAgent", + Handler: _SSH_CheckAgent_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ForwardAgent", + Handler: _SSH_ForwardAgent_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "ssh.proto", +} + +func (m *BytesMessage) 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 *BytesMessage) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Data) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSsh(dAtA, i, uint64(len(m.Data))) + i += copy(dAtA[i:], m.Data) + } + return i, nil +} + +func (m *CheckAgentRequest) 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 *CheckAgentRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSsh(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + return i, nil +} + +func (m *CheckAgentResponse) 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 *CheckAgentResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func encodeVarintSsh(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *BytesMessage) Size() (n int) { + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + sovSsh(uint64(l)) + } + return n +} + +func (m *CheckAgentRequest) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovSsh(uint64(l)) + } + return n +} + +func (m *CheckAgentResponse) Size() (n int) { + var l int + _ = l + return n +} + +func sovSsh(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozSsh(x uint64) (n int) { + return sovSsh(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *BytesMessage) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BytesMessage{`, + `Data:` + fmt.Sprintf("%v", this.Data) + `,`, + `}`, + }, "") + return s +} +func (this *CheckAgentRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CheckAgentRequest{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `}`, + }, "") + return s +} +func (this *CheckAgentResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CheckAgentResponse{`, + `}`, + }, "") + return s +} +func valueToStringSsh(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *BytesMessage) 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 ErrIntOverflowSsh + } + 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: BytesMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BytesMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSsh + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthSsh + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSsh(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSsh + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CheckAgentRequest) 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 ErrIntOverflowSsh + } + 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: CheckAgentRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CheckAgentRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSsh + } + 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 ErrInvalidLengthSsh + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSsh(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSsh + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CheckAgentResponse) 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 ErrIntOverflowSsh + } + 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: CheckAgentResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CheckAgentResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipSsh(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSsh + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSsh(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSsh + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSsh + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSsh + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthSsh + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSsh + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipSsh(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthSsh = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSsh = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("ssh.proto", fileDescriptorSsh) } + +var fileDescriptorSsh = []byte{ + // 243 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2c, 0x2e, 0xce, 0xd0, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xca, 0xcd, 0x4f, 0xaa, 0xd4, 0x2b, 0x2e, 0xce, 0x48, + 0xcb, 0x2f, 0x2a, 0x4f, 0x2c, 0x4a, 0xd1, 0x2b, 0x33, 0x54, 0x52, 0xe2, 0xe2, 0x71, 0xaa, 0x2c, + 0x49, 0x2d, 0xf6, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0x15, 0x12, 0xe2, 0x62, 0x49, 0x49, 0x2c, + 0x49, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x09, 0x02, 0xb3, 0x95, 0x94, 0xb9, 0x04, 0x9d, 0x33, + 0x52, 0x93, 0xb3, 0x1d, 0xd3, 0x53, 0xf3, 0x4a, 0x82, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x84, + 0xf8, 0xb8, 0x98, 0x3c, 0x5d, 0xc0, 0xca, 0x38, 0x83, 0x98, 0x3c, 0x5d, 0x94, 0x44, 0xb8, 0x84, + 0x90, 0x15, 0x15, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x1a, 0xed, 0x62, 0xe4, 0x62, 0x0e, 0x0e, 0xf6, + 0x10, 0x8a, 0xe6, 0xe2, 0x42, 0xc8, 0x0a, 0xa9, 0xea, 0x61, 0xba, 0x44, 0x0f, 0xc3, 0x0a, 0x29, + 0x35, 0x42, 0xca, 0x20, 0x96, 0x08, 0x85, 0x71, 0xf1, 0xb8, 0x41, 0x14, 0x40, 0x8c, 0x57, 0xc0, + 0xa6, 0x0f, 0xd9, 0x97, 0x52, 0x04, 0x55, 0x68, 0x30, 0x1a, 0x30, 0x3a, 0x59, 0x5c, 0x78, 0x28, + 0xc7, 0x70, 0xe3, 0xa1, 0x1c, 0xc3, 0x87, 0x87, 0x72, 0x8c, 0x0d, 0x8f, 0xe4, 0x18, 0x57, 0x3c, + 0x92, 0x63, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x5f, + 0x3c, 0x92, 0x63, 0xf8, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x28, 0x2e, 0x84, 0x69, + 0x49, 0x6c, 0xe0, 0x00, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x31, 0x3e, 0x40, 0xab, 0x7d, + 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/moby/buildkit/session/sshforward/ssh.proto b/vendor/github.com/moby/buildkit/session/sshforward/ssh.proto new file mode 100644 index 0000000000..99f63436a6 --- /dev/null +++ b/vendor/github.com/moby/buildkit/session/sshforward/ssh.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package moby.sshforward.v1; + +option go_package = "sshforward"; + +service SSH { + rpc CheckAgent(CheckAgentRequest) returns (CheckAgentResponse); + rpc ForwardAgent(stream BytesMessage) returns (stream BytesMessage); +} + +// BytesMessage contains a chunk of byte data +message BytesMessage{ + bytes data = 1; +} + +message CheckAgentRequest { + string ID = 1; +} + +message CheckAgentResponse { +} \ No newline at end of file diff --git a/vendor/github.com/moby/buildkit/snapshot/blobmapping/snapshotter.go b/vendor/github.com/moby/buildkit/snapshot/blobmapping/snapshotter.go index e91241b7b6..d6861ae5d6 100644 --- a/vendor/github.com/moby/buildkit/snapshot/blobmapping/snapshotter.go +++ b/vendor/github.com/moby/buildkit/snapshot/blobmapping/snapshotter.go @@ -3,13 +3,13 @@ package blobmapping import ( "context" - "github.com/boltdb/bolt" "github.com/containerd/containerd/content" "github.com/containerd/containerd/snapshots" "github.com/moby/buildkit/cache/metadata" "github.com/moby/buildkit/snapshot" digest "github.com/opencontainers/go-digest" "github.com/sirupsen/logrus" + bolt "go.etcd.io/bbolt" ) const blobKey = "blobmapping.blob" diff --git a/vendor/github.com/moby/buildkit/solver/boltdbcachestorage/storage.go b/vendor/github.com/moby/buildkit/solver/bboltcachestorage/storage.go similarity index 99% rename from vendor/github.com/moby/buildkit/solver/boltdbcachestorage/storage.go rename to vendor/github.com/moby/buildkit/solver/bboltcachestorage/storage.go index 0b38fe8610..19755816cd 100644 --- a/vendor/github.com/moby/buildkit/solver/boltdbcachestorage/storage.go +++ b/vendor/github.com/moby/buildkit/solver/bboltcachestorage/storage.go @@ -1,14 +1,14 @@ -package boltdbcachestorage +package bboltcachestorage import ( "bytes" "encoding/json" "fmt" - "github.com/boltdb/bolt" "github.com/moby/buildkit/solver" digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" + bolt "go.etcd.io/bbolt" ) const ( diff --git a/vendor/github.com/moby/buildkit/solver/cachemanager.go b/vendor/github.com/moby/buildkit/solver/cachemanager.go index 1c7a1ada67..ce41aa791b 100644 --- a/vendor/github.com/moby/buildkit/solver/cachemanager.go +++ b/vendor/github.com/moby/buildkit/solver/cachemanager.go @@ -10,12 +10,12 @@ import ( "github.com/sirupsen/logrus" ) -type CacheID string - +// NewInMemoryCacheManager creates a new in-memory cache manager func NewInMemoryCacheManager() CacheManager { return NewCacheManager(identity.NewID(), NewInMemoryCacheStorage(), NewInMemoryResultStorage()) } +// NewCacheManager creates a new cache manager with specific storage backend func NewCacheManager(id string, storage CacheKeyStorage, results CacheResultStorage) CacheManager { cm := &cacheManager{ id: id, diff --git a/vendor/github.com/moby/buildkit/solver/jobs.go b/vendor/github.com/moby/buildkit/solver/jobs.go index 5a996ee806..66a9a51621 100644 --- a/vendor/github.com/moby/buildkit/solver/jobs.go +++ b/vendor/github.com/moby/buildkit/solver/jobs.go @@ -26,7 +26,7 @@ type Builder interface { // Solver provides a shared graph of all the vertexes currently being // processed. Every vertex that is being solved needs to be loaded into job -// first. Vertex operations are invoked and progress tracking happends through +// first. Vertex operations are invoked and progress tracking happens through // jobs. type Solver struct { mu sync.RWMutex diff --git a/vendor/github.com/moby/buildkit/solver/llbsolver/bridge.go b/vendor/github.com/moby/buildkit/solver/llbsolver/bridge.go index b572570612..5894417deb 100644 --- a/vendor/github.com/moby/buildkit/solver/llbsolver/bridge.go +++ b/vendor/github.com/moby/buildkit/solver/llbsolver/bridge.go @@ -7,6 +7,7 @@ import ( "strings" "sync" + "github.com/containerd/containerd/platforms" "github.com/docker/distribution/reference" "github.com/moby/buildkit/cache" "github.com/moby/buildkit/cache/remotecache" @@ -49,7 +50,7 @@ func (b *llbBridge) Solve(ctx context.Context, req frontend.SolveRequest) (res * func(ref string) { cm = newLazyCacheManager(ref, func() (solver.CacheManager, error) { var cmNew solver.CacheManager - if err := inVertexContext(b.builder.Context(ctx), "importing cache manifest from "+ref, func(ctx context.Context) error { + if err := inVertexContext(b.builder.Context(ctx), "importing cache manifest from "+ref, "", func(ctx context.Context) error { if b.resolveCacheImporter == nil { return errors.New("no cache importer is available") } @@ -143,7 +144,13 @@ func (s *llbBridge) ResolveImageConfig(ctx context.Context, ref string, opt gw.R if opt.LogName == "" { opt.LogName = fmt.Sprintf("resolve image config for %s", ref) } - err = inVertexContext(s.builder.Context(ctx), opt.LogName, func(ctx context.Context) error { + id := ref // make a deterministic ID for avoiding duplicates + if platform := opt.Platform; platform == nil { + id += platforms.Format(platforms.DefaultSpec()) + } else { + id += platforms.Format(*platform) + } + err = inVertexContext(s.builder.Context(ctx), opt.LogName, id, func(ctx context.Context) error { dgst, config, err = w.ResolveImageConfig(ctx, ref, opt) return err }) 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 3abb82c7ac..ee9c3af7bf 100644 --- a/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go +++ b/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go @@ -16,7 +16,6 @@ import ( "sync" "time" - "github.com/boltdb/bolt" "github.com/containerd/containerd/mount" "github.com/docker/docker/pkg/locker" "github.com/moby/buildkit/cache" @@ -26,6 +25,7 @@ import ( "github.com/moby/buildkit/identity" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/secrets" + "github.com/moby/buildkit/session/sshforward" "github.com/moby/buildkit/snapshot" "github.com/moby/buildkit/solver" "github.com/moby/buildkit/solver/llbsolver" @@ -36,6 +36,9 @@ import ( "github.com/opencontainers/runc/libcontainer/system" "github.com/pkg/errors" "github.com/sirupsen/logrus" + bolt "go.etcd.io/bbolt" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) const execCacheType = "buildkit.exec.v0" @@ -279,6 +282,85 @@ func (e *execOp) getRefCacheDirNoCache(ctx context.Context, key string, ref cach return mRef, nil } +func (e *execOp) getSSHMountable(ctx context.Context, m *pb.Mount) (cache.Mountable, error) { + sessionID := session.FromContext(ctx) + if sessionID == "" { + return nil, errors.New("could not access local files without session") + } + + timeoutCtx, cancel := context.WithTimeout(ctx, 5*time.Second) + defer cancel() + + caller, err := e.sm.Get(timeoutCtx, sessionID) + if err != nil { + return nil, err + } + + if err := sshforward.CheckSSHID(ctx, caller, m.SSHOpt.ID); err != nil { + if m.SSHOpt.Optional { + return nil, nil + } + if st, ok := status.FromError(err); ok && st.Code() == codes.Unimplemented { + return nil, errors.Errorf("no ssh forwarded from the client") + } + return nil, err + } + + return &sshMount{mount: m, caller: caller}, nil +} + +type sshMount struct { + mount *pb.Mount + caller session.Caller +} + +func (sm *sshMount) Mount(ctx context.Context, readonly bool) (snapshot.Mountable, error) { + return &sshMountInstance{sm: sm}, nil +} + +type sshMountInstance struct { + sm *sshMount + cleanup func() error +} + +func (sm *sshMountInstance) Mount() ([]mount.Mount, error) { + ctx, cancel := context.WithCancel(context.TODO()) + + sock, cleanup, err := sshforward.MountSSHSocket(ctx, sm.sm.caller, sshforward.SocketOpt{ + ID: sm.sm.mount.SSHOpt.ID, + UID: int(sm.sm.mount.SSHOpt.Uid), + GID: int(sm.sm.mount.SSHOpt.Gid), + Mode: int(sm.sm.mount.SSHOpt.Mode), + }) + if err != nil { + cancel() + return nil, err + } + sm.cleanup = func() error { + var err error + if cleanup != nil { + err = cleanup() + } + cancel() + return err + } + + return []mount.Mount{{ + Type: "bind", + Source: sock, + Options: []string{"rbind"}, + }}, nil +} + +func (sm *sshMountInstance) Release() error { + if sm.cleanup != nil { + if err := sm.cleanup(); err != nil { + return err + } + } + return nil +} + func (e *execOp) getSecretMountable(ctx context.Context, m *pb.Mount) (cache.Mountable, error) { if m.SecretOpt == nil { return nil, errors.Errorf("invalid sercet mount options") @@ -482,6 +564,17 @@ func (e *execOp) Exec(ctx context.Context, inputs []solver.Result) ([]solver.Res continue } mountable = secretMount + + case pb.MountType_SSH: + sshMount, err := e.getSSHMountable(ctx, m) + if err != nil { + return nil, err + } + if sshMount == nil { + continue + } + mountable = sshMount + default: return nil, errors.Errorf("mount type %s not implemented", m.MountType) } diff --git a/vendor/github.com/moby/buildkit/solver/llbsolver/solver.go b/vendor/github.com/moby/buildkit/solver/llbsolver/solver.go index bedbac09d3..6b258d92d4 100644 --- a/vendor/github.com/moby/buildkit/solver/llbsolver/solver.go +++ b/vendor/github.com/moby/buildkit/solver/llbsolver/solver.go @@ -168,7 +168,7 @@ func (s *Solver) Solve(ctx context.Context, id string, req frontend.SolveRequest inp.Refs = m } - if err := inVertexContext(j.Context(ctx), exp.Name(), func(ctx context.Context) error { + if err := inVertexContext(j.Context(ctx), exp.Name(), "", func(ctx context.Context) error { exporterResponse, err = exp.Export(ctx, inp) return err }); err != nil { @@ -177,7 +177,7 @@ func (s *Solver) Solve(ctx context.Context, id string, req frontend.SolveRequest } if e := exp.CacheExporter; e != nil { - if err := inVertexContext(j.Context(ctx), "exporting cache", func(ctx context.Context) error { + if err := inVertexContext(j.Context(ctx), "exporting cache", "", func(ctx context.Context) error { prepareDone := oneOffProgress(ctx, "preparing build cache for export") if err := res.EachRef(func(res solver.CachedResult) error { // all keys have same export chain so exporting others is not needed @@ -243,9 +243,12 @@ func oneOffProgress(ctx context.Context, id string) func(err error) error { } } -func inVertexContext(ctx context.Context, name string, f func(ctx context.Context) error) error { +func inVertexContext(ctx context.Context, name, id string, f func(ctx context.Context) error) error { + if id == "" { + id = identity.NewID() + } v := client.Vertex{ - Digest: digest.FromBytes([]byte(identity.NewID())), + Digest: digest.FromBytes([]byte(id)), Name: name, } pw, _, ctx := progress.FromContext(ctx, progress.WithMetadata("vertex", v.Digest)) diff --git a/vendor/github.com/moby/buildkit/solver/pb/const.go b/vendor/github.com/moby/buildkit/solver/pb/const.go index 2cb9951082..c2d20b29f2 100644 --- a/vendor/github.com/moby/buildkit/solver/pb/const.go +++ b/vendor/github.com/moby/buildkit/solver/pb/const.go @@ -1,12 +1,25 @@ package pb +// InputIndex is incrementing index to the input vertex type InputIndex int64 + +// OutputIndex is incrementing index that another vertex can depend on type OutputIndex int64 +// RootMount is a base mountpoint const RootMount = "/" + +// SkipOutput marks a disabled output index const SkipOutput OutputIndex = -1 + +// Empty marks an input with no content const Empty InputIndex = -1 + +// LLBBuilder is a special builder for BuildOp that directly builds LLB const LLBBuilder InputIndex = -1 +// LLBDefinitionInput marks an input that contains LLB definition for BuildOp const LLBDefinitionInput = "buildkit.llb.definition" + +// LLBDefaultDefinitionFile is a filename containing the definition in LLBBuilder const LLBDefaultDefinitionFile = LLBDefinitionInput diff --git a/vendor/github.com/moby/buildkit/solver/pb/ops.pb.go b/vendor/github.com/moby/buildkit/solver/pb/ops.pb.go index 7a78618b72..fd97675db7 100644 --- a/vendor/github.com/moby/buildkit/solver/pb/ops.pb.go +++ b/vendor/github.com/moby/buildkit/solver/pb/ops.pb.go @@ -19,6 +19,7 @@ Mount CacheOpt SecretOpt + SSHOpt CopyOp CopySource SourceOp @@ -41,6 +42,8 @@ import _ "github.com/gogo/protobuf/gogoproto" import github_com_opencontainers_go_digest "github.com/opencontainers/go-digest" import github_com_moby_buildkit_util_apicaps "github.com/moby/buildkit/util/apicaps" +import sortkeys "github.com/gogo/protobuf/sortkeys" + import io "io" // Reference imports to suppress errors if they are not otherwise used. @@ -512,6 +515,7 @@ type Mount struct { MountType MountType `protobuf:"varint,6,opt,name=mountType,proto3,enum=pb.MountType" json:"mountType,omitempty"` CacheOpt *CacheOpt `protobuf:"bytes,20,opt,name=cacheOpt" json:"cacheOpt,omitempty"` SecretOpt *SecretOpt `protobuf:"bytes,21,opt,name=secretOpt" json:"secretOpt,omitempty"` + SSHOpt *SSHOpt `protobuf:"bytes,22,opt,name=SSHOpt" json:"SSHOpt,omitempty"` } func (m *Mount) Reset() { *m = Mount{} } @@ -561,6 +565,13 @@ func (m *Mount) GetSecretOpt() *SecretOpt { return nil } +func (m *Mount) GetSSHOpt() *SSHOpt { + if m != nil { + return m.SSHOpt + } + return nil +} + // CacheOpt defines options specific to cache mounts type CacheOpt struct { // ID is an optional namespace for the mount @@ -643,6 +654,61 @@ func (m *SecretOpt) GetOptional() bool { return false } +// SSHOpt defines options describing secret mounts +type SSHOpt struct { + // ID of exposed ssh rule. Used for quering the value. + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` + // UID of agent socket + Uid uint32 `protobuf:"varint,2,opt,name=uid,proto3" json:"uid,omitempty"` + // GID of agent socket + Gid uint32 `protobuf:"varint,3,opt,name=gid,proto3" json:"gid,omitempty"` + // Mode is the filesystem mode of agent socket + Mode uint32 `protobuf:"varint,4,opt,name=mode,proto3" json:"mode,omitempty"` + // Optional defines if ssh socket is required. Error is produced + // if client does not expose ssh. + Optional bool `protobuf:"varint,5,opt,name=optional,proto3" json:"optional,omitempty"` +} + +func (m *SSHOpt) Reset() { *m = SSHOpt{} } +func (m *SSHOpt) String() string { return proto.CompactTextString(m) } +func (*SSHOpt) ProtoMessage() {} +func (*SSHOpt) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{8} } + +func (m *SSHOpt) GetID() string { + if m != nil { + return m.ID + } + return "" +} + +func (m *SSHOpt) GetUid() uint32 { + if m != nil { + return m.Uid + } + return 0 +} + +func (m *SSHOpt) GetGid() uint32 { + if m != nil { + return m.Gid + } + return 0 +} + +func (m *SSHOpt) GetMode() uint32 { + if m != nil { + return m.Mode + } + return 0 +} + +func (m *SSHOpt) GetOptional() bool { + if m != nil { + return m.Optional + } + return false +} + // CopyOp copies files across Ops. type CopyOp struct { Src []*CopySource `protobuf:"bytes,1,rep,name=src" json:"src,omitempty"` @@ -652,7 +718,7 @@ type CopyOp struct { func (m *CopyOp) Reset() { *m = CopyOp{} } func (m *CopyOp) String() string { return proto.CompactTextString(m) } func (*CopyOp) ProtoMessage() {} -func (*CopyOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{8} } +func (*CopyOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{9} } func (m *CopyOp) GetSrc() []*CopySource { if m != nil { @@ -677,7 +743,7 @@ type CopySource struct { func (m *CopySource) Reset() { *m = CopySource{} } func (m *CopySource) String() string { return proto.CompactTextString(m) } func (*CopySource) ProtoMessage() {} -func (*CopySource) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{9} } +func (*CopySource) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{10} } func (m *CopySource) GetSelector() string { if m != nil { @@ -698,7 +764,7 @@ type SourceOp struct { func (m *SourceOp) Reset() { *m = SourceOp{} } func (m *SourceOp) String() string { return proto.CompactTextString(m) } func (*SourceOp) ProtoMessage() {} -func (*SourceOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{10} } +func (*SourceOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{11} } func (m *SourceOp) GetIdentifier() string { if m != nil { @@ -726,7 +792,7 @@ type BuildOp struct { func (m *BuildOp) Reset() { *m = BuildOp{} } func (m *BuildOp) String() string { return proto.CompactTextString(m) } func (*BuildOp) ProtoMessage() {} -func (*BuildOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{11} } +func (*BuildOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{12} } func (m *BuildOp) GetInputs() map[string]*BuildInput { if m != nil { @@ -757,7 +823,7 @@ type BuildInput struct { func (m *BuildInput) Reset() { *m = BuildInput{} } func (m *BuildInput) String() string { return proto.CompactTextString(m) } func (*BuildInput) ProtoMessage() {} -func (*BuildInput) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{12} } +func (*BuildInput) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{13} } // OpMetadata is a per-vertex metadata entry, which can be defined for arbitrary Op vertex and overridable on the run time. type OpMetadata struct { @@ -774,7 +840,7 @@ type OpMetadata struct { func (m *OpMetadata) Reset() { *m = OpMetadata{} } func (m *OpMetadata) String() string { return proto.CompactTextString(m) } func (*OpMetadata) ProtoMessage() {} -func (*OpMetadata) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{13} } +func (*OpMetadata) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{14} } func (m *OpMetadata) GetIgnoreCache() bool { if m != nil { @@ -811,7 +877,7 @@ type ExportCache struct { func (m *ExportCache) Reset() { *m = ExportCache{} } func (m *ExportCache) String() string { return proto.CompactTextString(m) } func (*ExportCache) ProtoMessage() {} -func (*ExportCache) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{14} } +func (*ExportCache) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{15} } func (m *ExportCache) GetValue() bool { if m != nil { @@ -830,7 +896,7 @@ type ProxyEnv struct { func (m *ProxyEnv) Reset() { *m = ProxyEnv{} } func (m *ProxyEnv) String() string { return proto.CompactTextString(m) } func (*ProxyEnv) ProtoMessage() {} -func (*ProxyEnv) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{15} } +func (*ProxyEnv) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{16} } func (m *ProxyEnv) GetHttpProxy() string { if m != nil { @@ -868,7 +934,7 @@ type WorkerConstraints struct { func (m *WorkerConstraints) Reset() { *m = WorkerConstraints{} } func (m *WorkerConstraints) String() string { return proto.CompactTextString(m) } func (*WorkerConstraints) ProtoMessage() {} -func (*WorkerConstraints) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{16} } +func (*WorkerConstraints) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{17} } func (m *WorkerConstraints) GetFilter() []string { if m != nil { @@ -889,7 +955,7 @@ type Definition struct { func (m *Definition) Reset() { *m = Definition{} } func (m *Definition) String() string { return proto.CompactTextString(m) } func (*Definition) ProtoMessage() {} -func (*Definition) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{17} } +func (*Definition) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{18} } func (m *Definition) GetDef() [][]byte { if m != nil { @@ -913,7 +979,7 @@ type HostIP struct { func (m *HostIP) Reset() { *m = HostIP{} } func (m *HostIP) String() string { return proto.CompactTextString(m) } func (*HostIP) ProtoMessage() {} -func (*HostIP) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{18} } +func (*HostIP) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{19} } func (m *HostIP) GetHost() string { if m != nil { @@ -938,6 +1004,7 @@ func init() { proto.RegisterType((*Mount)(nil), "pb.Mount") proto.RegisterType((*CacheOpt)(nil), "pb.CacheOpt") proto.RegisterType((*SecretOpt)(nil), "pb.SecretOpt") + proto.RegisterType((*SSHOpt)(nil), "pb.SSHOpt") proto.RegisterType((*CopyOp)(nil), "pb.CopyOp") proto.RegisterType((*CopySource)(nil), "pb.CopySource") proto.RegisterType((*SourceOp)(nil), "pb.SourceOp") @@ -1355,6 +1422,18 @@ func (m *Mount) MarshalTo(dAtA []byte) (int, error) { } i += n11 } + if m.SSHOpt != nil { + dAtA[i] = 0xb2 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintOps(dAtA, i, uint64(m.SSHOpt.Size())) + n12, err := m.SSHOpt.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n12 + } return i, nil } @@ -1436,6 +1515,55 @@ func (m *SecretOpt) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *SSHOpt) 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 *SSHOpt) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintOps(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if m.Uid != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintOps(dAtA, i, uint64(m.Uid)) + } + if m.Gid != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintOps(dAtA, i, uint64(m.Gid)) + } + if m.Mode != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintOps(dAtA, i, uint64(m.Mode)) + } + if m.Optional { + dAtA[i] = 0x28 + i++ + if m.Optional { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + func (m *CopyOp) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1523,10 +1651,15 @@ func (m *SourceOp) MarshalTo(dAtA []byte) (int, error) { i += copy(dAtA[i:], m.Identifier) } if len(m.Attrs) > 0 { + keysForAttrs := make([]string, 0, len(m.Attrs)) for k, _ := range m.Attrs { + keysForAttrs = append(keysForAttrs, string(k)) + } + sortkeys.Strings(keysForAttrs) + for _, k := range keysForAttrs { dAtA[i] = 0x12 i++ - v := m.Attrs[k] + v := m.Attrs[string(k)] mapSize := 1 + len(k) + sovOps(uint64(len(k))) + 1 + len(v) + sovOps(uint64(len(v))) i = encodeVarintOps(dAtA, i, uint64(mapSize)) dAtA[i] = 0xa @@ -1563,10 +1696,15 @@ func (m *BuildOp) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintOps(dAtA, i, uint64(m.Builder)) } if len(m.Inputs) > 0 { + keysForInputs := make([]string, 0, len(m.Inputs)) for k, _ := range m.Inputs { + keysForInputs = append(keysForInputs, string(k)) + } + sortkeys.Strings(keysForInputs) + for _, k := range keysForInputs { dAtA[i] = 0x12 i++ - v := m.Inputs[k] + v := m.Inputs[string(k)] msgSize := 0 if v != nil { msgSize = v.Size() @@ -1582,11 +1720,11 @@ func (m *BuildOp) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintOps(dAtA, i, uint64(v.Size())) - n12, err := v.MarshalTo(dAtA[i:]) + n13, err := v.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n12 + i += n13 } } } @@ -1594,17 +1732,22 @@ func (m *BuildOp) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1a i++ i = encodeVarintOps(dAtA, i, uint64(m.Def.Size())) - n13, err := m.Def.MarshalTo(dAtA[i:]) + n14, err := m.Def.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n13 + i += n14 } if len(m.Attrs) > 0 { + keysForAttrs := make([]string, 0, len(m.Attrs)) for k, _ := range m.Attrs { + keysForAttrs = append(keysForAttrs, string(k)) + } + sortkeys.Strings(keysForAttrs) + for _, k := range keysForAttrs { dAtA[i] = 0x22 i++ - v := m.Attrs[k] + v := m.Attrs[string(k)] mapSize := 1 + len(k) + sovOps(uint64(len(k))) + 1 + len(v) + sovOps(uint64(len(v))) i = encodeVarintOps(dAtA, i, uint64(mapSize)) dAtA[i] = 0xa @@ -1669,10 +1812,15 @@ func (m *OpMetadata) MarshalTo(dAtA []byte) (int, error) { i++ } if len(m.Description) > 0 { + keysForDescription := make([]string, 0, len(m.Description)) for k, _ := range m.Description { + keysForDescription = append(keysForDescription, string(k)) + } + sortkeys.Strings(keysForDescription) + for _, k := range keysForDescription { dAtA[i] = 0x12 i++ - v := m.Description[k] + v := m.Description[string(k)] mapSize := 1 + len(k) + sovOps(uint64(len(k))) + 1 + len(v) + sovOps(uint64(len(v))) i = encodeVarintOps(dAtA, i, uint64(mapSize)) dAtA[i] = 0xa @@ -1689,17 +1837,22 @@ func (m *OpMetadata) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x22 i++ i = encodeVarintOps(dAtA, i, uint64(m.ExportCache.Size())) - n14, err := m.ExportCache.MarshalTo(dAtA[i:]) + n15, err := m.ExportCache.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n14 + i += n15 } if len(m.Caps) > 0 { + keysForCaps := make([]string, 0, len(m.Caps)) for k, _ := range m.Caps { + keysForCaps = append(keysForCaps, string(k)) + } + sortkeys.Strings(keysForCaps) + for _, k := range keysForCaps { dAtA[i] = 0x2a i++ - v := m.Caps[k] + v := m.Caps[github_com_moby_buildkit_util_apicaps.CapID(k)] mapSize := 1 + len(k) + sovOps(uint64(len(k))) + 1 + 1 i = encodeVarintOps(dAtA, i, uint64(mapSize)) dAtA[i] = 0xa @@ -1846,10 +1999,15 @@ func (m *Definition) MarshalTo(dAtA []byte) (int, error) { } } if len(m.Metadata) > 0 { + keysForMetadata := make([]string, 0, len(m.Metadata)) for k, _ := range m.Metadata { + keysForMetadata = append(keysForMetadata, string(k)) + } + sortkeys.Strings(keysForMetadata) + for _, k := range keysForMetadata { dAtA[i] = 0x12 i++ - v := m.Metadata[k] + v := m.Metadata[github_com_opencontainers_go_digest.Digest(k)] msgSize := 0 if (&v) != nil { msgSize = (&v).Size() @@ -1864,11 +2022,11 @@ func (m *Definition) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintOps(dAtA, i, uint64((&v).Size())) - n15, err := (&v).MarshalTo(dAtA[i:]) + n16, err := (&v).MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n15 + i += n16 } } return i, nil @@ -2099,6 +2257,10 @@ func (m *Mount) Size() (n int) { l = m.SecretOpt.Size() n += 2 + l + sovOps(uint64(l)) } + if m.SSHOpt != nil { + l = m.SSHOpt.Size() + n += 2 + l + sovOps(uint64(l)) + } return n } @@ -2137,6 +2299,28 @@ func (m *SecretOpt) Size() (n int) { return n } +func (m *SSHOpt) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovOps(uint64(l)) + } + if m.Uid != 0 { + n += 1 + sovOps(uint64(m.Uid)) + } + if m.Gid != 0 { + n += 1 + sovOps(uint64(m.Gid)) + } + if m.Mode != 0 { + n += 1 + sovOps(uint64(m.Mode)) + } + if m.Optional { + n += 2 + } + return n +} + func (m *CopyOp) Size() (n int) { var l int _ = l @@ -3508,6 +3692,39 @@ func (m *Mount) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 22: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SSHOpt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOps + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SSHOpt == nil { + m.SSHOpt = &SSHOpt{} + } + if err := m.SSHOpt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipOps(dAtA[iNdEx:]) @@ -3783,6 +4000,162 @@ func (m *SecretOpt) Unmarshal(dAtA []byte) error { } return nil } +func (m *SSHOpt) 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 ErrIntOverflowOps + } + 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: SSHOpt: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SSHOpt: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + 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 ErrInvalidLengthOps + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Uid", wireType) + } + m.Uid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Uid |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Gid", wireType) + } + m.Gid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Gid |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) + } + m.Mode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Mode |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Optional", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Optional = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipOps(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOps + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *CopyOp) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5663,94 +6036,96 @@ var ( func init() { proto.RegisterFile("ops.proto", fileDescriptorOps) } var fileDescriptorOps = []byte{ - // 1415 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0x8f, 0xd7, 0x9f, 0xfb, 0x9c, 0xa4, 0x66, 0xfa, 0x81, 0x09, 0x25, 0x09, 0x5b, 0x40, 0x69, - 0xd2, 0x38, 0x92, 0x2b, 0xb5, 0x15, 0x87, 0x8a, 0xf8, 0xa3, 0x8a, 0x29, 0x89, 0xa3, 0x71, 0x08, - 0xc7, 0x6a, 0xb3, 0x1e, 0x3b, 0xab, 0x38, 0x3b, 0xab, 0xdd, 0x71, 0x1b, 0x5f, 0x38, 0xf4, 0x2f, - 0x40, 0x42, 0xe2, 0xce, 0x91, 0x0b, 0xff, 0x01, 0xf7, 0x1e, 0xb9, 0xc2, 0xa1, 0xa0, 0xf2, 0x8f, - 0xa0, 0xf7, 0x66, 0xd6, 0xbb, 0xfd, 0x40, 0xb4, 0x82, 0x93, 0xdf, 0xbc, 0xf7, 0x9b, 0xdf, 0xcc, - 0xfc, 0xde, 0x9b, 0x79, 0x6b, 0xb0, 0x65, 0x18, 0x37, 0xc2, 0x48, 0x2a, 0xc9, 0xac, 0xf0, 0x64, - 0x65, 0x7b, 0xec, 0xab, 0xd3, 0xe9, 0x49, 0xc3, 0x93, 0xe7, 0x3b, 0x63, 0x39, 0x96, 0x3b, 0x14, - 0x3a, 0x99, 0x8e, 0x68, 0x44, 0x03, 0xb2, 0xf4, 0x14, 0xe7, 0x47, 0x0b, 0xac, 0x7e, 0xc8, 0x3e, - 0x86, 0x92, 0x1f, 0x84, 0x53, 0x15, 0xd7, 0x73, 0xe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x2d, 0x6f, 0x6a, 0x5a, - 0x65, 0xd9, 0x94, 0xdd, 0x82, 0x92, 0x6e, 0xee, 0xf8, 0x6e, 0xa3, 0x65, 0x68, 0xc8, 0xa6, 0xde, - 0x72, 0x98, 0x7c, 0xea, 0xf5, 0x0e, 0x37, 0x37, 0xa0, 0x6c, 0x3e, 0x5a, 0x98, 0x0d, 0xc5, 0xaf, - 0x0f, 0x06, 0xdd, 0xa3, 0xda, 0x02, 0xab, 0x40, 0x61, 0xaf, 0x3f, 0x38, 0xaa, 0xe5, 0xd0, 0x3a, - 0xe8, 0x1f, 0x74, 0x6b, 0xd6, 0xe6, 0x17, 0x60, 0xcf, 0x9b, 0x2b, 0xba, 0x5b, 0xbd, 0x83, 0x4e, - 0x6d, 0x81, 0x01, 0x94, 0x06, 0xdd, 0x36, 0xef, 0x22, 0xb8, 0x0c, 0xf9, 0xc1, 0x60, 0xaf, 0x66, - 0x21, 0x55, 0x7b, 0xb7, 0xbd, 0xd7, 0xad, 0xe5, 0xd1, 0x3c, 0xda, 0x3f, 0x7c, 0x30, 0xa8, 0x15, - 0x36, 0xef, 0xc0, 0xa5, 0x57, 0x1a, 0x20, 0xcd, 0xde, 0xdb, 0xe5, 0x5d, 0x64, 0xaa, 0x42, 0xf9, - 0x90, 0xf7, 0x8e, 0x77, 0x8f, 0xba, 0xb5, 0x1c, 0x06, 0xbe, 0xea, 0xb7, 0x1f, 0x76, 0x3b, 0x35, - 0xab, 0x55, 0x7b, 0xf6, 0x62, 0x35, 0xf7, 0xeb, 0x8b, 0xd5, 0xdc, 0x9f, 0x2f, 0x56, 0x73, 0xdf, - 0xfd, 0xb5, 0xba, 0x70, 0x52, 0xa2, 0x3f, 0x03, 0xb7, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x8c, - 0x1e, 0x1e, 0x98, 0x4c, 0x0c, 0x00, 0x00, + // 1444 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00,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xc2, 0x3e, + 0x80, 0x52, 0x2c, 0xa7, 0x91, 0x27, 0xea, 0x79, 0xc2, 0x2c, 0x22, 0x66, 0x40, 0x1a, 0x42, 0x19, + 0x2b, 0x32, 0x79, 0x32, 0x9c, 0xd5, 0x0b, 0x29, 0x53, 0x5b, 0x86, 0x33, 0xcd, 0x84, 0x16, 0x76, + 0x0b, 0x8a, 0x27, 0x53, 0x7f, 0x32, 0xac, 0x17, 0x09, 0x52, 0x45, 0x48, 0x0b, 0x15, 0x84, 0xd1, + 0x36, 0xb6, 0x01, 0x95, 0x70, 0xe2, 0xaa, 0x91, 0x8c, 0xce, 0xeb, 0x90, 0x1e, 0x78, 0x68, 0x74, + 0x7c, 0x6e, 0x65, 0xf7, 0xa1, 0xea, 0xc9, 0x20, 0x56, 0x91, 0xeb, 0x07, 0x2a, 0xae, 0x57, 0x09, + 0x7c, 0x1d, 0xc1, 0x9f, 0xc9, 0xe8, 0x4c, 0x44, 0xed, 0xd4, 0xc8, 0xb3, 0xc8, 0x56, 0x01, 0x2c, + 0x19, 0x3a, 0x5f, 0xe5, 0xa0, 0x92, 0xb0, 0x32, 0x07, 0x16, 0x77, 0x23, 0xef, 0xd4, 0x57, 0xc2, + 0x53, 0xd3, 0x48, 0xd4, 0x73, 0xeb, 0xb9, 0x0d, 0x9b, 0xbf, 0xa2, 0x63, 0xcb, 0x60, 0xf5, 0x07, + 0x94, 0x28, 0x9b, 0x5b, 0xfd, 0x01, 0xab, 0x43, 0xf9, 0xd8, 0x8d, 0x7c, 0x37, 0x50, 0x94, 0x19, + 0x9b, 0x27, 0x4b, 0x76, 0x13, 0xec, 0xfe, 0xe0, 0x58, 0x44, 0xb1, 0x2f, 0x03, 0xca, 0x87, 0xcd, + 0x53, 0x05, 0x5b, 0x05, 0xe8, 0x0f, 0x1e, 0x09, 0x17, 0x49, 0xe3, 0x7a, 0x71, 0x3d, 0xbf, 0x61, + 0xf3, 0x8c, 0xc6, 0xf9, 0x1c, 0x8a, 0x54, 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 0x43, 0x32, 0xcd, 0x96, 0xc3, 0xe4, 0xe3, 0xb3, 0x77, 0xb8, 0xb9, + 0x01, 0x65, 0xf3, 0x19, 0xc5, 0x6c, 0x28, 0x7e, 0x7a, 0x30, 0xe8, 0x1e, 0xd5, 0x16, 0x58, 0x05, + 0x0a, 0x7b, 0xfd, 0xc1, 0x51, 0x2d, 0x87, 0xd2, 0x41, 0xff, 0xa0, 0x5b, 0xb3, 0x36, 0x3f, 0x02, + 0x7b, 0x3e, 0xee, 0x51, 0xdd, 0xea, 0x1d, 0x74, 0x6a, 0x0b, 0x0c, 0xa0, 0x34, 0xe8, 0xb6, 0x79, + 0x17, 0xc1, 0x65, 0xc8, 0x0f, 0x06, 0x7b, 0x35, 0x0b, 0xa9, 0xda, 0xbb, 0xed, 0xbd, 0x6e, 0x2d, + 0x8f, 0xe2, 0xd1, 0xfe, 0xe1, 0xa3, 0x41, 0xad, 0xb0, 0x79, 0x0f, 0xae, 0xbc, 0x36, 0x6e, 0x69, + 0xf7, 0xde, 0x2e, 0xef, 0x22, 0x53, 0x15, 0xca, 0x87, 0xbc, 0x77, 0xbc, 0x7b, 0xd4, 0xad, 0xe5, + 0xd0, 0xf0, 0x49, 0xbf, 0xfd, 0xb8, 0xdb, 0xa9, 0x59, 0xad, 0x6b, 0x2f, 0x2e, 0x57, 0x73, 0xdf, + 0x5d, 0xae, 0xe6, 0x7e, 0xb8, 0x5c, 0xcd, 0xfd, 0x72, 0xb9, 0x9a, 0xfb, 0xe2, 0xd7, 0xd5, 0x85, + 0x93, 0x12, 0xfd, 0x45, 0xb9, 0xfb, 0x5b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x84, 0xfe, 0x08, 0x0c, + 0xe2, 0x0c, 0x00, 0x00, } diff --git a/vendor/github.com/moby/buildkit/solver/pb/ops.proto b/vendor/github.com/moby/buildkit/solver/pb/ops.proto index 17b5506add..09442f60c4 100644 --- a/vendor/github.com/moby/buildkit/solver/pb/ops.proto +++ b/vendor/github.com/moby/buildkit/solver/pb/ops.proto @@ -6,6 +6,8 @@ package pb; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +option (gogoproto.stable_marshaler_all) = true; + // Op represents a vertex of the LLB DAG. message Op { // inputs is a set of input edges. @@ -72,6 +74,7 @@ message Mount { MountType mountType = 6; CacheOpt cacheOpt = 20; SecretOpt secretOpt = 21; + SSHOpt SSHOpt = 22; } // MountType defines a type of a mount from a supported set @@ -116,6 +119,21 @@ message SecretOpt { bool optional = 5; } +// SSHOpt defines options describing secret mounts +message SSHOpt { + // ID of exposed ssh rule. Used for quering the value. + string ID = 1; + // UID of agent socket + uint32 uid = 2; + // GID of agent socket + uint32 gid = 3; + // Mode is the filesystem mode of agent socket + uint32 mode = 4; + // Optional defines if ssh socket is required. Error is produced + // if client does not expose ssh. + bool optional = 5; +} + // CopyOp copies files across Ops. message CopyOp { repeated CopySource src = 1; diff --git a/vendor/github.com/moby/buildkit/solver/scheduler.go b/vendor/github.com/moby/buildkit/solver/scheduler.go index d9ed9c5873..7fe981eff4 100644 --- a/vendor/github.com/moby/buildkit/solver/scheduler.go +++ b/vendor/github.com/moby/buildkit/solver/scheduler.go @@ -371,7 +371,7 @@ func debugSchedulerPreUnpark(e *edge, inc []pipe.Sender, updates, allPipes []pip if dep.req != nil { des = dep.req.Request().(*edgeRequest).desiredState } - logrus.Debugf(":: dep%d %s state=%s des=%s keys=%s hasslowcache=%v", i, e.edge.Vertex.Inputs()[i].Vertex.Name(), dep.state, des, len(dep.keys), e.slowCacheFunc(dep) != nil) + logrus.Debugf(":: dep%d %s state=%s des=%s keys=%d hasslowcache=%v", i, e.edge.Vertex.Inputs()[i].Vertex.Name(), dep.state, des, len(dep.keys), e.slowCacheFunc(dep) != nil) } for i, in := range inc { diff --git a/vendor/github.com/moby/buildkit/source/git/gitsource.go b/vendor/github.com/moby/buildkit/source/git/gitsource.go index c0afc3b804..47d304b792 100644 --- a/vendor/github.com/moby/buildkit/source/git/gitsource.go +++ b/vendor/github.com/moby/buildkit/source/git/gitsource.go @@ -11,7 +11,6 @@ import ( "regexp" "strings" - "github.com/boltdb/bolt" "github.com/docker/docker/pkg/locker" "github.com/moby/buildkit/cache" "github.com/moby/buildkit/cache/metadata" @@ -22,6 +21,7 @@ import ( "github.com/moby/buildkit/util/progress/logs" "github.com/pkg/errors" "github.com/sirupsen/logrus" + bolt "go.etcd.io/bbolt" ) var validHex = regexp.MustCompile(`^[a-f0-9]{40}$`) diff --git a/vendor/github.com/moby/buildkit/source/http/httpsource.go b/vendor/github.com/moby/buildkit/source/http/httpsource.go index 58c7040098..39939128cd 100644 --- a/vendor/github.com/moby/buildkit/source/http/httpsource.go +++ b/vendor/github.com/moby/buildkit/source/http/httpsource.go @@ -15,7 +15,6 @@ import ( "strings" "time" - "github.com/boltdb/bolt" "github.com/docker/docker/pkg/locker" "github.com/moby/buildkit/cache" "github.com/moby/buildkit/cache/metadata" @@ -24,6 +23,7 @@ import ( "github.com/moby/buildkit/util/tracing" digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" + bolt "go.etcd.io/bbolt" ) type Opt struct { diff --git a/vendor/github.com/moby/buildkit/source/local/local.go b/vendor/github.com/moby/buildkit/source/local/local.go index b2deb5c15b..8ffe0c09ed 100644 --- a/vendor/github.com/moby/buildkit/source/local/local.go +++ b/vendor/github.com/moby/buildkit/source/local/local.go @@ -6,7 +6,6 @@ import ( "fmt" "time" - "github.com/boltdb/bolt" "github.com/moby/buildkit/cache" "github.com/moby/buildkit/cache/contenthash" "github.com/moby/buildkit/cache/metadata" @@ -20,6 +19,7 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/tonistiigi/fsutil" + bolt "go.etcd.io/bbolt" "golang.org/x/time/rate" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/vendor/github.com/moby/buildkit/util/contentutil/copy.go b/vendor/github.com/moby/buildkit/util/contentutil/copy.go index a03f16e65e..04d46c4f36 100644 --- a/vendor/github.com/moby/buildkit/util/contentutil/copy.go +++ b/vendor/github.com/moby/buildkit/util/contentutil/copy.go @@ -3,10 +3,13 @@ package contentutil import ( "context" "io" + "sync" "github.com/containerd/containerd/content" + "github.com/containerd/containerd/images" "github.com/containerd/containerd/remotes" ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" ) func Copy(ctx context.Context, ingester content.Ingester, provider content.Provider, desc ocispec.Descriptor) error { @@ -41,3 +44,38 @@ func (r *rc) Read(b []byte) (int, error) { } return n, err } + +func CopyChain(ctx context.Context, ingester content.Ingester, provider content.Provider, desc ocispec.Descriptor) error { + var m sync.Mutex + manifestStack := []ocispec.Descriptor{} + + filterHandler := images.HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + switch desc.MediaType { + case images.MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest, + images.MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex: + m.Lock() + manifestStack = append(manifestStack, desc) + m.Unlock() + return nil, images.ErrStopHandler + default: + return nil, nil + } + }) + handlers := []images.Handler{ + images.ChildrenHandler(provider), + filterHandler, + remotes.FetchHandler(ingester, &localFetcher{provider}), + } + + if err := images.Dispatch(ctx, images.Handlers(handlers...), desc); err != nil { + return errors.WithStack(err) + } + + for i := len(manifestStack) - 1; i >= 0; i-- { + if err := Copy(ctx, ingester, provider, manifestStack[i]); err != nil { + return errors.WithStack(err) + } + } + + return nil +} diff --git a/vendor/github.com/moby/buildkit/util/contentutil/fetcher.go b/vendor/github.com/moby/buildkit/util/contentutil/fetcher.go index 0c87e64760..d55c101219 100644 --- a/vendor/github.com/moby/buildkit/util/contentutil/fetcher.go +++ b/vendor/github.com/moby/buildkit/util/contentutil/fetcher.go @@ -55,6 +55,9 @@ func (r *readerAt) ReadAt(b []byte, off int64) (int, error) { var totalN int for len(b) > 0 { n, err := r.Reader.Read(b) + if err == io.EOF && n == len(b) { + err = nil + } r.offset += int64(n) totalN += n b = b[n:] diff --git a/vendor/github.com/moby/buildkit/util/contentutil/multiprovider.go b/vendor/github.com/moby/buildkit/util/contentutil/multiprovider.go index fd635ad456..3dafed7dc2 100644 --- a/vendor/github.com/moby/buildkit/util/contentutil/multiprovider.go +++ b/vendor/github.com/moby/buildkit/util/contentutil/multiprovider.go @@ -11,6 +11,7 @@ import ( "github.com/pkg/errors" ) +// NewMultiProvider creates a new mutable provider with a base provider func NewMultiProvider(base content.Provider) *MultiProvider { return &MultiProvider{ base: base, @@ -18,12 +19,14 @@ func NewMultiProvider(base content.Provider) *MultiProvider { } } +// MultiProvider is a provider backed by a mutable map of providers type MultiProvider struct { mu sync.RWMutex base content.Provider sub map[digest.Digest]content.Provider } +// ReaderAt returns a content.ReaderAt func (mp *MultiProvider) ReaderAt(ctx context.Context, desc ocispec.Descriptor) (content.ReaderAt, error) { mp.mu.RLock() if p, ok := mp.sub[desc.Digest]; ok { @@ -37,6 +40,7 @@ func (mp *MultiProvider) ReaderAt(ctx context.Context, desc ocispec.Descriptor) return mp.base.ReaderAt(ctx, desc) } +// Add adds a new child provider for a specific digest func (mp *MultiProvider) Add(dgst digest.Digest, p content.Provider) { mp.mu.Lock() defer mp.mu.Unlock() diff --git a/vendor/github.com/moby/buildkit/util/contentutil/refs.go b/vendor/github.com/moby/buildkit/util/contentutil/refs.go new file mode 100644 index 0000000000..b3a10d1505 --- /dev/null +++ b/vendor/github.com/moby/buildkit/util/contentutil/refs.go @@ -0,0 +1,57 @@ +package contentutil + +import ( + "context" + "net/http" + + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/remotes" + "github.com/containerd/containerd/remotes/docker" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +func ProviderFromRef(ref string) (ocispec.Descriptor, content.Provider, error) { + remote := docker.NewResolver(docker.ResolverOptions{ + Client: http.DefaultClient, + }) + + name, desc, err := remote.Resolve(context.TODO(), ref) + if err != nil { + return ocispec.Descriptor{}, nil, err + } + + fetcher, err := remote.Fetcher(context.TODO(), name) + if err != nil { + return ocispec.Descriptor{}, nil, err + } + return desc, FromFetcher(fetcher), nil +} + +func IngesterFromRef(ref string) (content.Ingester, error) { + remote := docker.NewResolver(docker.ResolverOptions{ + Client: http.DefaultClient, + }) + + pusher, err := remote.Pusher(context.TODO(), ref) + if err != nil { + return nil, err + } + + return &ingester{ + pusher: pusher, + }, nil +} + +type ingester struct { + pusher remotes.Pusher +} + +func (w *ingester) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error) { + var wo content.WriterOpts + for _, o := range opts { + if err := o(&wo); err != nil { + return nil, err + } + } + return w.pusher.Push(ctx, wo.Desc) +} diff --git a/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go b/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go index e51824a4f3..d79231173f 100644 --- a/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go +++ b/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go @@ -21,11 +21,13 @@ type contextKeyT string var contextKey = contextKeyT("buildkit/util/flightcontrol.progress") +// Group is a flightcontrol syncronization group type Group struct { mu sync.Mutex // protects m m map[string]*call // lazily initialized } +// 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 { @@ -312,13 +314,3 @@ func (ps *progressState) close(pw progress.Writer) { } ps.mu.Unlock() } - -func WriteProgress(ctx context.Context, pw progress.Writer) error { - v := ctx.Value(contextKey) - p, ok := v.(*progressState) - if !ok { - return errors.Errorf("invalid context not from flightcontrol") - } - p.add(pw) - return nil -} diff --git a/vendor/github.com/moby/buildkit/util/imageutil/config.go b/vendor/github.com/moby/buildkit/util/imageutil/config.go index 27ff4f4244..a9890e730e 100644 --- a/vendor/github.com/moby/buildkit/util/imageutil/config.go +++ b/vendor/github.com/moby/buildkit/util/imageutil/config.go @@ -14,12 +14,12 @@ import ( "github.com/pkg/errors" ) -type IngesterProvider interface { +type ContentCache interface { content.Ingester content.Provider } -func Config(ctx context.Context, str string, resolver remotes.Resolver, ingester IngesterProvider, p *specs.Platform) (digest.Digest, []byte, error) { +func Config(ctx context.Context, str string, resolver remotes.Resolver, cache ContentCache, p *specs.Platform) (digest.Digest, []byte, error) { // TODO: fix buildkit to take interface instead of struct var platform platforms.MatchComparer if p != nil { @@ -36,7 +36,7 @@ func Config(ctx context.Context, str string, resolver remotes.Resolver, ingester Digest: ref.Digest(), } if desc.Digest != "" { - ra, err := ingester.ReaderAt(ctx, desc) + ra, err := cache.ReaderAt(ctx, desc) if err == nil { desc.Size = ra.Size() mt, err := DetectManifestMediaType(ra) @@ -58,19 +58,23 @@ func Config(ctx context.Context, str string, resolver remotes.Resolver, ingester return "", nil, err } + if desc.MediaType == images.MediaTypeDockerSchema1Manifest { + return readSchema1Config(ctx, ref.String(), desc, fetcher, cache) + } + handlers := []images.Handler{ - remotes.FetchHandler(ingester, fetcher), - childrenConfigHandler(ingester, platform), + remotes.FetchHandler(cache, fetcher), + childrenConfigHandler(cache, platform), } if err := images.Dispatch(ctx, images.Handlers(handlers...), desc); err != nil { return "", nil, err } - config, err := images.Config(ctx, ingester, desc, platform) + config, err := images.Config(ctx, cache, desc, platform) if err != nil { return "", nil, err } - dt, err := content.ReadBlob(ctx, ingester, config) + dt, err := content.ReadBlob(ctx, cache, config) if err != nil { return "", nil, err } diff --git a/vendor/github.com/moby/buildkit/util/imageutil/schema1.go b/vendor/github.com/moby/buildkit/util/imageutil/schema1.go new file mode 100644 index 0000000000..591676fffd --- /dev/null +++ b/vendor/github.com/moby/buildkit/util/imageutil/schema1.go @@ -0,0 +1,87 @@ +package imageutil + +import ( + "context" + "encoding/json" + "io/ioutil" + "strings" + "time" + + "github.com/containerd/containerd/remotes" + digest "github.com/opencontainers/go-digest" + specs "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +func readSchema1Config(ctx context.Context, ref string, desc specs.Descriptor, fetcher remotes.Fetcher, cache ContentCache) (digest.Digest, []byte, error) { + rc, err := fetcher.Fetch(ctx, desc) + if err != nil { + return "", nil, err + } + defer rc.Close() + dt, err := ioutil.ReadAll(rc) + if err != nil { + return "", nil, errors.Wrap(err, "failed to fetch schema1 manifest") + } + dt, err = convertSchema1ConfigMeta(dt) + if err != nil { + return "", nil, err + } + return desc.Digest, dt, nil +} + +func convertSchema1ConfigMeta(in []byte) ([]byte, error) { + type history struct { + V1Compatibility string `json:"v1Compatibility"` + } + var m struct { + History []history `json:"history"` + } + if err := json.Unmarshal(in, &m); err != nil { + return nil, errors.Wrap(err, "failed to unmarshal schema1 manifest") + } + if len(m.History) == 0 { + return nil, errors.Errorf("invalid schema1 manifest") + } + + var img specs.Image + if err := json.Unmarshal([]byte(m.History[0].V1Compatibility), &img); err != nil { + return nil, errors.Wrap(err, "failed to unmarshal image from schema 1 history") + } + + img.RootFS = specs.RootFS{ + Type: "layers", // filled in by exporter + } + img.History = make([]specs.History, len(m.History)) + + for i := range m.History { + var h v1History + if err := json.Unmarshal([]byte(m.History[i].V1Compatibility), &h); err != nil { + return nil, errors.Wrap(err, "failed to unmarshal history") + } + img.History[len(m.History)-i-1] = specs.History{ + Author: h.Author, + Comment: h.Comment, + Created: &h.Created, + CreatedBy: strings.Join(h.ContainerConfig.Cmd, " "), + EmptyLayer: (h.ThrowAway != nil && *h.ThrowAway) || (h.Size != nil && *h.Size == 0), + } + } + + dt, err := json.MarshalIndent(img, "", " ") + if err != nil { + return nil, errors.Wrap(err, "failed to marshal schema1 config") + } + return dt, nil +} + +type v1History struct { + Author string `json:"author,omitempty"` + Created time.Time `json:"created"` + Comment string `json:"comment,omitempty"` + ThrowAway *bool `json:"throwaway,omitempty"` + Size *int `json:"Size,omitempty"` // used before ThrowAway field + ContainerConfig struct { + Cmd []string `json:"Cmd,omitempty"` + } `json:"container_config,omitempty"` +} diff --git a/vendor/github.com/moby/buildkit/vendor.conf b/vendor/github.com/moby/buildkit/vendor.conf index c4c0b0a2b8..00f8c83244 100644 --- a/vendor/github.com/moby/buildkit/vendor.conf +++ b/vendor/github.com/moby/buildkit/vendor.conf @@ -1,12 +1,12 @@ -github.com/boltdb/bolt e9cf4fae01b5a8ff89d0ec6b32f0d9c9f79aefdd github.com/pkg/errors v0.8.0 +go.etcd.io/bbolt v1.3.1-etcd.8 github.com/stretchr/testify v1.1.4 github.com/davecgh/go-spew v1.1.0 github.com/pmezard/go-difflib v1.0.0 golang.org/x/sys 1b2967e3c290b7c545b3db0deeda16e9be4f98a2 -github.com/containerd/containerd v1.2.0-beta.2 +github.com/containerd/containerd d97a907f7f781c0ab8340877d8e6b53cc7f1c2f6 github.com/containerd/typeurl a93fcdb778cd272c6e9b3028b2f42d813e785d40 golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c github.com/sirupsen/logrus v1.0.0 @@ -16,19 +16,20 @@ golang.org/x/net 0ed95abb35c445290478a5348a7b38bb154135fd github.com/gogo/protobuf v1.0.0 github.com/gogo/googleapis b23578765ee54ff6bceff57f397d833bf4ca6869 github.com/golang/protobuf v1.1.0 -github.com/containerd/continuity d3c23511c1bf5851696cba83143d9cbcd666869b +github.com/containerd/continuity f44b615e492bdfb371aae2f76ec694d9da1db537 github.com/opencontainers/image-spec v1.0.1 github.com/opencontainers/runc 20aff4f0488c6d4b8df4d85b4f63f1f704c11abd -github.com/Microsoft/go-winio v0.4.10 +github.com/Microsoft/go-winio v0.4.11 github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c -github.com/opencontainers/runtime-spec d810dbc60d8c5aeeb3d054bd1132fab2121968ce # v1.0.1-43-gd810dbc -github.com/containerd/go-runc acb7c88cac264acca9b5eae187a117f4d77a1292 +github.com/opencontainers/runtime-spec eba862dc2470385a233c7507392675cbeadf7353 # v1.0.1-45-geba862d +github.com/containerd/go-runc 5a6d9f37cfa36b15efba46dc7ea349fa9b7143c3 github.com/containerd/console c12b1e7919c14469339a5d38f2f8ed9b64a9de23 google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944 golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4 github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9 github.com/syndtr/gocapability db04d3cc01c8b54962a58ec7e491717d06cfcc16 -github.com/Microsoft/hcsshim 44c060121b68e8bdc40b411beba551f3b4ee9e55 +github.com/Microsoft/hcsshim v0.7.3 +golang.org/x/crypto 0709b304e793a5edb4a2c0145f281ecdc20838a4 github.com/urfave/cli 7bc6a0acffa589f415f88aca16cc1de5ffd66f9c github.com/morikuni/aec 39771216ff4c63d11f5e604076f9c45e8be1067b @@ -49,8 +50,9 @@ github.com/docker/distribution 30578ca32960a4d368bf6db67b0a33c2a1f3dc6f github.com/tonistiigi/units 6950e57a87eaf136bbe44ef2ec8e75b9e3569de2 github.com/docker/cli 99576756eb3303b7af8102c502f21a912e3c1af6 https://github.com/tonistiigi/docker-cli.git github.com/docker/docker-credential-helpers d68f9aeca33f5fd3f08eeae5e9d175edf4e731d1 -github.com/docker/libnetwork 822e5b59d346b7ad0735df2c8e445e9787320e67 +github.com/docker/libnetwork 36d3bed0e9f4b3c8c66df9bd45278bb90b33e911 github.com/BurntSushi/toml 3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 +github.com/ishidawataru/sctp 07191f837fedd2f13d1ec7b5f885f0f3ec54b1cb github.com/grpc-ecosystem/grpc-opentracing 8e809c8a86450a29b90dcc9efbf062d0fe6d9746 github.com/opentracing/opentracing-go 1361b9cd60be79c4c3a7fa9841b3c132e40066a7 diff --git a/vendor/github.com/moby/buildkit/worker/cacheresult.go b/vendor/github.com/moby/buildkit/worker/cacheresult.go index f70be6f476..fb11525d77 100644 --- a/vendor/github.com/moby/buildkit/worker/cacheresult.go +++ b/vendor/github.com/moby/buildkit/worker/cacheresult.go @@ -36,7 +36,7 @@ func (s *cacheResultStorage) Save(res solver.Result) (solver.CacheResult, error) return solver.CacheResult{ID: ref.ID(), CreatedAt: time.Now()}, nil } func (s *cacheResultStorage) Load(ctx context.Context, res solver.CacheResult) (solver.Result, error) { - return s.load(res.ID) + return s.load(res.ID, false) } func (s *cacheResultStorage) getWorkerRef(id string) (Worker, string, error) { @@ -51,7 +51,7 @@ func (s *cacheResultStorage) getWorkerRef(id string) (Worker, string, error) { return w, refID, nil } -func (s *cacheResultStorage) load(id string) (solver.Result, error) { +func (s *cacheResultStorage) load(id string, hidden bool) (solver.Result, error) { w, refID, err := s.getWorkerRef(id) if err != nil { return nil, err @@ -59,7 +59,7 @@ func (s *cacheResultStorage) load(id string) (solver.Result, error) { if refID == "" { return NewWorkerRefResult(nil, w), nil } - ref, err := w.LoadRef(refID) + ref, err := w.LoadRef(refID, hidden) if err != nil { return nil, err } @@ -71,7 +71,7 @@ func (s *cacheResultStorage) LoadRemote(ctx context.Context, res solver.CacheRes if err != nil { return nil, err } - ref, err := w.LoadRef(refID) + ref, err := w.LoadRef(refID, true) if err != nil { return nil, err } @@ -83,7 +83,7 @@ func (s *cacheResultStorage) LoadRemote(ctx context.Context, res solver.CacheRes return remote, nil } func (s *cacheResultStorage) Exists(id string) bool { - ref, err := s.load(id) + ref, err := s.load(id, true) if err != nil { return false } diff --git a/vendor/github.com/moby/buildkit/worker/worker.go b/vendor/github.com/moby/buildkit/worker/worker.go index 97abfbfbb2..47a5d4bf74 100644 --- a/vendor/github.com/moby/buildkit/worker/worker.go +++ b/vendor/github.com/moby/buildkit/worker/worker.go @@ -21,7 +21,7 @@ type Worker interface { Labels() map[string]string Platforms() []specs.Platform GCPolicy() []client.PruneInfo - LoadRef(id string) (cache.ImmutableRef, error) + LoadRef(id string, hidden bool) (cache.ImmutableRef, error) // ResolveOp resolves Vertex.Sys() to Op implementation. ResolveOp(v solver.Vertex, s frontend.FrontendLLBBridge) (solver.Op, error) ResolveImageConfig(ctx context.Context, ref string, opt gw.ResolveImageConfigOpt) (digest.Digest, []byte, error)