mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
protobuf: remove gogoproto
Removes gogo/protobuf from buildx and updates to a version of moby/buildkit where gogo is removed. This also changes how the proto files are generated. This is because newer versions of protobuf are more strict about name conflicts. If two files have the same name (even if they are relative paths) and are used in different protoc commands, they'll conflict in the registry. Since protobuf file generation doesn't work very well with `paths=source_relative`, this removes the `go:generate` expression and just relies on the dockerfile to perform the generation. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
42
vendor/github.com/moby/buildkit/client/llb/exec.go
generated
vendored
42
vendor/github.com/moby/buildkit/client/llb/exec.go
generated
vendored
@ -12,6 +12,7 @@ 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 {
|
||||
@ -128,9 +129,10 @@ func (e *ExecOp) Validate(ctx context.Context, c *Constraints) error {
|
||||
}
|
||||
|
||||
func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []byte, *pb.OpMetadata, []*SourceLocation, error) {
|
||||
if e.Cached(c) {
|
||||
return e.Load()
|
||||
if dgst, dt, md, srcs, err := e.Load(c); err == nil {
|
||||
return dgst, dt, md, srcs, nil
|
||||
}
|
||||
|
||||
if err := e.Validate(ctx, c); err != nil {
|
||||
return "", nil, nil, nil, err
|
||||
}
|
||||
@ -193,6 +195,17 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
return "", nil, nil, nil, err
|
||||
}
|
||||
|
||||
var validExitCodes []int32
|
||||
if codes, err := getValidExitCodes(e.base)(ctx, c); err != nil {
|
||||
return "", nil, nil, nil, err
|
||||
} else if codes != nil {
|
||||
validExitCodes = make([]int32, len(codes))
|
||||
for i, code := range codes {
|
||||
validExitCodes[i] = int32(code)
|
||||
}
|
||||
addCap(&e.constraints, pb.CapExecValidExitCode)
|
||||
}
|
||||
|
||||
meta := &pb.Meta{
|
||||
Args: args,
|
||||
Env: env.ToArray(),
|
||||
@ -201,6 +214,7 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
Hostname: hostname,
|
||||
CgroupParent: cgrpParent,
|
||||
RemoveMountStubsRecursive: true,
|
||||
ValidExitCodes: validExitCodes,
|
||||
}
|
||||
|
||||
extraHosts, err := getExtraHosts(e.base)(ctx, c)
|
||||
@ -330,7 +344,7 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
newInput := true
|
||||
|
||||
for i, inp2 := range pop.Inputs {
|
||||
if *inp == *inp2 {
|
||||
if proto.Equal(inp, inp2) {
|
||||
inputIndex = pb.InputIndex(i)
|
||||
newInput = false
|
||||
break
|
||||
@ -351,10 +365,10 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
}
|
||||
|
||||
pm := &pb.Mount{
|
||||
Input: inputIndex,
|
||||
Input: int64(inputIndex),
|
||||
Dest: m.target,
|
||||
Readonly: m.readonly,
|
||||
Output: outputIndex,
|
||||
Output: int64(outputIndex),
|
||||
Selector: m.selector,
|
||||
}
|
||||
if m.cacheID != "" {
|
||||
@ -382,7 +396,7 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
if m.tmpfs {
|
||||
pm.MountType = pb.MountType_TMPFS
|
||||
pm.TmpfsOpt = &pb.TmpfsOpt{
|
||||
Size_: m.tmpfsOpt.Size,
|
||||
Size: m.tmpfsOpt.Size,
|
||||
}
|
||||
}
|
||||
peo.Mounts = append(peo.Mounts, pm)
|
||||
@ -398,7 +412,7 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
}
|
||||
if s.Target != nil {
|
||||
pm := &pb.Mount{
|
||||
Input: pb.Empty,
|
||||
Input: int64(pb.Empty),
|
||||
Dest: *s.Target,
|
||||
MountType: pb.MountType_SECRET,
|
||||
SecretOpt: &pb.SecretOpt{
|
||||
@ -415,7 +429,7 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
|
||||
for _, s := range e.ssh {
|
||||
pm := &pb.Mount{
|
||||
Input: pb.Empty,
|
||||
Input: int64(pb.Empty),
|
||||
Dest: s.Target,
|
||||
MountType: pb.MountType_SSH,
|
||||
SSHOpt: &pb.SSHOpt{
|
||||
@ -429,12 +443,11 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
peo.Mounts = append(peo.Mounts, pm)
|
||||
}
|
||||
|
||||
dt, err := pop.Marshal()
|
||||
dt, err := deterministicMarshal(pop)
|
||||
if err != nil {
|
||||
return "", nil, nil, nil, err
|
||||
}
|
||||
e.Store(dt, md, e.constraints.SourceLocations, c)
|
||||
return e.Load()
|
||||
return e.Store(dt, md, e.constraints.SourceLocations, c)
|
||||
}
|
||||
|
||||
func (e *ExecOp) Output() Output {
|
||||
@ -581,6 +594,7 @@ func Shlex(str string) RunOption {
|
||||
ei.State = shlexf(str, false)(ei.State)
|
||||
})
|
||||
}
|
||||
|
||||
func Shlexf(str string, v ...interface{}) RunOption {
|
||||
return runOptionFunc(func(ei *ExecInfo) {
|
||||
ei.State = shlexf(str, true, v...)(ei.State)
|
||||
@ -605,6 +619,12 @@ func AddUlimit(name UlimitName, soft int64, hard int64) RunOption {
|
||||
})
|
||||
}
|
||||
|
||||
func ValidExitCodes(codes ...int) RunOption {
|
||||
return runOptionFunc(func(ei *ExecInfo) {
|
||||
ei.State = validExitCodes(codes...)(ei.State)
|
||||
})
|
||||
}
|
||||
|
||||
func WithCgroupParent(cp string) RunOption {
|
||||
return runOptionFunc(func(ei *ExecInfo) {
|
||||
ei.State = ei.State.WithCgroupParent(cp)
|
||||
|
Reference in New Issue
Block a user