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:
Jonathan A. Sternberg
2024-10-02 15:51:59 -05:00
parent 8e47387d02
commit b35a0f4718
592 changed files with 46288 additions and 110420 deletions

View File

@ -60,6 +60,7 @@ const (
CapExecMountContentCache apicaps.CapID = "exec.mount.cache.content"
CapExecCgroupsMounted apicaps.CapID = "exec.cgroup"
CapExecSecretEnv apicaps.CapID = "exec.secretenv"
CapExecValidExitCode apicaps.CapID = "exec.validexitcode"
CapFileBase apicaps.CapID = "file.base"
CapFileRmWildcard apicaps.CapID = "file.rm.wildcard"
@ -357,6 +358,12 @@ func init() {
Status: apicaps.CapStatusExperimental,
})
Caps.Init(apicaps.Cap{
ID: CapExecValidExitCode,
Enabled: true,
Status: apicaps.CapStatusExperimental,
})
Caps.Init(apicaps.Cap{
ID: CapFileBase,
Enabled: true,

View File

@ -1,3 +1,3 @@
package pb
//go:generate protoc -I=. -I=../../vendor/ -I=../../vendor/github.com/gogo/protobuf/ --gogofaster_out=. ops.proto
//go:generate protoc -I=. -I=../../vendor/ --go_out=paths=source_relative:. ops.proto

View File

@ -58,9 +58,9 @@ func (m *FileAction) UnmarshalJSON(data []byte) error {
return err
}
m.Input = v.Input
m.SecondaryInput = v.SecondaryInput
m.Output = v.Output
m.Input = int64(v.Input)
m.SecondaryInput = int64(v.SecondaryInput)
m.Output = int64(v.Output)
switch {
case v.Action.FileAction_Copy != nil:
m.Action = v.Action.FileAction_Copy

23
vendor/github.com/moby/buildkit/solver/pb/ops.go generated vendored Normal file
View File

@ -0,0 +1,23 @@
package pb
import proto "google.golang.org/protobuf/proto"
func (m *Definition) IsNil() bool {
return m == nil || m.Metadata == nil
}
func (m *Definition) Marshal() ([]byte, error) {
return proto.Marshal(m)
}
func (m *Definition) Unmarshal(dAtA []byte) error {
return proto.Unmarshal(dAtA, m)
}
func (m *Op) Marshal() ([]byte, error) {
return proto.Marshal(m)
}
func (m *Op) Unmarshal(dAtA []byte) error {
return proto.Unmarshal(dAtA, m)
}

File diff suppressed because it is too large Load Diff

View File

@ -4,9 +4,7 @@ syntax = "proto3";
// LLB is DAG-structured; Op represents a vertex, and Definition represents a graph.
package pb;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.stable_marshaler_all) = true;
option go_package = "github.com/moby/buildkit/solver/pb";
// Op represents a vertex of the LLB DAG.
message Op {
@ -37,9 +35,9 @@ message Platform {
// Input represents an input edge for an Op.
message Input {
// digest of the marshaled input Op
string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
string digest = 1;
// output index of the input Op
int64 index = 2 [(gogoproto.customtype) = "OutputIndex", (gogoproto.nullable) = false];
int64 index = 2;
}
// ExecOp executes a command in a container.
@ -65,6 +63,7 @@ message Meta {
repeated Ulimit ulimit = 9;
string cgroupParent = 10;
bool removeMountStubsRecursive = 11;
repeated int32 validExitCodes = 12;
}
message HostIP {
@ -98,10 +97,10 @@ message SecretEnv {
// Mount specifies how to mount an input Op as a filesystem.
message Mount {
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
int64 input = 1;
string selector = 2;
string dest = 3;
int64 output = 4 [(gogoproto.customtype) = "OutputIndex", (gogoproto.nullable) = false];
int64 output = 4;
bool readonly = 5;
MountType mountType = 6;
TmpfsOpt TmpfsOpt = 19;
@ -194,7 +193,7 @@ message SourceOp {
// BuildOp is used for nested build invocation.
// BuildOp is experimental and can break without backwards compatibility
message BuildOp {
int64 builder = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
int64 builder = 1;
map<string, BuildInput> inputs = 2;
Definition def = 3;
map<string, string> attrs = 4;
@ -203,7 +202,7 @@ message BuildOp {
// BuildInput is used for BuildOp.
message BuildInput {
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
int64 input = 1;
}
// OpMetadata is a per-vertex metadata entry, which can be defined for arbitrary Op vertex and overridable on the run time.
@ -216,7 +215,7 @@ message OpMetadata {
// WorkerConstraint worker_constraint = 3;
ExportCache export_cache = 4;
map<string, bool> caps = 5 [(gogoproto.castkey) = "github.com/moby/buildkit/util/apicaps.CapID", (gogoproto.nullable) = false];
map<string, bool> caps = 5;
ProgressGroup progress_group = 6;
}
@ -248,8 +247,8 @@ message Location {
// Range is an area in the source file
message Range {
Position start = 1 [(gogoproto.nullable) = false];
Position end = 2 [(gogoproto.nullable) = false];
Position start = 1;
Position end = 2;
}
// Position is single location in a source file
@ -287,7 +286,7 @@ message Definition {
repeated bytes def = 1;
// metadata contains metadata for the each of the Op messages.
// A key must be an LLB op digest string. Currently, empty string is not expected as a key, but it may change in the future.
map<string, OpMetadata> metadata = 2 [(gogoproto.castkey) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
map<string, OpMetadata> metadata = 2;
// Source contains the source mapping information for the vertexes in the definition
Source Source = 3;
}
@ -298,9 +297,9 @@ message FileOp {
message FileAction {
// changes to this structure must be represented in json.go.
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false]; // could be real input or target (target index + max input index)
int64 secondaryInput = 2 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false]; // --//--
int64 output = 3 [(gogoproto.customtype) = "OutputIndex", (gogoproto.nullable) = false];
int64 input = 1; // could be real input or target (target index + max input index)
int64 secondaryInput = 2; // --//--
int64 output = 3;
oneof action {
// FileActionCopy copies files from secondaryInput on top of input
FileActionCopy copy = 4;
@ -394,11 +393,11 @@ message UserOpt {
message NamedUserOpt {
string name = 1;
int64 input = 2 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
int64 input = 2;
}
message MergeInput {
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
int64 input = 1;
}
message MergeOp {
@ -406,11 +405,11 @@ message MergeOp {
}
message LowerDiffInput {
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
int64 input = 1;
}
message UpperDiffInput {
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
int64 input = 1;
}
message DiffOp {

View File

@ -17,8 +17,8 @@ func (p *Platform) Spec() ocispecs.Platform {
return result
}
func PlatformFromSpec(p ocispecs.Platform) Platform {
result := Platform{
func PlatformFromSpec(p ocispecs.Platform) *Platform {
result := &Platform{
OS: p.OS,
Architecture: p.Architecture,
Variant: p.Variant,
@ -30,7 +30,7 @@ func PlatformFromSpec(p ocispecs.Platform) Platform {
return result
}
func ToSpecPlatforms(p []Platform) []ocispecs.Platform {
func ToSpecPlatforms(p []*Platform) []ocispecs.Platform {
out := make([]ocispecs.Platform, 0, len(p))
for _, pp := range p {
out = append(out, pp.Spec())
@ -38,8 +38,8 @@ func ToSpecPlatforms(p []Platform) []ocispecs.Platform {
return out
}
func PlatformsFromSpec(p []ocispecs.Platform) []Platform {
out := make([]Platform, 0, len(p))
func PlatformsFromSpec(p []ocispecs.Platform) []*Platform {
out := make([]*Platform, 0, len(p))
for _, pp := range p {
out = append(out, PlatformFromSpec(pp))
}