mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 13:37:08 +08:00
hack: generate vtproto files for buildx
Integrates vtproto into buildx. The generated files dockerfile has been modified to copy the buildkit equivalent file to ensure files are laid out in the appropriate way for imports. An import has also been included to change the grpc codec to the version in buildkit that supports vtproto. This will allow buildx to utilize the speed and memory improvements from that. Also updates the gc control options for prune. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
3
vendor/github.com/moby/buildkit/client/llb/exec.go
generated
vendored
3
vendor/github.com/moby/buildkit/client/llb/exec.go
generated
vendored
@ -12,7 +12,6 @@ import (
|
||||
"github.com/moby/buildkit/util/system"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func NewExecOp(base State, proxyEnv *ProxyEnv, readOnly bool, c Constraints) *ExecOp {
|
||||
@ -344,7 +343,7 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
newInput := true
|
||||
|
||||
for i, inp2 := range pop.Inputs {
|
||||
if proto.Equal(inp, inp2) {
|
||||
if inp.EqualVT(inp2) {
|
||||
inputIndex = pb.InputIndex(i)
|
||||
newInput = false
|
||||
break
|
||||
|
23
vendor/github.com/moby/buildkit/client/llb/fileop.go
generated
vendored
23
vendor/github.com/moby/buildkit/client/llb/fileop.go
generated
vendored
@ -12,7 +12,6 @@ import (
|
||||
"github.com/moby/buildkit/solver/pb"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// Examples:
|
||||
@ -264,6 +263,15 @@ func WithUIDGID(uid, gid int) ChownOption {
|
||||
}
|
||||
}
|
||||
|
||||
type ChmodOpt struct {
|
||||
Mode os.FileMode
|
||||
ModeStr string
|
||||
}
|
||||
|
||||
func (co ChmodOpt) SetCopyOption(mi *CopyInfo) {
|
||||
mi.Mode = &co
|
||||
}
|
||||
|
||||
type ChownOpt struct {
|
||||
User *UserOpt
|
||||
Group *UserOpt
|
||||
@ -492,7 +500,7 @@ type CopyOption interface {
|
||||
}
|
||||
|
||||
type CopyInfo struct {
|
||||
Mode *os.FileMode
|
||||
Mode *ChmodOpt
|
||||
FollowSymlinks bool
|
||||
CopyDirContentsOnly bool
|
||||
IncludePatterns []string
|
||||
@ -541,7 +549,11 @@ func (a *fileActionCopy) toProtoAction(ctx context.Context, parent string, base
|
||||
AlwaysReplaceExistingDestPaths: a.info.AlwaysReplaceExistingDestPaths,
|
||||
}
|
||||
if a.info.Mode != nil {
|
||||
c.Mode = int32(*a.info.Mode)
|
||||
if a.info.Mode.ModeStr != "" {
|
||||
c.ModeStr = a.info.Mode.ModeStr
|
||||
} else {
|
||||
c.Mode = int32(a.info.Mode.Mode)
|
||||
}
|
||||
} else {
|
||||
c.Mode = -1
|
||||
}
|
||||
@ -574,6 +586,9 @@ func (a *fileActionCopy) addCaps(f *FileOp) {
|
||||
if a.info.AlwaysReplaceExistingDestPaths {
|
||||
addCap(&f.constraints, pb.CapFileCopyAlwaysReplaceExistingDestPaths)
|
||||
}
|
||||
if a.info.Mode.ModeStr != "" {
|
||||
addCap(&f.constraints, pb.CapFileCopyModeStringFormat)
|
||||
}
|
||||
}
|
||||
|
||||
type CreatedTime time.Time
|
||||
@ -652,7 +667,7 @@ func (ms *marshalState) addInput(c *Constraints, o Output) (pb.InputIndex, error
|
||||
return 0, err
|
||||
}
|
||||
for i, inp2 := range ms.inputs {
|
||||
if proto.Equal(inp, inp2) {
|
||||
if inp.EqualVT(inp2) {
|
||||
return pb.InputIndex(i), nil
|
||||
}
|
||||
}
|
||||
|
4
vendor/github.com/moby/buildkit/client/llb/marshal.go
generated
vendored
4
vendor/github.com/moby/buildkit/client/llb/marshal.go
generated
vendored
@ -49,7 +49,7 @@ func (def *Definition) Head() (digest.Digest, error) {
|
||||
last := def.Def[len(def.Def)-1]
|
||||
|
||||
var pop pb.Op
|
||||
if err := proto.Unmarshal(last, &pop); err != nil {
|
||||
if err := pop.UnmarshalVT(last); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if len(pop.Inputs) == 0 {
|
||||
@ -74,7 +74,7 @@ func ReadFrom(r io.Reader) (*Definition, error) {
|
||||
return nil, err
|
||||
}
|
||||
var pbDef pb.Definition
|
||||
if err := proto.Unmarshal(b, &pbDef); err != nil {
|
||||
if err := pbDef.UnmarshalVT(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var def Definition
|
||||
|
3
vendor/github.com/moby/buildkit/client/llb/state.go
generated
vendored
3
vendor/github.com/moby/buildkit/client/llb/state.go
generated
vendored
@ -14,7 +14,6 @@ import (
|
||||
"github.com/moby/buildkit/util/apicaps"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
protobuf "google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type StateOption func(State) State
|
||||
@ -158,7 +157,7 @@ func (s State) Marshal(ctx context.Context, co ...ConstraintsOpt) (*Definition,
|
||||
return def, err
|
||||
}
|
||||
proto := &pb.Op{Inputs: []*pb.Input{inp}}
|
||||
dt, err := protobuf.Marshal(proto)
|
||||
dt, err := proto.MarshalVT()
|
||||
if err != nil {
|
||||
return def, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user