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

File diff suppressed because it is too large Load Diff

View File

@@ -2,17 +2,14 @@ syntax = "proto3";
package moby.buildkit.v1;
option go_package = "github.com/moby/buildkit/api/services/control;moby_buildkit_v1";
// import "github.com/containerd/containerd/api/types/descriptor.proto";
import "github.com/gogo/googleapis/google/rpc/status.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "github.com/moby/buildkit/api/types/worker.proto";
import "github.com/moby/buildkit/solver/pb/ops.proto";
import "github.com/moby/buildkit/sourcepolicy/pb/policy.proto";
import "google/protobuf/timestamp.proto";
option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
import "google/rpc/status.proto";
service Control {
rpc DiskUsage(DiskUsageRequest) returns (DiskUsageResponse);
@@ -30,8 +27,11 @@ service Control {
message PruneRequest {
repeated string filter = 1;
bool all = 2;
int64 keepDuration = 3 [(gogoproto.nullable) = true];
int64 keepBytes = 4 [(gogoproto.nullable) = true];
int64 keepDuration = 3;
int64 minStorage = 5;
int64 maxStorage = 4;
int64 free = 6;
}
message DiskUsageRequest {
@@ -48,8 +48,8 @@ message UsageRecord {
bool InUse = 3;
int64 Size = 4;
string Parent = 5 [deprecated=true];
google.protobuf.Timestamp CreatedAt = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
google.protobuf.Timestamp LastUsedAt = 7 [(gogoproto.stdtime) = true];
google.protobuf.Timestamp CreatedAt = 6;
google.protobuf.Timestamp LastUsedAt = 7;
int64 UsageCount = 8;
string Description = 9;
string RecordType = 10;
@@ -68,8 +68,8 @@ message SolveRequest {
string Session = 5;
string Frontend = 6;
map<string, string> FrontendAttrs = 7;
CacheOptions Cache = 8 [(gogoproto.nullable) = false];
repeated string Entitlements = 9 [(gogoproto.customtype) = "github.com/moby/buildkit/util/entitlements.Entitlement" ];
CacheOptions Cache = 8;
repeated string Entitlements = 9;
map<string, pb.Definition> FrontendInputs = 10;
bool Internal = 11; // Internal builds are not recorded in build history
moby.buildkit.v1.sourcepolicy.Policy SourcePolicy = 12;
@@ -120,36 +120,36 @@ message StatusResponse {
}
message Vertex {
string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
repeated string inputs = 2 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
string digest = 1;
repeated string inputs = 2;
string name = 3;
bool cached = 4;
google.protobuf.Timestamp started = 5 [(gogoproto.stdtime) = true ];
google.protobuf.Timestamp completed = 6 [(gogoproto.stdtime) = true ];
google.protobuf.Timestamp started = 5;
google.protobuf.Timestamp completed = 6;
string error = 7; // typed errors?
pb.ProgressGroup progressGroup = 8;
}
message VertexStatus {
string ID = 1;
string vertex = 2 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
string vertex = 2;
string name = 3;
int64 current = 4;
int64 total = 5;
google.protobuf.Timestamp timestamp = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
google.protobuf.Timestamp started = 7 [(gogoproto.stdtime) = true ];
google.protobuf.Timestamp completed = 8 [(gogoproto.stdtime) = true ];
google.protobuf.Timestamp timestamp = 6;
google.protobuf.Timestamp started = 7;
google.protobuf.Timestamp completed = 8;
}
message VertexLog {
string vertex = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
google.protobuf.Timestamp timestamp = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
string vertex = 1;
google.protobuf.Timestamp timestamp = 2;
int64 stream = 3;
bytes msg = 4;
}
message VertexWarning {
string vertex = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
string vertex = 1;
int64 level = 2;
bytes short = 3;
repeated bytes detail = 4;
@@ -199,8 +199,8 @@ message BuildHistoryRecord {
map<string, string> FrontendAttrs = 3;
repeated Exporter Exporters = 4;
google.rpc.Status error = 5;
google.protobuf.Timestamp CreatedAt = 6 [(gogoproto.stdtime) = true];
google.protobuf.Timestamp CompletedAt = 7 [(gogoproto.stdtime) = true];
google.protobuf.Timestamp CreatedAt = 6;
google.protobuf.Timestamp CompletedAt = 7;
Descriptor logs = 8;
map<string, string> ExporterResponse = 9;
BuildResultInfo Result = 10;
@@ -228,7 +228,7 @@ message UpdateBuildHistoryResponse {}
message Descriptor {
string media_type = 1;
string digest = 2 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
string digest = 2;
int64 size = 3;
map<string, string> annotations = 5;
}

View File

@@ -0,0 +1,427 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.11.4
// source: control.proto
package moby_buildkit_v1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Control_DiskUsage_FullMethodName = "/moby.buildkit.v1.Control/DiskUsage"
Control_Prune_FullMethodName = "/moby.buildkit.v1.Control/Prune"
Control_Solve_FullMethodName = "/moby.buildkit.v1.Control/Solve"
Control_Status_FullMethodName = "/moby.buildkit.v1.Control/Status"
Control_Session_FullMethodName = "/moby.buildkit.v1.Control/Session"
Control_ListWorkers_FullMethodName = "/moby.buildkit.v1.Control/ListWorkers"
Control_Info_FullMethodName = "/moby.buildkit.v1.Control/Info"
Control_ListenBuildHistory_FullMethodName = "/moby.buildkit.v1.Control/ListenBuildHistory"
Control_UpdateBuildHistory_FullMethodName = "/moby.buildkit.v1.Control/UpdateBuildHistory"
)
// ControlClient is the client API for Control service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ControlClient interface {
DiskUsage(ctx context.Context, in *DiskUsageRequest, opts ...grpc.CallOption) (*DiskUsageResponse, error)
Prune(ctx context.Context, in *PruneRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[UsageRecord], error)
Solve(ctx context.Context, in *SolveRequest, opts ...grpc.CallOption) (*SolveResponse, error)
Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StatusResponse], error)
Session(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BytesMessage, BytesMessage], error)
ListWorkers(ctx context.Context, in *ListWorkersRequest, opts ...grpc.CallOption) (*ListWorkersResponse, error)
Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error)
ListenBuildHistory(ctx context.Context, in *BuildHistoryRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[BuildHistoryEvent], error)
UpdateBuildHistory(ctx context.Context, in *UpdateBuildHistoryRequest, opts ...grpc.CallOption) (*UpdateBuildHistoryResponse, error)
}
type controlClient struct {
cc grpc.ClientConnInterface
}
func NewControlClient(cc grpc.ClientConnInterface) ControlClient {
return &controlClient{cc}
}
func (c *controlClient) DiskUsage(ctx context.Context, in *DiskUsageRequest, opts ...grpc.CallOption) (*DiskUsageResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DiskUsageResponse)
err := c.cc.Invoke(ctx, Control_DiskUsage_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *controlClient) Prune(ctx context.Context, in *PruneRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[UsageRecord], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &Control_ServiceDesc.Streams[0], Control_Prune_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[PruneRequest, UsageRecord]{ClientStream: stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_PruneClient = grpc.ServerStreamingClient[UsageRecord]
func (c *controlClient) Solve(ctx context.Context, in *SolveRequest, opts ...grpc.CallOption) (*SolveResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SolveResponse)
err := c.cc.Invoke(ctx, Control_Solve_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *controlClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StatusResponse], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &Control_ServiceDesc.Streams[1], Control_Status_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[StatusRequest, StatusResponse]{ClientStream: stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_StatusClient = grpc.ServerStreamingClient[StatusResponse]
func (c *controlClient) Session(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BytesMessage, BytesMessage], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &Control_ServiceDesc.Streams[2], Control_Session_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[BytesMessage, BytesMessage]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_SessionClient = grpc.BidiStreamingClient[BytesMessage, BytesMessage]
func (c *controlClient) ListWorkers(ctx context.Context, in *ListWorkersRequest, opts ...grpc.CallOption) (*ListWorkersResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListWorkersResponse)
err := c.cc.Invoke(ctx, Control_ListWorkers_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *controlClient) Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(InfoResponse)
err := c.cc.Invoke(ctx, Control_Info_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *controlClient) ListenBuildHistory(ctx context.Context, in *BuildHistoryRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[BuildHistoryEvent], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &Control_ServiceDesc.Streams[3], Control_ListenBuildHistory_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[BuildHistoryRequest, BuildHistoryEvent]{ClientStream: stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_ListenBuildHistoryClient = grpc.ServerStreamingClient[BuildHistoryEvent]
func (c *controlClient) UpdateBuildHistory(ctx context.Context, in *UpdateBuildHistoryRequest, opts ...grpc.CallOption) (*UpdateBuildHistoryResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UpdateBuildHistoryResponse)
err := c.cc.Invoke(ctx, Control_UpdateBuildHistory_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ControlServer is the server API for Control service.
// All implementations should embed UnimplementedControlServer
// for forward compatibility.
type ControlServer interface {
DiskUsage(context.Context, *DiskUsageRequest) (*DiskUsageResponse, error)
Prune(*PruneRequest, grpc.ServerStreamingServer[UsageRecord]) error
Solve(context.Context, *SolveRequest) (*SolveResponse, error)
Status(*StatusRequest, grpc.ServerStreamingServer[StatusResponse]) error
Session(grpc.BidiStreamingServer[BytesMessage, BytesMessage]) error
ListWorkers(context.Context, *ListWorkersRequest) (*ListWorkersResponse, error)
Info(context.Context, *InfoRequest) (*InfoResponse, error)
ListenBuildHistory(*BuildHistoryRequest, grpc.ServerStreamingServer[BuildHistoryEvent]) error
UpdateBuildHistory(context.Context, *UpdateBuildHistoryRequest) (*UpdateBuildHistoryResponse, error)
}
// UnimplementedControlServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedControlServer struct{}
func (UnimplementedControlServer) DiskUsage(context.Context, *DiskUsageRequest) (*DiskUsageResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DiskUsage not implemented")
}
func (UnimplementedControlServer) Prune(*PruneRequest, grpc.ServerStreamingServer[UsageRecord]) error {
return status.Errorf(codes.Unimplemented, "method Prune not implemented")
}
func (UnimplementedControlServer) Solve(context.Context, *SolveRequest) (*SolveResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Solve not implemented")
}
func (UnimplementedControlServer) Status(*StatusRequest, grpc.ServerStreamingServer[StatusResponse]) error {
return status.Errorf(codes.Unimplemented, "method Status not implemented")
}
func (UnimplementedControlServer) Session(grpc.BidiStreamingServer[BytesMessage, BytesMessage]) error {
return status.Errorf(codes.Unimplemented, "method Session not implemented")
}
func (UnimplementedControlServer) ListWorkers(context.Context, *ListWorkersRequest) (*ListWorkersResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListWorkers not implemented")
}
func (UnimplementedControlServer) Info(context.Context, *InfoRequest) (*InfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Info not implemented")
}
func (UnimplementedControlServer) ListenBuildHistory(*BuildHistoryRequest, grpc.ServerStreamingServer[BuildHistoryEvent]) error {
return status.Errorf(codes.Unimplemented, "method ListenBuildHistory not implemented")
}
func (UnimplementedControlServer) UpdateBuildHistory(context.Context, *UpdateBuildHistoryRequest) (*UpdateBuildHistoryResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateBuildHistory not implemented")
}
func (UnimplementedControlServer) testEmbeddedByValue() {}
// UnsafeControlServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ControlServer will
// result in compilation errors.
type UnsafeControlServer interface {
mustEmbedUnimplementedControlServer()
}
func RegisterControlServer(s grpc.ServiceRegistrar, srv ControlServer) {
// If the following call pancis, it indicates UnimplementedControlServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Control_ServiceDesc, srv)
}
func _Control_DiskUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DiskUsageRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).DiskUsage(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Control_DiskUsage_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).DiskUsage(ctx, req.(*DiskUsageRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Control_Prune_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(PruneRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(ControlServer).Prune(m, &grpc.GenericServerStream[PruneRequest, UsageRecord]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_PruneServer = grpc.ServerStreamingServer[UsageRecord]
func _Control_Solve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SolveRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).Solve(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Control_Solve_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).Solve(ctx, req.(*SolveRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Control_Status_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(StatusRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(ControlServer).Status(m, &grpc.GenericServerStream[StatusRequest, StatusResponse]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_StatusServer = grpc.ServerStreamingServer[StatusResponse]
func _Control_Session_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(ControlServer).Session(&grpc.GenericServerStream[BytesMessage, BytesMessage]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_SessionServer = grpc.BidiStreamingServer[BytesMessage, BytesMessage]
func _Control_ListWorkers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListWorkersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).ListWorkers(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Control_ListWorkers_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).ListWorkers(ctx, req.(*ListWorkersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Control_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(InfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).Info(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Control_Info_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).Info(ctx, req.(*InfoRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Control_ListenBuildHistory_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(BuildHistoryRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(ControlServer).ListenBuildHistory(m, &grpc.GenericServerStream[BuildHistoryRequest, BuildHistoryEvent]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_ListenBuildHistoryServer = grpc.ServerStreamingServer[BuildHistoryEvent]
func _Control_UpdateBuildHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateBuildHistoryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ControlServer).UpdateBuildHistory(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Control_UpdateBuildHistory_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ControlServer).UpdateBuildHistory(ctx, req.(*UpdateBuildHistoryRequest))
}
return interceptor(ctx, in, info, handler)
}
// Control_ServiceDesc is the grpc.ServiceDesc for Control service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Control_ServiceDesc = grpc.ServiceDesc{
ServiceName: "moby.buildkit.v1.Control",
HandlerType: (*ControlServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "DiskUsage",
Handler: _Control_DiskUsage_Handler,
},
{
MethodName: "Solve",
Handler: _Control_Solve_Handler,
},
{
MethodName: "ListWorkers",
Handler: _Control_ListWorkers_Handler,
},
{
MethodName: "Info",
Handler: _Control_Info_Handler,
},
{
MethodName: "UpdateBuildHistory",
Handler: _Control_UpdateBuildHistory_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "Prune",
Handler: _Control_Prune_Handler,
ServerStreams: true,
},
{
StreamName: "Status",
Handler: _Control_Status_Handler,
ServerStreams: true,
},
{
StreamName: "Session",
Handler: _Control_Session_Handler,
ServerStreams: true,
ClientStreams: true,
},
{
StreamName: "ListenBuildHistory",
Handler: _Control_ListenBuildHistory_Handler,
ServerStreams: true,
},
},
Metadata: "control.proto",
}

View File

@@ -1,3 +1,3 @@
package moby_buildkit_v1 //nolint:revive
//go:generate protoc -I=. -I=../../../vendor/ -I=../../../../../../ --gogo_out=plugins=grpc:. control.proto
//go:generate protoc -I=. -I=../../../vendor/ -I=../../../../../../ --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative,require_unimplemented_servers=false:. control.proto

View File

@@ -1,3 +1,3 @@
package moby_buildkit_v1_types //nolint:revive
//go:generate protoc -I=. -I=../../vendor/ -I=../../../../../ --gogo_out=plugins=grpc:. worker.proto
//go:generate protoc -I=. -I=../../vendor/ -I=../../../../../ --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative,require_unimplemented_servers=false:. worker.proto

File diff suppressed because it is too large Load Diff

View File

@@ -2,17 +2,14 @@ syntax = "proto3";
package moby.buildkit.v1.types;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "github.com/moby/buildkit/solver/pb/ops.proto";
option go_package = "github.com/moby/buildkit/api/types;moby_buildkit_v1_types";
option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
import "github.com/moby/buildkit/solver/pb/ops.proto";
message WorkerRecord {
string ID = 1;
map<string, string> Labels = 2;
repeated pb.Platform platforms = 3 [(gogoproto.nullable) = false];
repeated pb.Platform platforms = 3;
repeated GCPolicy GCPolicy = 4;
BuildkitVersion BuildkitVersion = 5;
}
@@ -20,8 +17,12 @@ message WorkerRecord {
message GCPolicy {
bool all = 1;
int64 keepDuration = 2;
int64 keepBytes = 3;
repeated string filters = 4;
int64 minStorage = 5;
// maxStorage was renamed from freeBytes
int64 maxStorage = 3;
int64 free = 6;
}
message BuildkitVersion {

View File

@@ -151,6 +151,7 @@ func New(ctx context.Context, address string, opts ...ClientOpt) (*Client, error
gopts = append(gopts, grpc.WithStreamInterceptor(grpcerrors.StreamClientInterceptor))
gopts = append(gopts, customDialOptions...)
//nolint:staticcheck // ignore SA1019 NewClient has different behavior and needs to be tested
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)

View File

@@ -43,14 +43,20 @@ func (c *Client) DiskUsage(ctx context.Context, opts ...DiskUsageOption) ([]*Usa
ID: d.ID,
Mutable: d.Mutable,
InUse: d.InUse,
Size: d.Size_,
Size: d.Size,
Parents: d.Parents,
CreatedAt: d.CreatedAt,
CreatedAt: d.CreatedAt.AsTime(),
Description: d.Description,
UsageCount: int(d.UsageCount),
LastUsedAt: d.LastUsedAt,
RecordType: UsageRecordType(d.RecordType),
Shared: d.Shared,
LastUsedAt: func() *time.Time {
if d.LastUsedAt != nil {
ts := d.LastUsedAt.AsTime()
return &ts
}
return nil
}(),
RecordType: UsageRecordType(d.RecordType),
Shared: d.Shared,
})
}

View File

@@ -8,6 +8,7 @@ import (
digest "github.com/opencontainers/go-digest"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
)
// DefinitionOp implements llb.Vertex using a marshalled definition.
@@ -19,7 +20,7 @@ type DefinitionOp struct {
mu sync.Mutex
ops map[digest.Digest]*pb.Op
defs map[digest.Digest][]byte
metas map[digest.Digest]pb.OpMetadata
metas map[digest.Digest]*pb.OpMetadata
sources map[digest.Digest][]*SourceLocation
platforms map[digest.Digest]*ocispecs.Platform
dgst digest.Digest
@@ -29,7 +30,7 @@ type DefinitionOp struct {
// NewDefinitionOp returns a new operation from a marshalled definition.
func NewDefinitionOp(def *pb.Definition) (*DefinitionOp, error) {
if def == nil {
if def.IsNil() {
return nil, errors.New("invalid nil input definition to definition op")
}
@@ -40,7 +41,7 @@ func NewDefinitionOp(def *pb.Definition) (*DefinitionOp, error) {
var dgst digest.Digest
for _, dt := range def.Def {
var op pb.Op
if err := (&op).Unmarshal(dt); err != nil {
if err := proto.Unmarshal(dt, &op); err != nil {
return nil, errors.Wrap(err, "failed to parse llb proto op")
}
dgst = digest.FromBytes(dt)
@@ -89,14 +90,19 @@ func NewDefinitionOp(def *pb.Definition) (*DefinitionOp, error) {
var index pb.OutputIndex
if dgst != "" {
index = ops[dgst].Inputs[0].Index
dgst = ops[dgst].Inputs[0].Digest
index = pb.OutputIndex(ops[dgst].Inputs[0].Index)
dgst = digest.Digest(ops[dgst].Inputs[0].Digest)
}
metas := make(map[digest.Digest]*pb.OpMetadata, len(def.Metadata))
for k, v := range def.Metadata {
metas[digest.Digest(k)] = v
}
return &DefinitionOp{
ops: ops,
defs: defs,
metas: def.Metadata,
metas: metas,
sources: srcs,
platforms: platforms,
dgst: dgst,
@@ -163,7 +169,7 @@ func (d *DefinitionOp) Marshal(ctx context.Context, c *Constraints) (digest.Dige
defer d.mu.Unlock()
meta := d.metas[d.dgst]
return d.dgst, d.defs[d.dgst], &meta, d.sources[d.dgst], nil
return d.dgst, d.defs[d.dgst], meta, d.sources[d.dgst], nil
}
func (d *DefinitionOp) Output() Output {
@@ -207,7 +213,7 @@ func (d *DefinitionOp) Inputs() []Output {
for _, input := range op.Inputs {
var vtx *DefinitionOp
d.mu.Lock()
if existingIndexes, ok := d.loadInputCache(input.Digest); ok {
if existingIndexes, ok := d.loadInputCache(digest.Digest(input.Digest)); ok {
if int(input.Index) < len(existingIndexes) && existingIndexes[input.Index] != nil {
vtx = existingIndexes[input.Index]
}
@@ -218,19 +224,19 @@ func (d *DefinitionOp) Inputs() []Output {
defs: d.defs,
metas: d.metas,
platforms: d.platforms,
dgst: input.Digest,
index: input.Index,
dgst: digest.Digest(input.Digest),
index: pb.OutputIndex(input.Index),
inputCache: d.inputCache,
sources: d.sources,
}
existingIndexes, _ := d.loadInputCache(input.Digest)
existingIndexes, _ := d.loadInputCache(digest.Digest(input.Digest))
indexDiff := int(input.Index) - len(existingIndexes)
if indexDiff >= 0 {
// make room in the slice for the new index being set
existingIndexes = append(existingIndexes, make([]*DefinitionOp, indexDiff+1)...)
}
existingIndexes[input.Index] = vtx
d.storeInputCache(input.Digest, existingIndexes)
d.storeInputCache(digest.Digest(input.Digest), existingIndexes)
}
d.mu.Unlock()

View File

@@ -31,8 +31,8 @@ func (m *DiffOp) Validate(ctx context.Context, constraints *Constraints) error {
}
func (m *DiffOp) Marshal(ctx context.Context, constraints *Constraints) (digest.Digest, []byte, *pb.OpMetadata, []*SourceLocation, error) {
if m.Cached(constraints) {
return m.Load()
if dgst, dt, md, srcs, err := m.Load(constraints); err == nil {
return dgst, dt, md, srcs, nil
}
if err := m.Validate(ctx, constraints); err != nil {
return "", nil, nil, nil, err
@@ -43,9 +43,9 @@ func (m *DiffOp) Marshal(ctx context.Context, constraints *Constraints) (digest.
op := &pb.DiffOp{}
op.Lower = &pb.LowerDiffInput{Input: pb.InputIndex(len(proto.Inputs))}
op.Lower = &pb.LowerDiffInput{Input: int64(len(proto.Inputs))}
if m.lower == nil {
op.Lower.Input = pb.Empty
op.Lower.Input = int64(pb.Empty)
} else {
pbLowerInput, err := m.lower.ToInput(ctx, constraints)
if err != nil {
@@ -54,9 +54,9 @@ func (m *DiffOp) Marshal(ctx context.Context, constraints *Constraints) (digest.
proto.Inputs = append(proto.Inputs, pbLowerInput)
}
op.Upper = &pb.UpperDiffInput{Input: pb.InputIndex(len(proto.Inputs))}
op.Upper = &pb.UpperDiffInput{Input: int64(len(proto.Inputs))}
if m.upper == nil {
op.Upper.Input = pb.Empty
op.Upper.Input = int64(pb.Empty)
} else {
pbUpperInput, err := m.upper.ToInput(ctx, constraints)
if err != nil {
@@ -67,13 +67,12 @@ func (m *DiffOp) Marshal(ctx context.Context, constraints *Constraints) (digest.
proto.Op = &pb.Op_Diff{Diff: op}
dt, err := proto.Marshal()
dt, err := deterministicMarshal(proto)
if err != nil {
return "", nil, nil, nil, err
}
m.Store(dt, md, m.constraints.SourceLocations, constraints)
return m.Load()
return m.Store(dt, md, m.constraints.SourceLocations, constraints)
}
func (m *DiffOp) Output() Output {

View File

@@ -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)

View File

@@ -12,6 +12,7 @@ import (
"github.com/moby/buildkit/solver/pb"
digest "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
)
// Examples:
@@ -271,9 +272,11 @@ type ChownOpt struct {
func (co ChownOpt) SetMkdirOption(mi *MkdirInfo) {
mi.ChownOpt = &co
}
func (co ChownOpt) SetMkfileOption(mi *MkfileInfo) {
mi.ChownOpt = &co
}
func (co ChownOpt) SetCopyOption(mi *CopyInfo) {
mi.ChownOpt = &co
}
@@ -299,7 +302,8 @@ func (up *UserOpt) marshal(base pb.InputIndex) *pb.UserOpt {
}
if up.Name != "" {
return &pb.UserOpt{User: &pb.UserOpt_ByName{ByName: &pb.NamedUserOpt{
Name: up.Name, Input: base}}}
Name: up.Name, Input: int64(base),
}}}
}
return &pb.UserOpt{User: &pb.UserOpt_ByID{ByID: uint32(up.UID)}}
}
@@ -648,7 +652,7 @@ func (ms *marshalState) addInput(c *Constraints, o Output) (pb.InputIndex, error
return 0, err
}
for i, inp2 := range ms.inputs {
if *inp == *inp2 {
if proto.Equal(inp, inp2) {
return pb.InputIndex(i), nil
}
}
@@ -726,9 +730,10 @@ func (ms *marshalState) add(fa *FileAction, c *Constraints) (*fileActionState, e
}
func (f *FileOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []byte, *pb.OpMetadata, []*SourceLocation, error) {
if f.Cached(c) {
return f.Load()
if dgst, dt, md, srcs, err := f.Load(c); err == nil {
return dgst, dt, md, srcs, nil
}
if err := f.Validate(ctx, c); err != nil {
return "", nil, nil, nil, err
}
@@ -786,17 +791,16 @@ func (f *FileOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
pfo.Actions = append(pfo.Actions, &pb.FileAction{
Input: getIndex(st.input, len(state.inputs), st.inputRelative),
SecondaryInput: getIndex(st.input2, len(state.inputs), st.input2Relative),
Output: output,
Output: int64(output),
Action: action,
})
}
dt, err := pop.Marshal()
dt, err := deterministicMarshal(pop)
if err != nil {
return "", nil, nil, nil, err
}
f.Store(dt, md, f.constraints.SourceLocations, c)
return f.Load()
return f.Store(dt, md, f.constraints.SourceLocations, c)
}
func normalizePath(parent, p string, keepSlash bool) string {
@@ -826,9 +830,9 @@ func (f *FileOp) Inputs() []Output {
return f.action.allOutputs(map[Output]struct{}{}, []Output{})
}
func getIndex(input pb.InputIndex, len int, relative *int) pb.InputIndex {
func getIndex(input pb.InputIndex, len int, relative *int) int64 {
if relative != nil {
return pb.InputIndex(len + *relative)
return int64(len + *relative)
}
return input
return int64(input)
}

View File

@@ -2,34 +2,43 @@ package llb
import (
"io"
"maps"
"sync"
cerrdefs "github.com/containerd/errdefs"
"github.com/containerd/platforms"
"github.com/moby/buildkit/solver/pb"
digest "github.com/opencontainers/go-digest"
"google.golang.org/protobuf/proto"
)
// Definition is the LLB definition structure with per-vertex metadata entries
// Corresponds to the Definition structure defined in solver/pb.Definition.
type Definition struct {
Def [][]byte
Metadata map[digest.Digest]pb.OpMetadata
Metadata map[digest.Digest]OpMetadata
Source *pb.Source
Constraints *Constraints
}
func (def *Definition) ToPB() *pb.Definition {
metas := make(map[string]*pb.OpMetadata, len(def.Metadata))
for dgst, meta := range def.Metadata {
metas[string(dgst)] = meta.ToPB()
}
return &pb.Definition{
Def: def.Def,
Source: def.Source,
Metadata: maps.Clone(def.Metadata),
Metadata: metas,
}
}
func (def *Definition) FromPB(x *pb.Definition) {
def.Def = x.Def
def.Source = x.Source
def.Metadata = maps.Clone(x.Metadata)
def.Metadata = make(map[digest.Digest]OpMetadata, len(x.Metadata))
for dgst, meta := range x.Metadata {
def.Metadata[digest.Digest(dgst)] = NewOpMetadata(meta)
}
}
func (def *Definition) Head() (digest.Digest, error) {
@@ -40,14 +49,14 @@ func (def *Definition) Head() (digest.Digest, error) {
last := def.Def[len(def.Def)-1]
var pop pb.Op
if err := (&pop).Unmarshal(last); err != nil {
if err := proto.Unmarshal(last, &pop); err != nil {
return "", err
}
if len(pop.Inputs) == 0 {
return "", nil
}
return pop.Inputs[0].Digest, nil
return digest.Digest(pop.Inputs[0].Digest), nil
}
func WriteTo(def *Definition, w io.Writer) error {
@@ -65,7 +74,7 @@ func ReadFrom(r io.Reader) (*Definition, error) {
return nil, err
}
var pbDef pb.Definition
if err := pbDef.Unmarshal(b); err != nil {
if err := proto.Unmarshal(b, &pbDef); err != nil {
return nil, err
}
var def Definition
@@ -104,27 +113,41 @@ func MarshalConstraints(base, override *Constraints) (*pb.Op, *pb.OpMetadata) {
Constraints: &pb.WorkerConstraints{
Filter: c.WorkerConstraints,
},
}, &c.Metadata
}, c.Metadata.ToPB()
}
type MarshalCache struct {
digest digest.Digest
dt []byte
md *pb.OpMetadata
srcs []*SourceLocation
constraints *Constraints
cache sync.Map
}
func (mc *MarshalCache) Cached(c *Constraints) bool {
return mc.dt != nil && mc.constraints == c
func (mc *MarshalCache) Load(c *Constraints) (digest.Digest, []byte, *pb.OpMetadata, []*SourceLocation, error) {
v, ok := mc.cache.Load(c)
if !ok {
return "", nil, nil, nil, cerrdefs.ErrNotFound
}
res := v.(*marshalCacheResult)
return res.digest, res.dt, res.md, res.srcs, nil
}
func (mc *MarshalCache) Load() (digest.Digest, []byte, *pb.OpMetadata, []*SourceLocation, error) {
return mc.digest, mc.dt, mc.md, mc.srcs, nil
func (mc *MarshalCache) Store(dt []byte, md *pb.OpMetadata, srcs []*SourceLocation, c *Constraints) (digest.Digest, []byte, *pb.OpMetadata, []*SourceLocation, error) {
res := &marshalCacheResult{
digest: digest.FromBytes(dt),
dt: dt,
md: md,
srcs: srcs,
}
mc.cache.Store(c, res)
return res.digest, res.dt, res.md, res.srcs, nil
}
func (mc *MarshalCache) Store(dt []byte, md *pb.OpMetadata, srcs []*SourceLocation, c *Constraints) {
mc.digest = digest.FromBytes(dt)
mc.dt = dt
mc.md = md
mc.constraints = c
mc.srcs = srcs
type marshalCacheResult struct {
digest digest.Digest
dt []byte
md *pb.OpMetadata
srcs []*SourceLocation
}
func deterministicMarshal[Message proto.Message](m Message) ([]byte, error) {
return proto.MarshalOptions{Deterministic: true}.Marshal(m)
}

View File

@@ -32,9 +32,10 @@ func (m *MergeOp) Validate(ctx context.Context, constraints *Constraints) error
}
func (m *MergeOp) Marshal(ctx context.Context, constraints *Constraints) (digest.Digest, []byte, *pb.OpMetadata, []*SourceLocation, error) {
if m.Cached(constraints) {
return m.Load()
if dgst, dt, md, srcs, err := m.Load(constraints); err == nil {
return dgst, dt, md, srcs, nil
}
if err := m.Validate(ctx, constraints); err != nil {
return "", nil, nil, nil, err
}
@@ -44,7 +45,7 @@ func (m *MergeOp) Marshal(ctx context.Context, constraints *Constraints) (digest
op := &pb.MergeOp{}
for _, input := range m.inputs {
op.Inputs = append(op.Inputs, &pb.MergeInput{Input: pb.InputIndex(len(pop.Inputs))})
op.Inputs = append(op.Inputs, &pb.MergeInput{Input: int64(len(pop.Inputs))})
pbInput, err := input.ToInput(ctx, constraints)
if err != nil {
return "", nil, nil, nil, err
@@ -53,13 +54,12 @@ func (m *MergeOp) Marshal(ctx context.Context, constraints *Constraints) (digest
}
pop.Op = &pb.Op_Merge{Merge: op}
dt, err := pop.Marshal()
dt, err := deterministicMarshal(pop)
if err != nil {
return "", nil, nil, nil, err
}
m.Store(dt, md, m.constraints.SourceLocations, constraints)
return m.Load()
return m.Store(dt, md, m.constraints.SourceLocations, constraints)
}
func (m *MergeOp) Output() Output {

View File

@@ -18,14 +18,15 @@ import (
type contextKeyT string
var (
keyArgs = contextKeyT("llb.exec.args")
keyDir = contextKeyT("llb.exec.dir")
keyEnv = contextKeyT("llb.exec.env")
keyExtraHost = contextKeyT("llb.exec.extrahost")
keyHostname = contextKeyT("llb.exec.hostname")
keyUlimit = contextKeyT("llb.exec.ulimit")
keyCgroupParent = contextKeyT("llb.exec.cgroup.parent")
keyUser = contextKeyT("llb.exec.user")
keyArgs = contextKeyT("llb.exec.args")
keyDir = contextKeyT("llb.exec.dir")
keyEnv = contextKeyT("llb.exec.env")
keyExtraHost = contextKeyT("llb.exec.extrahost")
keyHostname = contextKeyT("llb.exec.hostname")
keyUlimit = contextKeyT("llb.exec.ulimit")
keyCgroupParent = contextKeyT("llb.exec.cgroup.parent")
keyUser = contextKeyT("llb.exec.user")
keyValidExitCodes = contextKeyT("llb.exec.validexitcodes")
keyPlatform = contextKeyT("llb.platform")
keyNetwork = contextKeyT("llb.network")
@@ -165,6 +166,25 @@ func getUser(s State) func(context.Context, *Constraints) (string, error) {
}
}
func validExitCodes(codes ...int) StateOption {
return func(s State) State {
return s.WithValue(keyValidExitCodes, codes)
}
}
func getValidExitCodes(s State) func(context.Context, *Constraints) ([]int, error) {
return func(ctx context.Context, c *Constraints) ([]int, error) {
v, err := s.getValue(keyValidExitCodes)(ctx, c)
if err != nil {
return nil, err
}
if v != nil {
return v.([]int), nil
}
return nil, nil
}
}
// Hostname returns a [StateOption] which sets the hostname used for containers created by [State.Run].
// This is the equivalent of [State.Hostname]
// See [State.With] for where to use this.
@@ -263,7 +283,7 @@ func ulimit(name UlimitName, soft int64, hard int64) StateOption {
if err != nil {
return nil, err
}
return append(v, pb.Ulimit{
return append(v, &pb.Ulimit{
Name: string(name),
Soft: soft,
Hard: hard,
@@ -272,14 +292,14 @@ func ulimit(name UlimitName, soft int64, hard int64) StateOption {
}
}
func getUlimit(s State) func(context.Context, *Constraints) ([]pb.Ulimit, error) {
return func(ctx context.Context, c *Constraints) ([]pb.Ulimit, error) {
func getUlimit(s State) func(context.Context, *Constraints) ([]*pb.Ulimit, error) {
return func(ctx context.Context, c *Constraints) ([]*pb.Ulimit, error) {
v, err := s.getValue(keyUlimit)(ctx, c)
if err != nil {
return nil, err
}
if v != nil {
return v.([]pb.Ulimit), nil
return v.([]*pb.Ulimit), nil
}
return nil, nil
}
@@ -312,6 +332,7 @@ func Network(v pb.NetMode) StateOption {
return s.WithValue(keyNetwork, v)
}
}
func getNetwork(s State) func(context.Context, *Constraints) (pb.NetMode, error) {
return func(ctx context.Context, c *Constraints) (pb.NetMode, error) {
v, err := s.getValue(keyNetwork)(ctx, c)
@@ -334,6 +355,7 @@ func Security(v pb.SecurityMode) StateOption {
return s.WithValue(keySecurity, v)
}
}
func getSecurity(s State) func(context.Context, *Constraints) (pb.SecurityMode, error) {
return func(ctx context.Context, c *Constraints) (pb.SecurityMode, error) {
v, err := s.getValue(keySecurity)(ctx, c)

View File

@@ -49,9 +49,10 @@ func (s *SourceOp) Validate(ctx context.Context, c *Constraints) error {
}
func (s *SourceOp) Marshal(ctx context.Context, constraints *Constraints) (digest.Digest, []byte, *pb.OpMetadata, []*SourceLocation, error) {
if s.Cached(constraints) {
return s.Load()
if dgst, dt, md, srcs, err := s.Load(constraints); err == nil {
return dgst, dt, md, srcs, nil
}
if err := s.Validate(ctx, constraints); err != nil {
return "", nil, nil, nil, err
}
@@ -76,13 +77,12 @@ func (s *SourceOp) Marshal(ctx context.Context, constraints *Constraints) (diges
proto.Platform = nil
}
dt, err := proto.Marshal()
dt, err := deterministicMarshal(proto)
if err != nil {
return "", nil, nil, nil, err
}
s.Store(dt, md, s.constraints.SourceLocations, constraints)
return s.Load()
return s.Store(dt, md, s.constraints.SourceLocations, constraints)
}
func (s *SourceOp) Output() Output {

View File

@@ -14,6 +14,7 @@ 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
@@ -139,7 +140,7 @@ func (s State) SetMarshalDefaults(co ...ConstraintsOpt) State {
func (s State) Marshal(ctx context.Context, co ...ConstraintsOpt) (*Definition, error) {
c := NewConstraints(append(s.opts, co...)...)
def := &Definition{
Metadata: make(map[digest.Digest]pb.OpMetadata, 0),
Metadata: make(map[digest.Digest]OpMetadata, 0),
Constraints: c,
}
@@ -157,7 +158,7 @@ func (s State) Marshal(ctx context.Context, co ...ConstraintsOpt) (*Definition,
return def, err
}
proto := &pb.Op{Inputs: []*pb.Input{inp}}
dt, err := proto.Marshal()
dt, err := protobuf.Marshal(proto)
if err != nil {
return def, err
}
@@ -210,7 +211,7 @@ func marshal(ctx context.Context, v Vertex, def *Definition, s *sourceMapCollect
}
vertexCache[v] = struct{}{}
if opMeta != nil {
def.Metadata[dgst] = mergeMetadata(def.Metadata[dgst], *opMeta)
def.Metadata[dgst] = mergeMetadata(def.Metadata[dgst], NewOpMetadata(opMeta))
}
s.Add(dgst, sls)
if _, ok := cache[dgst]; ok {
@@ -509,7 +510,7 @@ func (o *output) ToInput(ctx context.Context, c *Constraints) (*pb.Input, error)
if err != nil {
return nil, err
}
return &pb.Input{Digest: dgst, Index: index}, nil
return &pb.Input{Digest: string(dgst), Index: int64(index)}, nil
}
func (o *output) Vertex(context.Context, *Constraints) Vertex {
@@ -560,7 +561,7 @@ func (fn constraintsOptFunc) SetGitOption(gi *GitInfo) {
gi.applyConstraints(fn)
}
func mergeMetadata(m1, m2 pb.OpMetadata) pb.OpMetadata {
func mergeMetadata(m1, m2 OpMetadata) OpMetadata {
if m2.IgnoreCache {
m1.IgnoreCache = true
}
@@ -654,12 +655,60 @@ func (cw *constraintsWrapper) applyConstraints(f func(c *Constraints)) {
type Constraints struct {
Platform *ocispecs.Platform
WorkerConstraints []string
Metadata pb.OpMetadata
Metadata OpMetadata
LocalUniqueID string
Caps *apicaps.CapSet
SourceLocations []*SourceLocation
}
// OpMetadata has a more friendly interface for pb.OpMetadata.
type OpMetadata struct {
IgnoreCache bool `json:"ignore_cache,omitempty"`
Description map[string]string `json:"description,omitempty"`
ExportCache *pb.ExportCache `json:"export_cache,omitempty"`
Caps map[apicaps.CapID]bool `json:"caps,omitempty"`
ProgressGroup *pb.ProgressGroup `json:"progress_group,omitempty"`
}
func NewOpMetadata(mpb *pb.OpMetadata) OpMetadata {
var m OpMetadata
m.FromPB(mpb)
return m
}
func (m OpMetadata) ToPB() *pb.OpMetadata {
caps := make(map[string]bool, len(m.Caps))
for k, v := range m.Caps {
caps[string(k)] = v
}
return &pb.OpMetadata{
IgnoreCache: m.IgnoreCache,
Description: m.Description,
ExportCache: m.ExportCache,
Caps: caps,
ProgressGroup: m.ProgressGroup,
}
}
func (m *OpMetadata) FromPB(mpb *pb.OpMetadata) {
if mpb == nil {
return
}
m.IgnoreCache = mpb.IgnoreCache
m.Description = mpb.Description
m.ExportCache = mpb.ExportCache
if len(mpb.Caps) > 0 {
m.Caps = make(map[apicaps.CapID]bool, len(mpb.Caps))
for k, v := range mpb.Caps {
m.Caps[apicaps.CapID(k)] = v
}
} else {
m.Caps = nil
}
m.ProgressGroup = mpb.ProgressGroup
}
func Platform(p ocispecs.Platform) ConstraintsOpt {
return constraintsOptFunc(func(c *Constraints) {
c.Platform = &p

View File

@@ -18,7 +18,9 @@ func (c *Client) Prune(ctx context.Context, ch chan UsageInfo, opts ...PruneOpti
req := &controlapi.PruneRequest{
Filter: info.Filter,
KeepDuration: int64(info.KeepDuration),
KeepBytes: int64(info.KeepBytes),
MinStorage: int64(info.MinStorage),
MaxStorage: int64(info.MaxStorage),
Free: int64(info.Free),
}
if info.All {
req.All = true
@@ -41,14 +43,20 @@ func (c *Client) Prune(ctx context.Context, ch chan UsageInfo, opts ...PruneOpti
ID: d.ID,
Mutable: d.Mutable,
InUse: d.InUse,
Size: d.Size_,
Size: d.Size,
Parents: d.Parents,
CreatedAt: d.CreatedAt,
CreatedAt: d.CreatedAt.AsTime(),
Description: d.Description,
UsageCount: int(d.UsageCount),
LastUsedAt: d.LastUsedAt,
RecordType: UsageRecordType(d.RecordType),
Shared: d.Shared,
LastUsedAt: func() *time.Time {
if d.LastUsedAt != nil {
ts := d.LastUsedAt.AsTime()
return &ts
}
return nil
}(),
RecordType: UsageRecordType(d.RecordType),
Shared: d.Shared,
}
}
}
@@ -59,10 +67,13 @@ type PruneOption interface {
}
type PruneInfo struct {
Filter []string `json:"filter"`
All bool `json:"all"`
Filter []string `json:"filter"`
KeepDuration time.Duration `json:"keepDuration"`
KeepBytes int64 `json:"keepBytes"`
MinStorage int64 `json:"minStorage"`
MaxStorage int64 `json:"maxStorage"`
Free int64 `json:"free"`
}
type pruneOptionFunc func(*PruneInfo)
@@ -75,9 +86,11 @@ var PruneAll = pruneOptionFunc(func(pi *PruneInfo) {
pi.All = true
})
func WithKeepOpt(duration time.Duration, bytes int64) PruneOption {
func WithKeepOpt(duration time.Duration, minStorage int64, maxStorage int64, free int64) PruneOption {
return pruneOptionFunc(func(pi *PruneInfo) {
pi.KeepDuration = duration
pi.KeepBytes = bytes
pi.MinStorage = minStorage
pi.MaxStorage = maxStorage
pi.Free = free
})
}

View File

@@ -31,6 +31,7 @@ import (
fstypes "github.com/tonistiigi/fsutil/types"
"go.opentelemetry.io/otel/trace"
"golang.org/x/sync/errgroup"
"google.golang.org/protobuf/proto"
)
type SolveOpt struct {
@@ -276,8 +277,8 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
Frontend: opt.Frontend,
FrontendAttrs: frontendAttrs,
FrontendInputs: frontendInputs,
Cache: cacheOpt.options,
Entitlements: opt.AllowedEntitlements,
Cache: &cacheOpt.options,
Entitlements: entitlementsToPB(opt.AllowedEntitlements),
Internal: opt.Internal,
SourcePolicy: opt.SourcePolicy,
})
@@ -394,7 +395,7 @@ func prepareSyncedFiles(def *llb.Definition, localMounts map[string]fsutil.FS) (
} else {
for _, dt := range def.Def {
var op pb.Op
if err := (&op).Unmarshal(dt); err != nil {
if err := proto.Unmarshal(dt, &op); err != nil {
return nil, errors.Wrap(err, "failed to parse llb proto op")
}
if src := op.GetSource(); src != nil {
@@ -549,3 +550,11 @@ func prepareMounts(opt *SolveOpt) (map[string]fsutil.FS, error) {
}
return mounts, nil
}
func entitlementsToPB(entitlements []entitlements.Entitlement) []string {
clone := make([]string, len(entitlements))
for i, e := range entitlements {
clone[i] = string(e)
}
return clone
}

View File

@@ -1,25 +1,30 @@
package client
import (
"time"
controlapi "github.com/moby/buildkit/api/services/control"
digest "github.com/opencontainers/go-digest"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/timestamppb"
)
var emptyLogVertexSize int
func init() {
emptyLogVertex := controlapi.VertexLog{}
emptyLogVertexSize = emptyLogVertex.Size()
emptyLogVertexSize = proto.Size(&emptyLogVertex)
}
func NewSolveStatus(resp *controlapi.StatusResponse) *SolveStatus {
s := &SolveStatus{}
for _, v := range resp.Vertexes {
s.Vertexes = append(s.Vertexes, &Vertex{
Digest: v.Digest,
Inputs: v.Inputs,
Digest: digest.Digest(v.Digest),
Inputs: digestSliceFromPB(v.Inputs),
Name: v.Name,
Started: v.Started,
Completed: v.Completed,
Started: timestampFromPB(v.Started),
Completed: timestampFromPB(v.Completed),
Error: v.Error,
Cached: v.Cached,
ProgressGroup: v.ProgressGroup,
@@ -28,26 +33,26 @@ func NewSolveStatus(resp *controlapi.StatusResponse) *SolveStatus {
for _, v := range resp.Statuses {
s.Statuses = append(s.Statuses, &VertexStatus{
ID: v.ID,
Vertex: v.Vertex,
Vertex: digest.Digest(v.Vertex),
Name: v.Name,
Total: v.Total,
Current: v.Current,
Timestamp: v.Timestamp,
Started: v.Started,
Completed: v.Completed,
Timestamp: v.Timestamp.AsTime(),
Started: timestampFromPB(v.Started),
Completed: timestampFromPB(v.Completed),
})
}
for _, v := range resp.Logs {
s.Logs = append(s.Logs, &VertexLog{
Vertex: v.Vertex,
Vertex: digest.Digest(v.Vertex),
Stream: int(v.Stream),
Data: v.Msg,
Timestamp: v.Timestamp,
Timestamp: v.Timestamp.AsTime(),
})
}
for _, v := range resp.Warnings {
s.Warnings = append(s.Warnings, &VertexWarning{
Vertex: v.Vertex,
Vertex: digest.Digest(v.Vertex),
Level: int(v.Level),
Short: v.Short,
Detail: v.Detail,
@@ -66,11 +71,11 @@ func (ss *SolveStatus) Marshal() (out []*controlapi.StatusResponse) {
sr := controlapi.StatusResponse{}
for _, v := range ss.Vertexes {
sr.Vertexes = append(sr.Vertexes, &controlapi.Vertex{
Digest: v.Digest,
Inputs: v.Inputs,
Digest: string(v.Digest),
Inputs: digestSliceToPB(v.Inputs),
Name: v.Name,
Started: v.Started,
Completed: v.Completed,
Started: timestampToPB(v.Started),
Completed: timestampToPB(v.Completed),
Error: v.Error,
Cached: v.Cached,
ProgressGroup: v.ProgressGroup,
@@ -79,21 +84,21 @@ func (ss *SolveStatus) Marshal() (out []*controlapi.StatusResponse) {
for _, v := range ss.Statuses {
sr.Statuses = append(sr.Statuses, &controlapi.VertexStatus{
ID: v.ID,
Vertex: v.Vertex,
Vertex: string(v.Vertex),
Name: v.Name,
Current: v.Current,
Total: v.Total,
Timestamp: v.Timestamp,
Started: v.Started,
Completed: v.Completed,
Timestamp: timestamppb.New(v.Timestamp),
Started: timestampToPB(v.Started),
Completed: timestampToPB(v.Completed),
})
}
for i, v := range ss.Logs {
sr.Logs = append(sr.Logs, &controlapi.VertexLog{
Vertex: v.Vertex,
Vertex: string(v.Vertex),
Stream: int64(v.Stream),
Msg: v.Data,
Timestamp: v.Timestamp,
Timestamp: timestamppb.New(v.Timestamp),
})
logSize += len(v.Data) + emptyLogVertexSize
// avoid logs growing big and split apart if they do
@@ -107,7 +112,7 @@ func (ss *SolveStatus) Marshal() (out []*controlapi.StatusResponse) {
}
for _, v := range ss.Warnings {
sr.Warnings = append(sr.Warnings, &controlapi.VertexWarning{
Vertex: v.Vertex,
Vertex: string(v.Vertex),
Level: int64(v.Level),
Short: v.Short,
Detail: v.Detail,
@@ -123,3 +128,34 @@ func (ss *SolveStatus) Marshal() (out []*controlapi.StatusResponse) {
}
return
}
func digestSliceFromPB(elems []string) []digest.Digest {
clone := make([]digest.Digest, len(elems))
for i, e := range elems {
clone[i] = digest.Digest(e)
}
return clone
}
func digestSliceToPB(elems []digest.Digest) []string {
clone := make([]string, len(elems))
for i, e := range elems {
clone[i] = string(e)
}
return clone
}
func timestampFromPB(ts *timestamppb.Timestamp) *time.Time {
if ts != nil {
t := ts.AsTime()
return &t
}
return nil
}
func timestampToPB(ts *time.Time) *timestamppb.Timestamp {
if ts != nil {
return timestamppb.New(*ts)
}
return nil
}

View File

@@ -65,7 +65,9 @@ func fromAPIGCPolicy(in []*apitypes.GCPolicy) []PruneInfo {
All: p.All,
Filter: p.Filters,
KeepDuration: time.Duration(p.KeepDuration),
KeepBytes: p.KeepBytes,
MinStorage: p.MinStorage,
MaxStorage: p.MaxStorage,
Free: p.Free,
})
}
return out

View File

@@ -154,10 +154,29 @@ type ContainerdRuntime struct {
}
type GCPolicy struct {
All bool `toml:"all"`
KeepBytes DiskSpace `toml:"keepBytes"`
KeepDuration Duration `toml:"keepDuration"`
Filters []string `toml:"filters"`
All bool `toml:"all"`
Filters []string `toml:"filters"`
KeepDuration Duration `toml:"keepDuration"`
// KeepBytes is the maximum amount of storage this policy is ever allowed
// to consume. Any storage above this mark can be cleared during a gc
// sweep.
//
// Deprecated: use MaxStorage instead
KeepBytes DiskSpace `toml:"keepBytes"`
// MinStorage is the minimum amount of storage this policy is always
// allowed to consume. Any amount of storage below this mark will not be
// cleared by this policy.
MinStorage DiskSpace `toml:"minStorage"`
// MaxStorage is the maximum amount of storage this policy is ever allowed
// to consume. Any storage above this mark can be cleared during a gc
// sweep.
MaxStorage DiskSpace `toml:"maxStorage"`
// Free is the amount of storage the gc will attempt to leave free on the
// disk. However, it will never attempt to bring it below MinStorage.
Free DiskSpace `toml:"free"`
}
type DNSConfig struct {

View File

@@ -8,6 +8,7 @@ import (
"github.com/docker/go-units"
"github.com/moby/buildkit/util/bklog"
"github.com/moby/buildkit/util/disk"
"github.com/pkg/errors"
)
@@ -77,21 +78,21 @@ func DefaultGCPolicy(keep DiskSpace) []GCPolicy {
{
Filters: []string{"type==source.local,type==exec.cachemount,type==source.git.checkout"},
KeepDuration: Duration{Duration: time.Duration(48) * time.Hour}, // 48h
KeepBytes: DiskSpace{Bytes: 512 * 1e6}, // 512MB
MaxStorage: DiskSpace{Bytes: 512 * 1e6}, // 512MB
},
// remove any data not used for 60 days
{
KeepDuration: Duration{Duration: time.Duration(60) * 24 * time.Hour}, // 60d
KeepBytes: keep,
MaxStorage: keep,
},
// keep the unshared build cache under cap
{
KeepBytes: keep,
MaxStorage: keep,
},
// if previous policies were insufficient start deleting internal data to keep build cache under cap
{
All: true,
KeepBytes: keep,
All: true,
MaxStorage: keep,
},
}
}
@@ -118,12 +119,12 @@ func (d DiskSpace) AsBytes(root string) int64 {
return 0
}
diskSize, err := getDiskSize(root)
dstat, err := disk.GetDiskStat(root)
if err != nil {
bklog.L.Warnf("failed to get disk size: %v", err)
return defaultCap
}
avail := diskSize * d.Percentage / 100
avail := dstat.Total * d.Percentage / 100
rounded := (avail/(1<<30) + 1) * 1e9 // round up
return rounded
}

View File

@@ -1,19 +0,0 @@
//go:build openbsd
// +build openbsd
package config
import (
"syscall"
)
var DiskSpacePercentage int64 = 10
func getDiskSize(root string) (int64, error) {
var st syscall.Statfs_t
if err := syscall.Statfs(root, &st); err != nil {
return 0, err
}
diskSize := int64(st.F_bsize) * int64(st.F_blocks)
return diskSize, nil
}

View File

@@ -1,19 +1,6 @@
//go:build !windows && !openbsd
// +build !windows,!openbsd
//go:build !windows
// +build !windows
package config
import (
"syscall"
)
var DiskSpacePercentage int64 = 10
func getDiskSize(root string) (int64, error) {
var st syscall.Statfs_t
if err := syscall.Statfs(root, &st); err != nil {
return 0, err
}
diskSize := int64(st.Bsize) * int64(st.Blocks)
return diskSize, nil
}

View File

@@ -3,29 +3,6 @@
package config
import (
"golang.org/x/sys/windows"
)
// set as double that for Linux since
// Windows images are generally larger.
var DiskSpacePercentage int64 = 20
func getDiskSize(root string) (int64, error) {
rootUTF16, err := windows.UTF16FromString(root)
if err != nil {
return 0, err
}
var freeAvailableBytes uint64
var totalBytes uint64
var totalFreeBytes uint64
if err := windows.GetDiskFreeSpaceEx(
&rootUTF16[0],
&freeAvailableBytes,
&totalBytes,
&totalFreeBytes); err != nil {
return 0, err
}
return int64(totalBytes), nil
}

View File

@@ -74,11 +74,11 @@ func parseShmSize(v string) (int64, error) {
return kb, nil
}
func parseUlimits(v string) ([]pb.Ulimit, error) {
func parseUlimits(v string) ([]*pb.Ulimit, error) {
if v == "" {
return nil, nil
}
out := make([]pb.Ulimit, 0)
out := make([]*pb.Ulimit, 0)
fields, err := csvvalue.Fields(v, nil)
if err != nil {
return nil, err
@@ -88,7 +88,7 @@ func parseUlimits(v string) ([]pb.Ulimit, error) {
if err != nil {
return nil, err
}
out = append(out, pb.Ulimit{
out = append(out, &pb.Ulimit{
Name: ulimit.Name,
Soft: ulimit.Soft,
Hard: ulimit.Hard,

View File

@@ -66,7 +66,7 @@ type Config struct {
NetworkMode pb.NetMode
ShmSize int64
Target string
Ulimits []pb.Ulimit
Ulimits []*pb.Ulimit
LinterConfig *linter.Config
CacheImports []client.CacheOptionsEntry
@@ -222,7 +222,7 @@ func (bc *Client) init() error {
var cacheImports []client.CacheOptionsEntry
// new API
if cacheImportsStr := opts[keyCacheImports]; cacheImportsStr != "" {
var cacheImportsUM []controlapi.CacheOptionsEntry
var cacheImportsUM []*controlapi.CacheOptionsEntry
if err := json.Unmarshal([]byte(cacheImportsStr), &cacheImportsUM); err != nil {
return errors.Wrapf(err, "failed to unmarshal %s (%q)", keyCacheImports, cacheImportsStr)
}

View File

@@ -3,6 +3,7 @@ package client
import (
pb "github.com/moby/buildkit/frontend/gateway/pb"
"github.com/moby/buildkit/solver/result"
digest "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
)
@@ -16,7 +17,7 @@ func AttestationToPB[T any](a *result.Attestation[T]) (*pb.Attestation, error) {
subjects[i] = &pb.InTotoSubject{
Kind: subject.Kind,
Name: subject.Name,
Digest: subject.Digest,
Digest: digestSliceToPB(subject.Digest),
}
}
@@ -41,7 +42,7 @@ func AttestationFromPB[T any](a *pb.Attestation) (*result.Attestation[T], error)
subjects[i] = result.InTotoSubject{
Kind: subject.Kind,
Name: subject.Name,
Digest: subject.Digest,
Digest: digestSliceFromPB(subject.Digest),
}
}
@@ -55,3 +56,19 @@ func AttestationFromPB[T any](a *pb.Attestation) (*result.Attestation[T], error)
},
}, nil
}
func digestSliceToPB(elems []digest.Digest) []string {
clone := make([]string, len(elems))
for i, e := range elems {
clone[i] = string(e)
}
return clone
}
func digestSliceFromPB(elems []string) []digest.Digest {
clone := make([]digest.Digest, len(elems))
for i, e := range elems {
clone[i] = digest.Digest(e)
}
return clone
}

View File

@@ -13,9 +13,6 @@ import (
"time"
distreference "github.com/distribution/reference"
"github.com/gogo/googleapis/google/rpc"
gogotypes "github.com/gogo/protobuf/types"
"github.com/golang/protobuf/ptypes/any"
"github.com/moby/buildkit/client/llb"
"github.com/moby/buildkit/client/llb/sourceresolver"
"github.com/moby/buildkit/frontend/gateway/client"
@@ -36,6 +33,7 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
const frontendPrefix = "BUILDKIT_FRONTEND_OPT_"
@@ -196,10 +194,10 @@ func (c *grpcClient) Run(ctx context.Context, f client.BuildFunc) (retError erro
if retError != nil {
st, _ := status.FromError(grpcerrors.ToGRPC(ctx, retError))
stp := st.Proto()
req.Error = &rpc.Status{
req.Error = &spb.Status{
Code: stp.Code,
Message: stp.Message,
Details: convertToGogoAny(stp.Details),
Details: stp.Details,
}
}
if _, err := c.client.Return(ctx, req); err != nil && retError == nil {
@@ -251,8 +249,8 @@ func (c *grpcClient) Run(ctx context.Context, f client.BuildFunc) (retError erro
// defaultCaps returns the capabilities that were implemented when capabilities
// support was added. This list is frozen and should never be changed.
func defaultCaps() []apicaps.PBCap {
return []apicaps.PBCap{
func defaultCaps() []*apicaps.PBCap {
return []*apicaps.PBCap{
{ID: string(pb.CapSolveBase), Enabled: true},
{ID: string(pb.CapSolveInlineReturn), Enabled: true},
{ID: string(pb.CapResolveImage), Enabled: true},
@@ -262,8 +260,8 @@ func defaultCaps() []apicaps.PBCap {
// defaultLLBCaps returns the LLB capabilities that were implemented when capabilities
// support was added. This list is frozen and should never be changed.
func defaultLLBCaps() []apicaps.PBCap {
return []apicaps.PBCap{
func defaultLLBCaps() []*apicaps.PBCap {
return []*apicaps.PBCap{
{ID: string(opspb.CapSourceImage), Enabled: true},
{ID: string(opspb.CapSourceLocal), Enabled: true},
{ID: string(opspb.CapSourceLocalUnique), Enabled: true},
@@ -331,7 +329,7 @@ func (c *grpcClient) requestForRef(ref client.Reference) (*pb.SolveRequest, erro
func (c *grpcClient) Warn(ctx context.Context, dgst digest.Digest, msg string, opts client.WarnOpts) error {
_, err := c.client.Warn(ctx, &pb.WarnRequest{
Digest: dgst,
Digest: string(dgst),
Level: int64(opts.Level),
Short: []byte(msg),
Info: opts.SourceInfo,
@@ -346,7 +344,7 @@ func (c *grpcClient) Solve(ctx context.Context, creq client.SolveRequest) (res *
if creq.Definition != nil {
for _, md := range creq.Definition.Metadata {
for cap := range md.Caps {
if err := c.llbCaps.Supports(cap); err != nil {
if err := c.llbCaps.Supports(apicaps.CapID(cap)); err != nil {
return nil, err
}
}
@@ -538,7 +536,7 @@ func (c *grpcClient) ResolveSourceMetadata(ctx context.Context, op *opspb.Source
}
if resp.Image != nil {
r.Image = &sourceresolver.ResolveImageResponse{
Digest: resp.Image.Digest,
Digest: digest.Digest(resp.Image.Digest),
Config: resp.Image.Config,
}
}
@@ -576,7 +574,7 @@ func (c *grpcClient) resolveImageConfigViaSourceMetadata(ctx context.Context, re
}
ref = strings.TrimPrefix(resp.Source.Identifier, "docker-image://")
ref = strings.TrimPrefix(ref, "oci-layout://")
return ref, resp.Image.Digest, resp.Image.Config, nil
return ref, digest.Digest(resp.Image.Digest), resp.Image.Config, nil
}
func (c *grpcClient) ResolveImageConfig(ctx context.Context, ref string, opt sourceresolver.Opt) (string, digest.Digest, []byte, error) {
@@ -622,7 +620,7 @@ func (c *grpcClient) ResolveImageConfig(ctx context.Context, ref string, opt sou
// This could occur if the version of buildkitd is too old.
newRef = ref
}
return newRef, resp.Digest, resp.Config, nil
return newRef, digest.Digest(resp.Digest), resp.Config, nil
}
func (c *grpcClient) BuildOpts() client.BuildOpts {
@@ -646,7 +644,7 @@ func (c *grpcClient) CurrentFrontend() (*llb.State, error) {
return nil, err
}
var def opspb.Definition
if err := def.Unmarshal(dt); err != nil {
if err := proto.Unmarshal(dt, &def); err != nil {
return nil, err
}
op, err := llb.NewDefinitionOp(&def)
@@ -1095,7 +1093,7 @@ func (ctr *container) Start(ctx context.Context, req client.StartRequest) (clien
exitError = grpcerrors.FromGRPC(status.ErrorProto(&spb.Status{
Code: exit.Error.Code,
Message: exit.Error.Message,
Details: convertGogoAny(exit.Error.Details),
Details: exit.Error.Details,
}))
if exit.Code != pb.UnknownExitStatus {
exitError = &pb.ExitError{ExitCode: exit.Code, Err: exitError}
@@ -1260,6 +1258,7 @@ func grpcClientConn(ctx context.Context) (context.Context, *grpc.ClientConn, err
grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(16 << 20)),
}
//nolint:staticcheck // ignore SA1019 NewClient has different behavior and needs to be tested
cc, err := grpc.DialContext(ctx, "localhost", dialOpts...)
if err != nil {
return ctx, nil, errors.Wrap(err, "failed to create grpc client")
@@ -1285,21 +1284,24 @@ type conn struct {
func (s *conn) LocalAddr() net.Addr {
return dummyAddr{}
}
func (s *conn) RemoteAddr() net.Addr {
return dummyAddr{}
}
func (s *conn) SetDeadline(t time.Time) error {
return nil
}
func (s *conn) SetReadDeadline(t time.Time) error {
return nil
}
func (s *conn) SetWriteDeadline(t time.Time) error {
return nil
}
type dummyAddr struct {
}
type dummyAddr struct{}
func (d dummyAddr) Network() string {
return "pipe"
@@ -1346,19 +1348,3 @@ func workers() []client.WorkerInfo {
func product() string {
return os.Getenv("BUILDKIT_EXPORTEDPRODUCT")
}
func convertGogoAny(in []*gogotypes.Any) []*any.Any {
out := make([]*any.Any, len(in))
for i := range in {
out[i] = &any.Any{TypeUrl: in[i].TypeUrl, Value: in[i].Value}
}
return out
}
func convertToGogoAny(in []*any.Any) []*gogotypes.Any {
out := make([]*gogotypes.Any, len(in))
for i := range in {
out[i] = &gogotypes.Any{TypeUrl: in[i].TypeUrl, Value: in[i].Value}
}
return out
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,17 +2,14 @@ syntax = "proto3";
package moby.buildkit.v1.frontend;
import "github.com/gogo/googleapis/google/rpc/status.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option go_package = "github.com/moby/buildkit/frontend/gateway/pb;moby_buildkit_v1_frontend";
import "github.com/moby/buildkit/api/types/worker.proto";
import "github.com/moby/buildkit/solver/pb/ops.proto";
import "github.com/moby/buildkit/sourcepolicy/pb/policy.proto";
import "github.com/moby/buildkit/util/apicaps/pb/caps.proto";
import "github.com/tonistiigi/fsutil/types/stat.proto";
option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
import "google/rpc/status.proto";
service LLBBridge {
// apicaps:CapResolveImage
@@ -84,22 +81,20 @@ message Attestation {
}
enum AttestationKind {
option (gogoproto.goproto_enum_prefix) = false;
InToto = 0 [(gogoproto.enumvalue_customname) = "AttestationKindInToto"];
Bundle = 1 [(gogoproto.enumvalue_customname) = "AttestationKindBundle"];
InToto = 0;
Bundle = 1;
}
message InTotoSubject {
InTotoSubjectKind kind = 1;
repeated string digest = 2 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
repeated string digest = 2;
string name = 3;
}
enum InTotoSubjectKind {
option (gogoproto.goproto_enum_prefix) = false;
Self = 0 [(gogoproto.enumvalue_customname) = "InTotoSubjectKindSelf"];
Raw = 1 [(gogoproto.enumvalue_customname) = "InTotoSubjectKindRaw"];
Self = 0;
Raw = 1;
}
message ReturnRequest {
@@ -129,7 +124,7 @@ message ResolveImageConfigRequest {
}
message ResolveImageConfigResponse {
string Digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
string Digest = 1;
bytes Config = 2;
string Ref = 3;
}
@@ -148,7 +143,7 @@ message ResolveSourceMetaResponse {
}
message ResolveSourceImageResponse {
string Digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
string Digest = 1;
bytes Config = 2;
}
@@ -235,13 +230,13 @@ message EvaluateResponse {
message PingRequest{
}
message PongResponse{
repeated moby.buildkit.v1.apicaps.APICap FrontendAPICaps = 1 [(gogoproto.nullable) = false];
repeated moby.buildkit.v1.apicaps.APICap LLBCaps = 2 [(gogoproto.nullable) = false];
repeated moby.buildkit.v1.apicaps.APICap FrontendAPICaps = 1;
repeated moby.buildkit.v1.apicaps.APICap LLBCaps = 2;
repeated moby.buildkit.v1.types.WorkerRecord Workers = 3;
}
message WarnRequest {
string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
string digest = 1;
int64 level = 2;
bytes short = 3;
repeated bytes detail = 4;

View File

@@ -0,0 +1,626 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.11.4
// source: gateway.proto
package moby_buildkit_v1_frontend
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
LLBBridge_ResolveImageConfig_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/ResolveImageConfig"
LLBBridge_ResolveSourceMeta_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/ResolveSourceMeta"
LLBBridge_Solve_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/Solve"
LLBBridge_ReadFile_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/ReadFile"
LLBBridge_ReadDir_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/ReadDir"
LLBBridge_StatFile_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/StatFile"
LLBBridge_Evaluate_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/Evaluate"
LLBBridge_Ping_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/Ping"
LLBBridge_Return_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/Return"
LLBBridge_Inputs_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/Inputs"
LLBBridge_NewContainer_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/NewContainer"
LLBBridge_ReleaseContainer_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/ReleaseContainer"
LLBBridge_ExecProcess_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/ExecProcess"
LLBBridge_Warn_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/Warn"
)
// LLBBridgeClient is the client API for LLBBridge service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type LLBBridgeClient interface {
// apicaps:CapResolveImage
ResolveImageConfig(ctx context.Context, in *ResolveImageConfigRequest, opts ...grpc.CallOption) (*ResolveImageConfigResponse, error)
// apicaps:CapSourceMetaResolver
ResolveSourceMeta(ctx context.Context, in *ResolveSourceMetaRequest, opts ...grpc.CallOption) (*ResolveSourceMetaResponse, error)
// apicaps:CapSolveBase
Solve(ctx context.Context, in *SolveRequest, opts ...grpc.CallOption) (*SolveResponse, error)
// apicaps:CapReadFile
ReadFile(ctx context.Context, in *ReadFileRequest, opts ...grpc.CallOption) (*ReadFileResponse, error)
// apicaps:CapReadDir
ReadDir(ctx context.Context, in *ReadDirRequest, opts ...grpc.CallOption) (*ReadDirResponse, error)
// apicaps:CapStatFile
StatFile(ctx context.Context, in *StatFileRequest, opts ...grpc.CallOption) (*StatFileResponse, error)
// apicaps:CapGatewayEvaluate
Evaluate(ctx context.Context, in *EvaluateRequest, opts ...grpc.CallOption) (*EvaluateResponse, error)
Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error)
Return(ctx context.Context, in *ReturnRequest, opts ...grpc.CallOption) (*ReturnResponse, error)
// apicaps:CapFrontendInputs
Inputs(ctx context.Context, in *InputsRequest, opts ...grpc.CallOption) (*InputsResponse, error)
NewContainer(ctx context.Context, in *NewContainerRequest, opts ...grpc.CallOption) (*NewContainerResponse, error)
ReleaseContainer(ctx context.Context, in *ReleaseContainerRequest, opts ...grpc.CallOption) (*ReleaseContainerResponse, error)
ExecProcess(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ExecMessage, ExecMessage], error)
// apicaps:CapGatewayWarnings
Warn(ctx context.Context, in *WarnRequest, opts ...grpc.CallOption) (*WarnResponse, error)
}
type lLBBridgeClient struct {
cc grpc.ClientConnInterface
}
func NewLLBBridgeClient(cc grpc.ClientConnInterface) LLBBridgeClient {
return &lLBBridgeClient{cc}
}
func (c *lLBBridgeClient) ResolveImageConfig(ctx context.Context, in *ResolveImageConfigRequest, opts ...grpc.CallOption) (*ResolveImageConfigResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ResolveImageConfigResponse)
err := c.cc.Invoke(ctx, LLBBridge_ResolveImageConfig_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lLBBridgeClient) ResolveSourceMeta(ctx context.Context, in *ResolveSourceMetaRequest, opts ...grpc.CallOption) (*ResolveSourceMetaResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ResolveSourceMetaResponse)
err := c.cc.Invoke(ctx, LLBBridge_ResolveSourceMeta_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lLBBridgeClient) Solve(ctx context.Context, in *SolveRequest, opts ...grpc.CallOption) (*SolveResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SolveResponse)
err := c.cc.Invoke(ctx, LLBBridge_Solve_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lLBBridgeClient) ReadFile(ctx context.Context, in *ReadFileRequest, opts ...grpc.CallOption) (*ReadFileResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ReadFileResponse)
err := c.cc.Invoke(ctx, LLBBridge_ReadFile_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lLBBridgeClient) ReadDir(ctx context.Context, in *ReadDirRequest, opts ...grpc.CallOption) (*ReadDirResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ReadDirResponse)
err := c.cc.Invoke(ctx, LLBBridge_ReadDir_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lLBBridgeClient) StatFile(ctx context.Context, in *StatFileRequest, opts ...grpc.CallOption) (*StatFileResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatFileResponse)
err := c.cc.Invoke(ctx, LLBBridge_StatFile_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lLBBridgeClient) Evaluate(ctx context.Context, in *EvaluateRequest, opts ...grpc.CallOption) (*EvaluateResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(EvaluateResponse)
err := c.cc.Invoke(ctx, LLBBridge_Evaluate_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lLBBridgeClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PongResponse)
err := c.cc.Invoke(ctx, LLBBridge_Ping_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lLBBridgeClient) Return(ctx context.Context, in *ReturnRequest, opts ...grpc.CallOption) (*ReturnResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ReturnResponse)
err := c.cc.Invoke(ctx, LLBBridge_Return_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lLBBridgeClient) Inputs(ctx context.Context, in *InputsRequest, opts ...grpc.CallOption) (*InputsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(InputsResponse)
err := c.cc.Invoke(ctx, LLBBridge_Inputs_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lLBBridgeClient) NewContainer(ctx context.Context, in *NewContainerRequest, opts ...grpc.CallOption) (*NewContainerResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(NewContainerResponse)
err := c.cc.Invoke(ctx, LLBBridge_NewContainer_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lLBBridgeClient) ReleaseContainer(ctx context.Context, in *ReleaseContainerRequest, opts ...grpc.CallOption) (*ReleaseContainerResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ReleaseContainerResponse)
err := c.cc.Invoke(ctx, LLBBridge_ReleaseContainer_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *lLBBridgeClient) ExecProcess(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ExecMessage, ExecMessage], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &LLBBridge_ServiceDesc.Streams[0], LLBBridge_ExecProcess_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[ExecMessage, ExecMessage]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type LLBBridge_ExecProcessClient = grpc.BidiStreamingClient[ExecMessage, ExecMessage]
func (c *lLBBridgeClient) Warn(ctx context.Context, in *WarnRequest, opts ...grpc.CallOption) (*WarnResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(WarnResponse)
err := c.cc.Invoke(ctx, LLBBridge_Warn_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// LLBBridgeServer is the server API for LLBBridge service.
// All implementations should embed UnimplementedLLBBridgeServer
// for forward compatibility.
type LLBBridgeServer interface {
// apicaps:CapResolveImage
ResolveImageConfig(context.Context, *ResolveImageConfigRequest) (*ResolveImageConfigResponse, error)
// apicaps:CapSourceMetaResolver
ResolveSourceMeta(context.Context, *ResolveSourceMetaRequest) (*ResolveSourceMetaResponse, error)
// apicaps:CapSolveBase
Solve(context.Context, *SolveRequest) (*SolveResponse, error)
// apicaps:CapReadFile
ReadFile(context.Context, *ReadFileRequest) (*ReadFileResponse, error)
// apicaps:CapReadDir
ReadDir(context.Context, *ReadDirRequest) (*ReadDirResponse, error)
// apicaps:CapStatFile
StatFile(context.Context, *StatFileRequest) (*StatFileResponse, error)
// apicaps:CapGatewayEvaluate
Evaluate(context.Context, *EvaluateRequest) (*EvaluateResponse, error)
Ping(context.Context, *PingRequest) (*PongResponse, error)
Return(context.Context, *ReturnRequest) (*ReturnResponse, error)
// apicaps:CapFrontendInputs
Inputs(context.Context, *InputsRequest) (*InputsResponse, error)
NewContainer(context.Context, *NewContainerRequest) (*NewContainerResponse, error)
ReleaseContainer(context.Context, *ReleaseContainerRequest) (*ReleaseContainerResponse, error)
ExecProcess(grpc.BidiStreamingServer[ExecMessage, ExecMessage]) error
// apicaps:CapGatewayWarnings
Warn(context.Context, *WarnRequest) (*WarnResponse, error)
}
// UnimplementedLLBBridgeServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedLLBBridgeServer struct{}
func (UnimplementedLLBBridgeServer) ResolveImageConfig(context.Context, *ResolveImageConfigRequest) (*ResolveImageConfigResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ResolveImageConfig not implemented")
}
func (UnimplementedLLBBridgeServer) ResolveSourceMeta(context.Context, *ResolveSourceMetaRequest) (*ResolveSourceMetaResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ResolveSourceMeta not implemented")
}
func (UnimplementedLLBBridgeServer) Solve(context.Context, *SolveRequest) (*SolveResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Solve not implemented")
}
func (UnimplementedLLBBridgeServer) ReadFile(context.Context, *ReadFileRequest) (*ReadFileResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReadFile not implemented")
}
func (UnimplementedLLBBridgeServer) ReadDir(context.Context, *ReadDirRequest) (*ReadDirResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReadDir not implemented")
}
func (UnimplementedLLBBridgeServer) StatFile(context.Context, *StatFileRequest) (*StatFileResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method StatFile not implemented")
}
func (UnimplementedLLBBridgeServer) Evaluate(context.Context, *EvaluateRequest) (*EvaluateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Evaluate not implemented")
}
func (UnimplementedLLBBridgeServer) Ping(context.Context, *PingRequest) (*PongResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedLLBBridgeServer) Return(context.Context, *ReturnRequest) (*ReturnResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Return not implemented")
}
func (UnimplementedLLBBridgeServer) Inputs(context.Context, *InputsRequest) (*InputsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Inputs not implemented")
}
func (UnimplementedLLBBridgeServer) NewContainer(context.Context, *NewContainerRequest) (*NewContainerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NewContainer not implemented")
}
func (UnimplementedLLBBridgeServer) ReleaseContainer(context.Context, *ReleaseContainerRequest) (*ReleaseContainerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReleaseContainer not implemented")
}
func (UnimplementedLLBBridgeServer) ExecProcess(grpc.BidiStreamingServer[ExecMessage, ExecMessage]) error {
return status.Errorf(codes.Unimplemented, "method ExecProcess not implemented")
}
func (UnimplementedLLBBridgeServer) Warn(context.Context, *WarnRequest) (*WarnResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Warn not implemented")
}
func (UnimplementedLLBBridgeServer) testEmbeddedByValue() {}
// UnsafeLLBBridgeServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to LLBBridgeServer will
// result in compilation errors.
type UnsafeLLBBridgeServer interface {
mustEmbedUnimplementedLLBBridgeServer()
}
func RegisterLLBBridgeServer(s grpc.ServiceRegistrar, srv LLBBridgeServer) {
// If the following call pancis, it indicates UnimplementedLLBBridgeServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&LLBBridge_ServiceDesc, srv)
}
func _LLBBridge_ResolveImageConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ResolveImageConfigRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LLBBridgeServer).ResolveImageConfig(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LLBBridge_ResolveImageConfig_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LLBBridgeServer).ResolveImageConfig(ctx, req.(*ResolveImageConfigRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LLBBridge_ResolveSourceMeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ResolveSourceMetaRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LLBBridgeServer).ResolveSourceMeta(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LLBBridge_ResolveSourceMeta_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LLBBridgeServer).ResolveSourceMeta(ctx, req.(*ResolveSourceMetaRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LLBBridge_Solve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SolveRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LLBBridgeServer).Solve(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LLBBridge_Solve_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LLBBridgeServer).Solve(ctx, req.(*SolveRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LLBBridge_ReadFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReadFileRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LLBBridgeServer).ReadFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LLBBridge_ReadFile_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LLBBridgeServer).ReadFile(ctx, req.(*ReadFileRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LLBBridge_ReadDir_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReadDirRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LLBBridgeServer).ReadDir(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LLBBridge_ReadDir_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LLBBridgeServer).ReadDir(ctx, req.(*ReadDirRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LLBBridge_StatFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StatFileRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LLBBridgeServer).StatFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LLBBridge_StatFile_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LLBBridgeServer).StatFile(ctx, req.(*StatFileRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LLBBridge_Evaluate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EvaluateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LLBBridgeServer).Evaluate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LLBBridge_Evaluate_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LLBBridgeServer).Evaluate(ctx, req.(*EvaluateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LLBBridge_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PingRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LLBBridgeServer).Ping(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LLBBridge_Ping_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LLBBridgeServer).Ping(ctx, req.(*PingRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LLBBridge_Return_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReturnRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LLBBridgeServer).Return(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LLBBridge_Return_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LLBBridgeServer).Return(ctx, req.(*ReturnRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LLBBridge_Inputs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(InputsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LLBBridgeServer).Inputs(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LLBBridge_Inputs_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LLBBridgeServer).Inputs(ctx, req.(*InputsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LLBBridge_NewContainer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(NewContainerRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LLBBridgeServer).NewContainer(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LLBBridge_NewContainer_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LLBBridgeServer).NewContainer(ctx, req.(*NewContainerRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LLBBridge_ReleaseContainer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReleaseContainerRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LLBBridgeServer).ReleaseContainer(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LLBBridge_ReleaseContainer_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LLBBridgeServer).ReleaseContainer(ctx, req.(*ReleaseContainerRequest))
}
return interceptor(ctx, in, info, handler)
}
func _LLBBridge_ExecProcess_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(LLBBridgeServer).ExecProcess(&grpc.GenericServerStream[ExecMessage, ExecMessage]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type LLBBridge_ExecProcessServer = grpc.BidiStreamingServer[ExecMessage, ExecMessage]
func _LLBBridge_Warn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(WarnRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(LLBBridgeServer).Warn(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: LLBBridge_Warn_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(LLBBridgeServer).Warn(ctx, req.(*WarnRequest))
}
return interceptor(ctx, in, info, handler)
}
// LLBBridge_ServiceDesc is the grpc.ServiceDesc for LLBBridge service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var LLBBridge_ServiceDesc = grpc.ServiceDesc{
ServiceName: "moby.buildkit.v1.frontend.LLBBridge",
HandlerType: (*LLBBridgeServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ResolveImageConfig",
Handler: _LLBBridge_ResolveImageConfig_Handler,
},
{
MethodName: "ResolveSourceMeta",
Handler: _LLBBridge_ResolveSourceMeta_Handler,
},
{
MethodName: "Solve",
Handler: _LLBBridge_Solve_Handler,
},
{
MethodName: "ReadFile",
Handler: _LLBBridge_ReadFile_Handler,
},
{
MethodName: "ReadDir",
Handler: _LLBBridge_ReadDir_Handler,
},
{
MethodName: "StatFile",
Handler: _LLBBridge_StatFile_Handler,
},
{
MethodName: "Evaluate",
Handler: _LLBBridge_Evaluate_Handler,
},
{
MethodName: "Ping",
Handler: _LLBBridge_Ping_Handler,
},
{
MethodName: "Return",
Handler: _LLBBridge_Return_Handler,
},
{
MethodName: "Inputs",
Handler: _LLBBridge_Inputs_Handler,
},
{
MethodName: "NewContainer",
Handler: _LLBBridge_NewContainer_Handler,
},
{
MethodName: "ReleaseContainer",
Handler: _LLBBridge_ReleaseContainer_Handler,
},
{
MethodName: "Warn",
Handler: _LLBBridge_Warn_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "ExecProcess",
Handler: _LLBBridge_ExecProcess_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "gateway.proto",
}

View File

@@ -1,3 +1,3 @@
package moby_buildkit_v1_frontend //nolint:revive
//go:generate protoc -I=. -I=../../../vendor/ -I=../../../../../../ --gogo_out=plugins=grpc:. gateway.proto
//go:generate protoc -I=. -I=../../../vendor/ -I=../../../../../../ --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative,require_unimplemented_servers=false:. gateway.proto

View File

@@ -34,11 +34,11 @@ var SubrequestLintDefinition = subrequests.Request{
}
type Warning struct {
RuleName string `json:"ruleName"`
Description string `json:"description,omitempty"`
URL string `json:"url,omitempty"`
Detail string `json:"detail,omitempty"`
Location pb.Location `json:"location,omitempty"`
RuleName string `json:"ruleName"`
Description string `json:"description,omitempty"`
URL string `json:"url,omitempty"`
Detail string `json:"detail,omitempty"`
Location *pb.Location `json:"location,omitempty"`
}
func (w *Warning) PrintTo(wr io.Writer, sources []*pb.SourceInfo, scb SourceInfoMap) error {
@@ -93,17 +93,17 @@ func (results *LintResults) AddWarning(rulename, description, url, fmtmsg string
sourceLocation := []*pb.Range{}
for _, loc := range location {
sourceLocation = append(sourceLocation, &pb.Range{
Start: pb.Position{
Start: &pb.Position{
Line: int32(loc.Start.Line),
Character: int32(loc.Start.Character),
},
End: pb.Position{
End: &pb.Position{
Line: int32(loc.End.Line),
Character: int32(loc.End.Character),
},
})
}
pbLocation := pb.Location{
pbLocation := &pb.Location{
SourceIndex: int32(sourceIndex),
Ranges: sourceLocation,
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@ syntax = "proto3";
package moby.filesync.v1;
option go_package = "auth";
option go_package = "github.com/moby/buildkit/session/auth";
service Auth{
rpc Credentials(CredentialsRequest) returns (CredentialsResponse);

View File

@@ -0,0 +1,233 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.11.4
// source: auth.proto
package auth
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Auth_Credentials_FullMethodName = "/moby.filesync.v1.Auth/Credentials"
Auth_FetchToken_FullMethodName = "/moby.filesync.v1.Auth/FetchToken"
Auth_GetTokenAuthority_FullMethodName = "/moby.filesync.v1.Auth/GetTokenAuthority"
Auth_VerifyTokenAuthority_FullMethodName = "/moby.filesync.v1.Auth/VerifyTokenAuthority"
)
// AuthClient is the client API for Auth service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type AuthClient interface {
Credentials(ctx context.Context, in *CredentialsRequest, opts ...grpc.CallOption) (*CredentialsResponse, error)
FetchToken(ctx context.Context, in *FetchTokenRequest, opts ...grpc.CallOption) (*FetchTokenResponse, error)
GetTokenAuthority(ctx context.Context, in *GetTokenAuthorityRequest, opts ...grpc.CallOption) (*GetTokenAuthorityResponse, error)
VerifyTokenAuthority(ctx context.Context, in *VerifyTokenAuthorityRequest, opts ...grpc.CallOption) (*VerifyTokenAuthorityResponse, error)
}
type authClient struct {
cc grpc.ClientConnInterface
}
func NewAuthClient(cc grpc.ClientConnInterface) AuthClient {
return &authClient{cc}
}
func (c *authClient) Credentials(ctx context.Context, in *CredentialsRequest, opts ...grpc.CallOption) (*CredentialsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CredentialsResponse)
err := c.cc.Invoke(ctx, Auth_Credentials_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authClient) FetchToken(ctx context.Context, in *FetchTokenRequest, opts ...grpc.CallOption) (*FetchTokenResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(FetchTokenResponse)
err := c.cc.Invoke(ctx, Auth_FetchToken_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authClient) GetTokenAuthority(ctx context.Context, in *GetTokenAuthorityRequest, opts ...grpc.CallOption) (*GetTokenAuthorityResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetTokenAuthorityResponse)
err := c.cc.Invoke(ctx, Auth_GetTokenAuthority_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authClient) VerifyTokenAuthority(ctx context.Context, in *VerifyTokenAuthorityRequest, opts ...grpc.CallOption) (*VerifyTokenAuthorityResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(VerifyTokenAuthorityResponse)
err := c.cc.Invoke(ctx, Auth_VerifyTokenAuthority_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AuthServer is the server API for Auth service.
// All implementations should embed UnimplementedAuthServer
// for forward compatibility.
type AuthServer interface {
Credentials(context.Context, *CredentialsRequest) (*CredentialsResponse, error)
FetchToken(context.Context, *FetchTokenRequest) (*FetchTokenResponse, error)
GetTokenAuthority(context.Context, *GetTokenAuthorityRequest) (*GetTokenAuthorityResponse, error)
VerifyTokenAuthority(context.Context, *VerifyTokenAuthorityRequest) (*VerifyTokenAuthorityResponse, error)
}
// UnimplementedAuthServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAuthServer struct{}
func (UnimplementedAuthServer) Credentials(context.Context, *CredentialsRequest) (*CredentialsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Credentials not implemented")
}
func (UnimplementedAuthServer) FetchToken(context.Context, *FetchTokenRequest) (*FetchTokenResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method FetchToken not implemented")
}
func (UnimplementedAuthServer) GetTokenAuthority(context.Context, *GetTokenAuthorityRequest) (*GetTokenAuthorityResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTokenAuthority not implemented")
}
func (UnimplementedAuthServer) VerifyTokenAuthority(context.Context, *VerifyTokenAuthorityRequest) (*VerifyTokenAuthorityResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method VerifyTokenAuthority not implemented")
}
func (UnimplementedAuthServer) testEmbeddedByValue() {}
// UnsafeAuthServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AuthServer will
// result in compilation errors.
type UnsafeAuthServer interface {
mustEmbedUnimplementedAuthServer()
}
func RegisterAuthServer(s grpc.ServiceRegistrar, srv AuthServer) {
// If the following call pancis, it indicates UnimplementedAuthServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Auth_ServiceDesc, srv)
}
func _Auth_Credentials_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CredentialsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).Credentials(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_Credentials_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServer).Credentials(ctx, req.(*CredentialsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_FetchToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FetchTokenRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).FetchToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_FetchToken_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServer).FetchToken(ctx, req.(*FetchTokenRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_GetTokenAuthority_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetTokenAuthorityRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).GetTokenAuthority(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_GetTokenAuthority_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServer).GetTokenAuthority(ctx, req.(*GetTokenAuthorityRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_VerifyTokenAuthority_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(VerifyTokenAuthorityRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).VerifyTokenAuthority(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_VerifyTokenAuthority_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServer).VerifyTokenAuthority(ctx, req.(*VerifyTokenAuthorityRequest))
}
return interceptor(ctx, in, info, handler)
}
// Auth_ServiceDesc is the grpc.ServiceDesc for Auth service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Auth_ServiceDesc = grpc.ServiceDesc{
ServiceName: "moby.filesync.v1.Auth",
HandlerType: (*AuthServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Credentials",
Handler: _Auth_Credentials_Handler,
},
{
MethodName: "FetchToken",
Handler: _Auth_FetchToken_Handler,
},
{
MethodName: "GetTokenAuthority",
Handler: _Auth_GetTokenAuthority_Handler,
},
{
MethodName: "VerifyTokenAuthority",
Handler: _Auth_VerifyTokenAuthority_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "auth.proto",
}

View File

@@ -31,9 +31,11 @@ import (
"google.golang.org/grpc/status"
)
const defaultExpiration = 60
const dockerHubConfigfileKey = "https://index.docker.io/v1/"
const dockerHubRegistryHost = "registry-1.docker.io"
const (
defaultExpiration = 60
dockerHubConfigfileKey = "https://index.docker.io/v1/"
dockerHubRegistryHost = "registry-1.docker.io"
)
func NewDockerAuthProvider(cfg *configfile.ConfigFile, tlsConfigs map[string]*AuthTLSConfig) session.Attachable {
return &authProvider{
@@ -94,7 +96,7 @@ func (ap *authProvider) FetchToken(ctx context.Context, req *auth.FetchTokenRequ
Secret: creds.Secret,
}
var httpClient = http.DefaultClient()
httpClient := http.DefaultClient()
if tc, err := ap.tlsConfig(req.Host); err == nil && tc != nil {
transport := http.DefaultTransport()
transport.TLSClientConfig = tc

View File

@@ -1,3 +1,3 @@
package auth
//go:generate protoc --gogoslick_out=plugins=grpc:. auth.proto
//go:generate protoc --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative,require_unimplemented_servers=false:. auth.proto

View File

@@ -71,6 +71,7 @@ func (sp *fsSyncProvider) Register(server *grpc.Server) {
func (sp *fsSyncProvider) DiffCopy(stream FileSync_DiffCopyServer) error {
return sp.handle("diffcopy", stream)
}
func (sp *fsSyncProvider) TarStream(stream FileSync_TarStreamServer) error {
return sp.handle("tarstream", stream)
}
@@ -179,7 +180,7 @@ type CacheUpdater interface {
func FSSync(ctx context.Context, c session.Caller, opt FSSendRequestOpt) error {
var pr *protocol
for _, p := range supportedProtocols {
if c.Supports(session.MethodURL(_FileSync_serviceDesc.ServiceName, p.name)) {
if c.Supports(session.MethodURL(FileSync_ServiceDesc.ServiceName, p.name)) {
pr = &p
break
}
@@ -340,7 +341,7 @@ func (sp *fsSyncAttachable) DiffCopy(stream FileSend_DiffCopyServer) (err error)
}
func CopyToCaller(ctx context.Context, fs fsutil.FS, id int, c session.Caller, progress func(int, bool)) error {
method := session.MethodURL(_FileSend_serviceDesc.ServiceName, "diffcopy")
method := session.MethodURL(FileSend_ServiceDesc.ServiceName, "diffcopy")
if !c.Supports(method) {
return errors.Errorf("method %s not supported by the client", method)
}
@@ -366,7 +367,7 @@ func CopyToCaller(ctx context.Context, fs fsutil.FS, id int, c session.Caller, p
}
func CopyFileWriter(ctx context.Context, md map[string]string, id int, c session.Caller) (io.WriteCloser, error) {
method := session.MethodURL(_FileSend_serviceDesc.ServiceName, "diffcopy")
method := session.MethodURL(FileSend_ServiceDesc.ServiceName, "diffcopy")
if !c.Supports(method) {
return nil, errors.Errorf("method %s not supported by the client", method)
}

View File

@@ -1,677 +1,170 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc v3.11.4
// source: filesync.proto
package filesync
import (
bytes "bytes"
context "context"
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
types "github.com/tonistiigi/fsutil/types"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io"
math "math"
math_bits "math/bits"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
strings "strings"
sync "sync"
)
// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// BytesMessage contains a chunk of byte data
type BytesMessage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
}
func (m *BytesMessage) Reset() { *m = BytesMessage{} }
func (x *BytesMessage) Reset() {
*x = BytesMessage{}
if protoimpl.UnsafeEnabled {
mi := &file_filesync_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BytesMessage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BytesMessage) ProtoMessage() {}
func (x *BytesMessage) ProtoReflect() protoreflect.Message {
mi := &file_filesync_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BytesMessage.ProtoReflect.Descriptor instead.
func (*BytesMessage) Descriptor() ([]byte, []int) {
return fileDescriptor_d1042549f1f24495, []int{0}
}
func (m *BytesMessage) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *BytesMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_BytesMessage.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *BytesMessage) XXX_Merge(src proto.Message) {
xxx_messageInfo_BytesMessage.Merge(m, src)
}
func (m *BytesMessage) XXX_Size() int {
return m.Size()
}
func (m *BytesMessage) XXX_DiscardUnknown() {
xxx_messageInfo_BytesMessage.DiscardUnknown(m)
return file_filesync_proto_rawDescGZIP(), []int{0}
}
var xxx_messageInfo_BytesMessage proto.InternalMessageInfo
func (m *BytesMessage) GetData() []byte {
if m != nil {
return m.Data
func (x *BytesMessage) GetData() []byte {
if x != nil {
return x.Data
}
return nil
}
func init() {
proto.RegisterType((*BytesMessage)(nil), "moby.filesync.v1.BytesMessage")
}
var File_filesync_proto protoreflect.FileDescriptor
func init() { proto.RegisterFile("filesync.proto", fileDescriptor_d1042549f1f24495) }
var fileDescriptor_d1042549f1f24495 = []byte{
// 281 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4b, 0xcb, 0xcc, 0x49,
0x2d, 0xae, 0xcc, 0x4b, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xc8, 0xcd, 0x4f, 0xaa,
0xd4, 0x83, 0x0b, 0x96, 0x19, 0x4a, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7,
0xe7, 0xea, 0x97, 0xe4, 0xe7, 0x65, 0x16, 0x97, 0x64, 0x66, 0xa6, 0x67, 0xea, 0xa7, 0x15, 0x97,
0x96, 0x64, 0xe6, 0xe8, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0x97, 0x67, 0x16, 0xa5, 0x42, 0x0c,
0x50, 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, 0x8d, 0x9a, 0x19, 0xb9, 0x38, 0xdc, 0x32, 0x73, 0x52, 0x83, 0x2b, 0xf3, 0x92, 0x85, 0xac,
0xb8, 0x38, 0x5c, 0x32, 0xd3, 0xd2, 0x9c, 0xf3, 0x0b, 0x2a, 0x85, 0x44, 0xf4, 0x20, 0xc6, 0xea,
0x81, 0x8d, 0xd5, 0x0b, 0x48, 0x4c, 0xce, 0x4e, 0x2d, 0x91, 0xc2, 0x2a, 0xaa, 0xc1, 0x68, 0xc0,
0x28, 0x64, 0xcd, 0xc5, 0x19, 0x92, 0x58, 0x14, 0x5c, 0x52, 0x94, 0x9a, 0x98, 0x4b, 0xaa, 0x66,
0xa3, 0x28, 0xa8, 0x23, 0x52, 0xf3, 0x52, 0x84, 0xfc, 0x90, 0x1c, 0x21, 0xa7, 0x87, 0x1e, 0x06,
0x7a, 0xc8, 0x3e, 0x92, 0x22, 0x20, 0x0f, 0x32, 0xdb, 0xc9, 0xee, 0xc2, 0x43, 0x39, 0x86, 0x1b,
0x0f, 0xe5, 0x18, 0x3e, 0x3c, 0x94, 0x63, 0x6c, 0x78, 0x24, 0xc7, 0xb8, 0xe2, 0x91, 0x1c, 0xe3,
0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0xf8, 0xe2, 0x91, 0x1c,
0xc3, 0x87, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1,
0x1c, 0x43, 0x14, 0x07, 0xcc, 0xcc, 0x24, 0x36, 0x70, 0x60, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff,
0xff, 0xe6, 0x17, 0x63, 0x59, 0x9f, 0x01, 0x00, 0x00,
}
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 *BytesMessage) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 5)
s = append(s, "&filesync.BytesMessage{")
s = append(s, "Data: "+fmt.Sprintf("%#v", this.Data)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
func valueToGoStringFilesync(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
// FileSyncClient is the client API for FileSync service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type FileSyncClient interface {
DiffCopy(ctx context.Context, opts ...grpc.CallOption) (FileSync_DiffCopyClient, error)
TarStream(ctx context.Context, opts ...grpc.CallOption) (FileSync_TarStreamClient, error)
}
type fileSyncClient struct {
cc *grpc.ClientConn
}
func NewFileSyncClient(cc *grpc.ClientConn) FileSyncClient {
return &fileSyncClient{cc}
}
func (c *fileSyncClient) DiffCopy(ctx context.Context, opts ...grpc.CallOption) (FileSync_DiffCopyClient, error) {
stream, err := c.cc.NewStream(ctx, &_FileSync_serviceDesc.Streams[0], "/moby.filesync.v1.FileSync/DiffCopy", opts...)
if err != nil {
return nil, err
}
x := &fileSyncDiffCopyClient{stream}
return x, nil
}
type FileSync_DiffCopyClient interface {
Send(*types.Packet) error
Recv() (*types.Packet, error)
grpc.ClientStream
}
type fileSyncDiffCopyClient struct {
grpc.ClientStream
}
func (x *fileSyncDiffCopyClient) Send(m *types.Packet) error {
return x.ClientStream.SendMsg(m)
}
func (x *fileSyncDiffCopyClient) Recv() (*types.Packet, error) {
m := new(types.Packet)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *fileSyncClient) TarStream(ctx context.Context, opts ...grpc.CallOption) (FileSync_TarStreamClient, error) {
stream, err := c.cc.NewStream(ctx, &_FileSync_serviceDesc.Streams[1], "/moby.filesync.v1.FileSync/TarStream", opts...)
if err != nil {
return nil, err
}
x := &fileSyncTarStreamClient{stream}
return x, nil
}
type FileSync_TarStreamClient interface {
Send(*types.Packet) error
Recv() (*types.Packet, error)
grpc.ClientStream
}
type fileSyncTarStreamClient struct {
grpc.ClientStream
}
func (x *fileSyncTarStreamClient) Send(m *types.Packet) error {
return x.ClientStream.SendMsg(m)
}
func (x *fileSyncTarStreamClient) Recv() (*types.Packet, error) {
m := new(types.Packet)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// FileSyncServer is the server API for FileSync service.
type FileSyncServer interface {
DiffCopy(FileSync_DiffCopyServer) error
TarStream(FileSync_TarStreamServer) error
}
// UnimplementedFileSyncServer can be embedded to have forward compatible implementations.
type UnimplementedFileSyncServer struct {
}
func (*UnimplementedFileSyncServer) DiffCopy(srv FileSync_DiffCopyServer) error {
return status.Errorf(codes.Unimplemented, "method DiffCopy not implemented")
}
func (*UnimplementedFileSyncServer) TarStream(srv FileSync_TarStreamServer) error {
return status.Errorf(codes.Unimplemented, "method TarStream not implemented")
}
func RegisterFileSyncServer(s *grpc.Server, srv FileSyncServer) {
s.RegisterService(&_FileSync_serviceDesc, srv)
}
func _FileSync_DiffCopy_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(FileSyncServer).DiffCopy(&fileSyncDiffCopyServer{stream})
}
type FileSync_DiffCopyServer interface {
Send(*types.Packet) error
Recv() (*types.Packet, error)
grpc.ServerStream
}
type fileSyncDiffCopyServer struct {
grpc.ServerStream
}
func (x *fileSyncDiffCopyServer) Send(m *types.Packet) error {
return x.ServerStream.SendMsg(m)
}
func (x *fileSyncDiffCopyServer) Recv() (*types.Packet, error) {
m := new(types.Packet)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func _FileSync_TarStream_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(FileSyncServer).TarStream(&fileSyncTarStreamServer{stream})
}
type FileSync_TarStreamServer interface {
Send(*types.Packet) error
Recv() (*types.Packet, error)
grpc.ServerStream
}
type fileSyncTarStreamServer struct {
grpc.ServerStream
}
func (x *fileSyncTarStreamServer) Send(m *types.Packet) error {
return x.ServerStream.SendMsg(m)
}
func (x *fileSyncTarStreamServer) Recv() (*types.Packet, error) {
m := new(types.Packet)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
var _FileSync_serviceDesc = grpc.ServiceDesc{
ServiceName: "moby.filesync.v1.FileSync",
HandlerType: (*FileSyncServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "DiffCopy",
Handler: _FileSync_DiffCopy_Handler,
ServerStreams: true,
ClientStreams: true,
},
{
StreamName: "TarStream",
Handler: _FileSync_TarStream_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "filesync.proto",
}
// FileSendClient is the client API for FileSend service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type FileSendClient interface {
DiffCopy(ctx context.Context, opts ...grpc.CallOption) (FileSend_DiffCopyClient, error)
}
type fileSendClient struct {
cc *grpc.ClientConn
}
func NewFileSendClient(cc *grpc.ClientConn) FileSendClient {
return &fileSendClient{cc}
}
func (c *fileSendClient) DiffCopy(ctx context.Context, opts ...grpc.CallOption) (FileSend_DiffCopyClient, error) {
stream, err := c.cc.NewStream(ctx, &_FileSend_serviceDesc.Streams[0], "/moby.filesync.v1.FileSend/DiffCopy", opts...)
if err != nil {
return nil, err
}
x := &fileSendDiffCopyClient{stream}
return x, nil
}
type FileSend_DiffCopyClient interface {
Send(*BytesMessage) error
Recv() (*BytesMessage, error)
grpc.ClientStream
}
type fileSendDiffCopyClient struct {
grpc.ClientStream
}
func (x *fileSendDiffCopyClient) Send(m *BytesMessage) error {
return x.ClientStream.SendMsg(m)
}
func (x *fileSendDiffCopyClient) Recv() (*BytesMessage, error) {
m := new(BytesMessage)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// FileSendServer is the server API for FileSend service.
type FileSendServer interface {
DiffCopy(FileSend_DiffCopyServer) error
}
// UnimplementedFileSendServer can be embedded to have forward compatible implementations.
type UnimplementedFileSendServer struct {
}
func (*UnimplementedFileSendServer) DiffCopy(srv FileSend_DiffCopyServer) error {
return status.Errorf(codes.Unimplemented, "method DiffCopy not implemented")
}
func RegisterFileSendServer(s *grpc.Server, srv FileSendServer) {
s.RegisterService(&_FileSend_serviceDesc, srv)
}
func _FileSend_DiffCopy_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(FileSendServer).DiffCopy(&fileSendDiffCopyServer{stream})
}
type FileSend_DiffCopyServer interface {
Send(*BytesMessage) error
Recv() (*BytesMessage, error)
grpc.ServerStream
}
type fileSendDiffCopyServer struct {
grpc.ServerStream
}
func (x *fileSendDiffCopyServer) Send(m *BytesMessage) error {
return x.ServerStream.SendMsg(m)
}
func (x *fileSendDiffCopyServer) Recv() (*BytesMessage, error) {
m := new(BytesMessage)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
var _FileSend_serviceDesc = grpc.ServiceDesc{
ServiceName: "moby.filesync.v1.FileSend",
HandlerType: (*FileSendServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "DiffCopy",
Handler: _FileSend_DiffCopy_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "filesync.proto",
}
func (m *BytesMessage) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *BytesMessage) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *BytesMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Data) > 0 {
i -= len(m.Data)
copy(dAtA[i:], m.Data)
i = encodeVarintFilesync(dAtA, i, uint64(len(m.Data)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintFilesync(dAtA []byte, offset int, v uint64) int {
offset -= sovFilesync(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *BytesMessage) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Data)
if l > 0 {
n += 1 + l + sovFilesync(uint64(l))
}
return n
}
func sovFilesync(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozFilesync(x uint64) (n int) {
return sovFilesync(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 valueToStringFilesync(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 ErrIntOverflowFilesync
}
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 ErrIntOverflowFilesync
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthFilesync
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthFilesync
}
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 := skipFilesync(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthFilesync
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipFilesync(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowFilesync
}
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, ErrIntOverflowFilesync
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowFilesync
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthFilesync
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupFilesync
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthFilesync
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
var file_filesync_proto_rawDesc = []byte{
0x0a, 0x0e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x10, 0x6d, 0x6f, 0x62, 0x79, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x6e, 0x63, 0x2e,
0x76, 0x31, 0x1a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74,
0x6f, 0x6e, 0x69, 0x73, 0x74, 0x69, 0x69, 0x67, 0x69, 0x2f, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c,
0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x77, 0x69, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0x22, 0x0a, 0x0c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52,
0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0x83, 0x01, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x79,
0x6e, 0x63, 0x12, 0x3a, 0x0a, 0x08, 0x44, 0x69, 0x66, 0x66, 0x43, 0x6f, 0x70, 0x79, 0x12, 0x14,
0x2e, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x61,
0x63, 0x6b, 0x65, 0x74, 0x1a, 0x14, 0x2e, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79,
0x70, 0x65, 0x73, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x28, 0x01, 0x30, 0x01, 0x12, 0x3b,
0x0a, 0x09, 0x54, 0x61, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x14, 0x2e, 0x66, 0x73,
0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65,
0x74, 0x1a, 0x14, 0x2e, 0x66, 0x73, 0x75, 0x74, 0x69, 0x6c, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x28, 0x01, 0x30, 0x01, 0x32, 0x5a, 0x0a, 0x08, 0x46,
0x69, 0x6c, 0x65, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x4e, 0x0a, 0x08, 0x44, 0x69, 0x66, 0x66, 0x43,
0x6f, 0x70, 0x79, 0x12, 0x1e, 0x2e, 0x6d, 0x6f, 0x62, 0x79, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73,
0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x4d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x1a, 0x1e, 0x2e, 0x6d, 0x6f, 0x62, 0x79, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73,
0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x4d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0x2b, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x6f, 0x62, 0x79, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64,
0x6b, 0x69, 0x74, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x66, 0x69, 0x6c, 0x65,
0x73, 0x79, 0x6e, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
ErrInvalidLengthFilesync = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowFilesync = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupFilesync = fmt.Errorf("proto: unexpected end of group")
file_filesync_proto_rawDescOnce sync.Once
file_filesync_proto_rawDescData = file_filesync_proto_rawDesc
)
func file_filesync_proto_rawDescGZIP() []byte {
file_filesync_proto_rawDescOnce.Do(func() {
file_filesync_proto_rawDescData = protoimpl.X.CompressGZIP(file_filesync_proto_rawDescData)
})
return file_filesync_proto_rawDescData
}
var file_filesync_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_filesync_proto_goTypes = []interface{}{
(*BytesMessage)(nil), // 0: moby.filesync.v1.BytesMessage
(*types.Packet)(nil), // 1: fsutil.types.Packet
}
var file_filesync_proto_depIdxs = []int32{
1, // 0: moby.filesync.v1.FileSync.DiffCopy:input_type -> fsutil.types.Packet
1, // 1: moby.filesync.v1.FileSync.TarStream:input_type -> fsutil.types.Packet
0, // 2: moby.filesync.v1.FileSend.DiffCopy:input_type -> moby.filesync.v1.BytesMessage
1, // 3: moby.filesync.v1.FileSync.DiffCopy:output_type -> fsutil.types.Packet
1, // 4: moby.filesync.v1.FileSync.TarStream:output_type -> fsutil.types.Packet
0, // 5: moby.filesync.v1.FileSend.DiffCopy:output_type -> moby.filesync.v1.BytesMessage
3, // [3:6] is the sub-list for method output_type
0, // [0:3] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_filesync_proto_init() }
func file_filesync_proto_init() {
if File_filesync_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_filesync_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BytesMessage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_filesync_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 2,
},
GoTypes: file_filesync_proto_goTypes,
DependencyIndexes: file_filesync_proto_depIdxs,
MessageInfos: file_filesync_proto_msgTypes,
}.Build()
File_filesync_proto = out.File
file_filesync_proto_rawDesc = nil
file_filesync_proto_goTypes = nil
file_filesync_proto_depIdxs = nil
}

View File

@@ -2,7 +2,7 @@ syntax = "proto3";
package moby.filesync.v1;
option go_package = "filesync";
option go_package = "github.com/moby/buildkit/session/filesync";
import "github.com/tonistiigi/fsutil/types/wire.proto";

View File

@@ -0,0 +1,248 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.11.4
// source: filesync.proto
package filesync
import (
context "context"
types "github.com/tonistiigi/fsutil/types"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
FileSync_DiffCopy_FullMethodName = "/moby.filesync.v1.FileSync/DiffCopy"
FileSync_TarStream_FullMethodName = "/moby.filesync.v1.FileSync/TarStream"
)
// FileSyncClient is the client API for FileSync service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// FileSync exposes local files from the client to the server.
type FileSyncClient interface {
DiffCopy(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[types.Packet, types.Packet], error)
TarStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[types.Packet, types.Packet], error)
}
type fileSyncClient struct {
cc grpc.ClientConnInterface
}
func NewFileSyncClient(cc grpc.ClientConnInterface) FileSyncClient {
return &fileSyncClient{cc}
}
func (c *fileSyncClient) DiffCopy(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[types.Packet, types.Packet], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &FileSync_ServiceDesc.Streams[0], FileSync_DiffCopy_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[types.Packet, types.Packet]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type FileSync_DiffCopyClient = grpc.BidiStreamingClient[types.Packet, types.Packet]
func (c *fileSyncClient) TarStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[types.Packet, types.Packet], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &FileSync_ServiceDesc.Streams[1], FileSync_TarStream_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[types.Packet, types.Packet]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type FileSync_TarStreamClient = grpc.BidiStreamingClient[types.Packet, types.Packet]
// FileSyncServer is the server API for FileSync service.
// All implementations should embed UnimplementedFileSyncServer
// for forward compatibility.
//
// FileSync exposes local files from the client to the server.
type FileSyncServer interface {
DiffCopy(grpc.BidiStreamingServer[types.Packet, types.Packet]) error
TarStream(grpc.BidiStreamingServer[types.Packet, types.Packet]) error
}
// UnimplementedFileSyncServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedFileSyncServer struct{}
func (UnimplementedFileSyncServer) DiffCopy(grpc.BidiStreamingServer[types.Packet, types.Packet]) error {
return status.Errorf(codes.Unimplemented, "method DiffCopy not implemented")
}
func (UnimplementedFileSyncServer) TarStream(grpc.BidiStreamingServer[types.Packet, types.Packet]) error {
return status.Errorf(codes.Unimplemented, "method TarStream not implemented")
}
func (UnimplementedFileSyncServer) testEmbeddedByValue() {}
// UnsafeFileSyncServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to FileSyncServer will
// result in compilation errors.
type UnsafeFileSyncServer interface {
mustEmbedUnimplementedFileSyncServer()
}
func RegisterFileSyncServer(s grpc.ServiceRegistrar, srv FileSyncServer) {
// If the following call pancis, it indicates UnimplementedFileSyncServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&FileSync_ServiceDesc, srv)
}
func _FileSync_DiffCopy_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(FileSyncServer).DiffCopy(&grpc.GenericServerStream[types.Packet, types.Packet]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type FileSync_DiffCopyServer = grpc.BidiStreamingServer[types.Packet, types.Packet]
func _FileSync_TarStream_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(FileSyncServer).TarStream(&grpc.GenericServerStream[types.Packet, types.Packet]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type FileSync_TarStreamServer = grpc.BidiStreamingServer[types.Packet, types.Packet]
// FileSync_ServiceDesc is the grpc.ServiceDesc for FileSync service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var FileSync_ServiceDesc = grpc.ServiceDesc{
ServiceName: "moby.filesync.v1.FileSync",
HandlerType: (*FileSyncServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "DiffCopy",
Handler: _FileSync_DiffCopy_Handler,
ServerStreams: true,
ClientStreams: true,
},
{
StreamName: "TarStream",
Handler: _FileSync_TarStream_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "filesync.proto",
}
const (
FileSend_DiffCopy_FullMethodName = "/moby.filesync.v1.FileSend/DiffCopy"
)
// FileSendClient is the client API for FileSend service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// FileSend allows sending files from the server back to the client.
type FileSendClient interface {
DiffCopy(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BytesMessage, BytesMessage], error)
}
type fileSendClient struct {
cc grpc.ClientConnInterface
}
func NewFileSendClient(cc grpc.ClientConnInterface) FileSendClient {
return &fileSendClient{cc}
}
func (c *fileSendClient) DiffCopy(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BytesMessage, BytesMessage], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &FileSend_ServiceDesc.Streams[0], FileSend_DiffCopy_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[BytesMessage, BytesMessage]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type FileSend_DiffCopyClient = grpc.BidiStreamingClient[BytesMessage, BytesMessage]
// FileSendServer is the server API for FileSend service.
// All implementations should embed UnimplementedFileSendServer
// for forward compatibility.
//
// FileSend allows sending files from the server back to the client.
type FileSendServer interface {
DiffCopy(grpc.BidiStreamingServer[BytesMessage, BytesMessage]) error
}
// UnimplementedFileSendServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedFileSendServer struct{}
func (UnimplementedFileSendServer) DiffCopy(grpc.BidiStreamingServer[BytesMessage, BytesMessage]) error {
return status.Errorf(codes.Unimplemented, "method DiffCopy not implemented")
}
func (UnimplementedFileSendServer) testEmbeddedByValue() {}
// UnsafeFileSendServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to FileSendServer will
// result in compilation errors.
type UnsafeFileSendServer interface {
mustEmbedUnimplementedFileSendServer()
}
func RegisterFileSendServer(s grpc.ServiceRegistrar, srv FileSendServer) {
// If the following call pancis, it indicates UnimplementedFileSendServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&FileSend_ServiceDesc, srv)
}
func _FileSend_DiffCopy_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(FileSendServer).DiffCopy(&grpc.GenericServerStream[BytesMessage, BytesMessage]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type FileSend_DiffCopyServer = grpc.BidiStreamingServer[BytesMessage, BytesMessage]
// FileSend_ServiceDesc is the grpc.ServiceDesc for FileSend service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var FileSend_ServiceDesc = grpc.ServiceDesc{
ServiceName: "moby.filesync.v1.FileSend",
HandlerType: (*FileSendServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "DiffCopy",
Handler: _FileSend_DiffCopy_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "filesync.proto",
}

View File

@@ -1,3 +1,3 @@
package filesync
//go:generate protoc -I=. -I=../../vendor/ -I=../../vendor/github.com/tonistiigi/fsutil/types/ --gogoslick_out=plugins=grpc:. filesync.proto
//go:generate protoc -I=. -I=../../vendor/ --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative,require_unimplemented_servers=false:. filesync.proto

View File

@@ -56,6 +56,7 @@ func grpcClientConn(ctx context.Context, conn net.Conn) (context.Context, *grpc.
dialOpts = append(dialOpts, grpc.WithStatsHandler(statsHandler))
}
//nolint:staticcheck // ignore SA1019 NewClient is preferred but has different behavior
cc, err := grpc.DialContext(ctx, "localhost", dialOpts...)
if err != nil {
return ctx, nil, errors.Wrap(err, "failed to create grpc client")

View File

@@ -1,3 +1,3 @@
package secrets
//go:generate protoc --gogoslick_out=plugins=grpc:. secrets.proto
//go:generate protoc --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative,require_unimplemented_servers=false:. secrets.proto

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@ syntax = "proto3";
package moby.buildkit.secrets.v1;
option go_package = "secrets";
option go_package = "github.com/moby/buildkit/session/secrets";
service Secrets{
rpc GetSecret(GetSecretRequest) returns (GetSecretResponse);

View File

@@ -0,0 +1,119 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.11.4
// source: secrets.proto
package secrets
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Secrets_GetSecret_FullMethodName = "/moby.buildkit.secrets.v1.Secrets/GetSecret"
)
// SecretsClient is the client API for Secrets service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type SecretsClient interface {
GetSecret(ctx context.Context, in *GetSecretRequest, opts ...grpc.CallOption) (*GetSecretResponse, error)
}
type secretsClient struct {
cc grpc.ClientConnInterface
}
func NewSecretsClient(cc grpc.ClientConnInterface) SecretsClient {
return &secretsClient{cc}
}
func (c *secretsClient) GetSecret(ctx context.Context, in *GetSecretRequest, opts ...grpc.CallOption) (*GetSecretResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetSecretResponse)
err := c.cc.Invoke(ctx, Secrets_GetSecret_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// SecretsServer is the server API for Secrets service.
// All implementations should embed UnimplementedSecretsServer
// for forward compatibility.
type SecretsServer interface {
GetSecret(context.Context, *GetSecretRequest) (*GetSecretResponse, error)
}
// UnimplementedSecretsServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedSecretsServer struct{}
func (UnimplementedSecretsServer) GetSecret(context.Context, *GetSecretRequest) (*GetSecretResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSecret not implemented")
}
func (UnimplementedSecretsServer) testEmbeddedByValue() {}
// UnsafeSecretsServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SecretsServer will
// result in compilation errors.
type UnsafeSecretsServer interface {
mustEmbedUnimplementedSecretsServer()
}
func RegisterSecretsServer(s grpc.ServiceRegistrar, srv SecretsServer) {
// If the following call pancis, it indicates UnimplementedSecretsServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Secrets_ServiceDesc, srv)
}
func _Secrets_GetSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetSecretRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SecretsServer).GetSecret(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Secrets_GetSecret_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SecretsServer).GetSecret(ctx, req.(*GetSecretRequest))
}
return interceptor(ctx, in, info, handler)
}
// Secrets_ServiceDesc is the grpc.ServiceDesc for Secrets service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Secrets_ServiceDesc = grpc.ServiceDesc{
ServiceName: "moby.buildkit.secrets.v1.Secrets",
HandlerType: (*SecretsServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetSecret",
Handler: _Secrets_GetSecret_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "secrets.proto",
}

View File

@@ -1,3 +1,3 @@
package sshforward
//go:generate protoc --gogoslick_out=plugins=grpc:. ssh.proto
//go:generate protoc --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative,require_unimplemented_servers=false:. ssh.proto

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@ syntax = "proto3";
package moby.sshforward.v1;
option go_package = "sshforward";
option go_package = "github.com/moby/buildkit/session/sshforward";
service SSH {
rpc CheckAgent(CheckAgentRequest) returns (CheckAgentResponse);
@@ -19,4 +19,4 @@ message CheckAgentRequest {
}
message CheckAgentResponse {
}
}

View File

@@ -0,0 +1,152 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.11.4
// source: ssh.proto
package sshforward
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
SSH_CheckAgent_FullMethodName = "/moby.sshforward.v1.SSH/CheckAgent"
SSH_ForwardAgent_FullMethodName = "/moby.sshforward.v1.SSH/ForwardAgent"
)
// SSHClient is the client API for SSH service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type SSHClient interface {
CheckAgent(ctx context.Context, in *CheckAgentRequest, opts ...grpc.CallOption) (*CheckAgentResponse, error)
ForwardAgent(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BytesMessage, BytesMessage], error)
}
type sSHClient struct {
cc grpc.ClientConnInterface
}
func NewSSHClient(cc grpc.ClientConnInterface) SSHClient {
return &sSHClient{cc}
}
func (c *sSHClient) CheckAgent(ctx context.Context, in *CheckAgentRequest, opts ...grpc.CallOption) (*CheckAgentResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CheckAgentResponse)
err := c.cc.Invoke(ctx, SSH_CheckAgent_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *sSHClient) ForwardAgent(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BytesMessage, BytesMessage], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &SSH_ServiceDesc.Streams[0], SSH_ForwardAgent_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[BytesMessage, BytesMessage]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type SSH_ForwardAgentClient = grpc.BidiStreamingClient[BytesMessage, BytesMessage]
// SSHServer is the server API for SSH service.
// All implementations should embed UnimplementedSSHServer
// for forward compatibility.
type SSHServer interface {
CheckAgent(context.Context, *CheckAgentRequest) (*CheckAgentResponse, error)
ForwardAgent(grpc.BidiStreamingServer[BytesMessage, BytesMessage]) error
}
// UnimplementedSSHServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedSSHServer struct{}
func (UnimplementedSSHServer) CheckAgent(context.Context, *CheckAgentRequest) (*CheckAgentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CheckAgent not implemented")
}
func (UnimplementedSSHServer) ForwardAgent(grpc.BidiStreamingServer[BytesMessage, BytesMessage]) error {
return status.Errorf(codes.Unimplemented, "method ForwardAgent not implemented")
}
func (UnimplementedSSHServer) testEmbeddedByValue() {}
// UnsafeSSHServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SSHServer will
// result in compilation errors.
type UnsafeSSHServer interface {
mustEmbedUnimplementedSSHServer()
}
func RegisterSSHServer(s grpc.ServiceRegistrar, srv SSHServer) {
// If the following call pancis, it indicates UnimplementedSSHServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
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: SSH_CheckAgent_FullMethodName,
}
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(&grpc.GenericServerStream[BytesMessage, BytesMessage]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type SSH_ForwardAgentServer = grpc.BidiStreamingServer[BytesMessage, BytesMessage]
// SSH_ServiceDesc is the grpc.ServiceDesc for SSH service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
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",
}

View File

@@ -1,3 +1,3 @@
package upload
//go:generate protoc --gogoslick_out=plugins=grpc:. upload.proto
//go:generate protoc --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative,require_unimplemented_servers=false:. upload.proto

View File

@@ -1,498 +1,152 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc v3.11.4
// source: upload.proto
package upload
import (
bytes "bytes"
context "context"
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
io "io"
math "math"
math_bits "math/bits"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
strings "strings"
sync "sync"
)
// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// BytesMessage contains a chunk of byte data
type BytesMessage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
}
func (m *BytesMessage) Reset() { *m = BytesMessage{} }
func (x *BytesMessage) Reset() {
*x = BytesMessage{}
if protoimpl.UnsafeEnabled {
mi := &file_upload_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BytesMessage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BytesMessage) ProtoMessage() {}
func (x *BytesMessage) ProtoReflect() protoreflect.Message {
mi := &file_upload_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BytesMessage.ProtoReflect.Descriptor instead.
func (*BytesMessage) Descriptor() ([]byte, []int) {
return fileDescriptor_91b94b655bd2a7e5, []int{0}
}
func (m *BytesMessage) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *BytesMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_BytesMessage.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *BytesMessage) XXX_Merge(src proto.Message) {
xxx_messageInfo_BytesMessage.Merge(m, src)
}
func (m *BytesMessage) XXX_Size() int {
return m.Size()
}
func (m *BytesMessage) XXX_DiscardUnknown() {
xxx_messageInfo_BytesMessage.DiscardUnknown(m)
return file_upload_proto_rawDescGZIP(), []int{0}
}
var xxx_messageInfo_BytesMessage proto.InternalMessageInfo
func (m *BytesMessage) GetData() []byte {
if m != nil {
return m.Data
func (x *BytesMessage) GetData() []byte {
if x != nil {
return x.Data
}
return nil
}
func init() {
proto.RegisterType((*BytesMessage)(nil), "moby.upload.v1.BytesMessage")
}
var File_upload_proto protoreflect.FileDescriptor
func init() { proto.RegisterFile("upload.proto", fileDescriptor_91b94b655bd2a7e5) }
var fileDescriptor_91b94b655bd2a7e5 = []byte{
// 179 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x2d, 0xc8, 0xc9,
0x4f, 0x4c, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcb, 0xcd, 0x4f, 0xaa, 0xd4, 0x83,
0x0a, 0x95, 0x19, 0x2a, 0x29, 0x71, 0xf1, 0x38, 0x55, 0x96, 0xa4, 0x16, 0xfb, 0xa6, 0x16, 0x17,
0x27, 0xa6, 0xa7, 0x0a, 0x09, 0x71, 0xb1, 0xa4, 0x24, 0x96, 0x24, 0x4a, 0x30, 0x2a, 0x30, 0x6a,
0xf0, 0x04, 0x81, 0xd9, 0x46, 0x01, 0x5c, 0x6c, 0xa1, 0x60, 0x0d, 0x42, 0x6e, 0x5c, 0x2c, 0x01,
0xa5, 0x39, 0x39, 0x42, 0x32, 0x7a, 0xa8, 0xc6, 0xe8, 0x21, 0x9b, 0x21, 0x85, 0x57, 0x56, 0x83,
0xd1, 0x80, 0xd1, 0xc9, 0xe6, 0xc2, 0x43, 0x39, 0x86, 0x1b, 0x0f, 0xe5, 0x18, 0x3e, 0x3c, 0x94,
0x63, 0x6c, 0x78, 0x24, 0xc7, 0xb8, 0xe2, 0x91, 0x1c, 0xe3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e,
0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0xf8, 0xe2, 0x91, 0x1c, 0xc3, 0x87, 0x47, 0x72, 0x8c, 0x13,
0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x14, 0x1b, 0xc4, 0xc4,
0x24, 0x36, 0xb0, 0x57, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x12, 0xf2, 0xfc, 0xb4, 0xda,
0x00, 0x00, 0x00,
}
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 *BytesMessage) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 5)
s = append(s, "&upload.BytesMessage{")
s = append(s, "Data: "+fmt.Sprintf("%#v", this.Data)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
func valueToGoStringUpload(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
// UploadClient is the client API for Upload service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type UploadClient interface {
Pull(ctx context.Context, opts ...grpc.CallOption) (Upload_PullClient, error)
}
type uploadClient struct {
cc *grpc.ClientConn
}
func NewUploadClient(cc *grpc.ClientConn) UploadClient {
return &uploadClient{cc}
}
func (c *uploadClient) Pull(ctx context.Context, opts ...grpc.CallOption) (Upload_PullClient, error) {
stream, err := c.cc.NewStream(ctx, &_Upload_serviceDesc.Streams[0], "/moby.upload.v1.Upload/Pull", opts...)
if err != nil {
return nil, err
}
x := &uploadPullClient{stream}
return x, nil
}
type Upload_PullClient interface {
Send(*BytesMessage) error
Recv() (*BytesMessage, error)
grpc.ClientStream
}
type uploadPullClient struct {
grpc.ClientStream
}
func (x *uploadPullClient) Send(m *BytesMessage) error {
return x.ClientStream.SendMsg(m)
}
func (x *uploadPullClient) Recv() (*BytesMessage, error) {
m := new(BytesMessage)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// UploadServer is the server API for Upload service.
type UploadServer interface {
Pull(Upload_PullServer) error
}
// UnimplementedUploadServer can be embedded to have forward compatible implementations.
type UnimplementedUploadServer struct {
}
func (*UnimplementedUploadServer) Pull(srv Upload_PullServer) error {
return status.Errorf(codes.Unimplemented, "method Pull not implemented")
}
func RegisterUploadServer(s *grpc.Server, srv UploadServer) {
s.RegisterService(&_Upload_serviceDesc, srv)
}
func _Upload_Pull_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(UploadServer).Pull(&uploadPullServer{stream})
}
type Upload_PullServer interface {
Send(*BytesMessage) error
Recv() (*BytesMessage, error)
grpc.ServerStream
}
type uploadPullServer struct {
grpc.ServerStream
}
func (x *uploadPullServer) Send(m *BytesMessage) error {
return x.ServerStream.SendMsg(m)
}
func (x *uploadPullServer) Recv() (*BytesMessage, error) {
m := new(BytesMessage)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
var _Upload_serviceDesc = grpc.ServiceDesc{
ServiceName: "moby.upload.v1.Upload",
HandlerType: (*UploadServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "Pull",
Handler: _Upload_Pull_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "upload.proto",
}
func (m *BytesMessage) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *BytesMessage) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *BytesMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Data) > 0 {
i -= len(m.Data)
copy(dAtA[i:], m.Data)
i = encodeVarintUpload(dAtA, i, uint64(len(m.Data)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintUpload(dAtA []byte, offset int, v uint64) int {
offset -= sovUpload(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *BytesMessage) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Data)
if l > 0 {
n += 1 + l + sovUpload(uint64(l))
}
return n
}
func sovUpload(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozUpload(x uint64) (n int) {
return sovUpload(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 valueToStringUpload(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 ErrIntOverflowUpload
}
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 ErrIntOverflowUpload
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthUpload
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthUpload
}
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 := skipUpload(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthUpload
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipUpload(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowUpload
}
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, ErrIntOverflowUpload
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowUpload
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthUpload
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupUpload
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthUpload
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
var file_upload_proto_rawDesc = []byte{
0x0a, 0x0c, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e,
0x6d, 0x6f, 0x62, 0x79, 0x2e, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x76, 0x31, 0x22, 0x22,
0x0a, 0x0c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12,
0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61,
0x74, 0x61, 0x32, 0x50, 0x0a, 0x06, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x46, 0x0a, 0x04,
0x50, 0x75, 0x6c, 0x6c, 0x12, 0x1c, 0x2e, 0x6d, 0x6f, 0x62, 0x79, 0x2e, 0x75, 0x70, 0x6c, 0x6f,
0x61, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x1a, 0x1c, 0x2e, 0x6d, 0x6f, 0x62, 0x79, 0x2e, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64,
0x2e, 0x76, 0x31, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x28, 0x01, 0x30, 0x01, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x6d, 0x6f, 0x62, 0x79, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74,
0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
ErrInvalidLengthUpload = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowUpload = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupUpload = fmt.Errorf("proto: unexpected end of group")
file_upload_proto_rawDescOnce sync.Once
file_upload_proto_rawDescData = file_upload_proto_rawDesc
)
func file_upload_proto_rawDescGZIP() []byte {
file_upload_proto_rawDescOnce.Do(func() {
file_upload_proto_rawDescData = protoimpl.X.CompressGZIP(file_upload_proto_rawDescData)
})
return file_upload_proto_rawDescData
}
var file_upload_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_upload_proto_goTypes = []interface{}{
(*BytesMessage)(nil), // 0: moby.upload.v1.BytesMessage
}
var file_upload_proto_depIdxs = []int32{
0, // 0: moby.upload.v1.Upload.Pull:input_type -> moby.upload.v1.BytesMessage
0, // 1: moby.upload.v1.Upload.Pull:output_type -> moby.upload.v1.BytesMessage
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_upload_proto_init() }
func file_upload_proto_init() {
if File_upload_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_upload_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BytesMessage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_upload_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_upload_proto_goTypes,
DependencyIndexes: file_upload_proto_depIdxs,
MessageInfos: file_upload_proto_msgTypes,
}.Build()
File_upload_proto = out.File
file_upload_proto_rawDesc = nil
file_upload_proto_goTypes = nil
file_upload_proto_depIdxs = nil
}

View File

@@ -2,7 +2,7 @@ syntax = "proto3";
package moby.upload.v1;
option go_package = "upload";
option go_package = "github.com/moby/buildkit/session/upload";
service Upload {
rpc Pull(stream BytesMessage) returns (stream BytesMessage);

View File

@@ -0,0 +1,113 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.11.4
// source: upload.proto
package upload
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Upload_Pull_FullMethodName = "/moby.upload.v1.Upload/Pull"
)
// UploadClient is the client API for Upload service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type UploadClient interface {
Pull(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BytesMessage, BytesMessage], error)
}
type uploadClient struct {
cc grpc.ClientConnInterface
}
func NewUploadClient(cc grpc.ClientConnInterface) UploadClient {
return &uploadClient{cc}
}
func (c *uploadClient) Pull(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BytesMessage, BytesMessage], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &Upload_ServiceDesc.Streams[0], Upload_Pull_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[BytesMessage, BytesMessage]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Upload_PullClient = grpc.BidiStreamingClient[BytesMessage, BytesMessage]
// UploadServer is the server API for Upload service.
// All implementations should embed UnimplementedUploadServer
// for forward compatibility.
type UploadServer interface {
Pull(grpc.BidiStreamingServer[BytesMessage, BytesMessage]) error
}
// UnimplementedUploadServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedUploadServer struct{}
func (UnimplementedUploadServer) Pull(grpc.BidiStreamingServer[BytesMessage, BytesMessage]) error {
return status.Errorf(codes.Unimplemented, "method Pull not implemented")
}
func (UnimplementedUploadServer) testEmbeddedByValue() {}
// UnsafeUploadServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to UploadServer will
// result in compilation errors.
type UnsafeUploadServer interface {
mustEmbedUnimplementedUploadServer()
}
func RegisterUploadServer(s grpc.ServiceRegistrar, srv UploadServer) {
// If the following call pancis, it indicates UnimplementedUploadServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Upload_ServiceDesc, srv)
}
func _Upload_Pull_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(UploadServer).Pull(&grpc.GenericServerStream[BytesMessage, BytesMessage]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Upload_PullServer = grpc.BidiStreamingServer[BytesMessage, BytesMessage]
// Upload_ServiceDesc is the grpc.ServiceDesc for Upload service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Upload_ServiceDesc = grpc.ServiceDesc{
ServiceName: "moby.upload.v1.Upload",
HandlerType: (*UploadServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "Pull",
Handler: _Upload_Pull_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "upload.proto",
}

View File

@@ -1,238 +1,290 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc v3.11.4
// source: errdefs.proto
package errdefs
import (
fmt "fmt"
proto "github.com/gogo/protobuf/proto"
pb "github.com/moby/buildkit/solver/pb"
math "math"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Vertex struct {
Digest string `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Digest string `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"`
}
func (m *Vertex) Reset() { *m = Vertex{} }
func (m *Vertex) String() string { return proto.CompactTextString(m) }
func (*Vertex) ProtoMessage() {}
func (x *Vertex) Reset() {
*x = Vertex{}
if protoimpl.UnsafeEnabled {
mi := &file_errdefs_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Vertex) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Vertex) ProtoMessage() {}
func (x *Vertex) ProtoReflect() protoreflect.Message {
mi := &file_errdefs_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Vertex.ProtoReflect.Descriptor instead.
func (*Vertex) Descriptor() ([]byte, []int) {
return fileDescriptor_689dc58a5060aff5, []int{0}
}
func (m *Vertex) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Vertex.Unmarshal(m, b)
}
func (m *Vertex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Vertex.Marshal(b, m, deterministic)
}
func (m *Vertex) XXX_Merge(src proto.Message) {
xxx_messageInfo_Vertex.Merge(m, src)
}
func (m *Vertex) XXX_Size() int {
return xxx_messageInfo_Vertex.Size(m)
}
func (m *Vertex) XXX_DiscardUnknown() {
xxx_messageInfo_Vertex.DiscardUnknown(m)
return file_errdefs_proto_rawDescGZIP(), []int{0}
}
var xxx_messageInfo_Vertex proto.InternalMessageInfo
func (m *Vertex) GetDigest() string {
if m != nil {
return m.Digest
func (x *Vertex) GetDigest() string {
if x != nil {
return x.Digest
}
return ""
}
type Source struct {
Info *pb.SourceInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
Ranges []*pb.Range `protobuf:"bytes,2,rep,name=ranges,proto3" json:"ranges,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Info *pb.SourceInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
Ranges []*pb.Range `protobuf:"bytes,2,rep,name=ranges,proto3" json:"ranges,omitempty"`
}
func (m *Source) Reset() { *m = Source{} }
func (m *Source) String() string { return proto.CompactTextString(m) }
func (*Source) ProtoMessage() {}
func (x *Source) Reset() {
*x = Source{}
if protoimpl.UnsafeEnabled {
mi := &file_errdefs_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Source) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Source) ProtoMessage() {}
func (x *Source) ProtoReflect() protoreflect.Message {
mi := &file_errdefs_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Source.ProtoReflect.Descriptor instead.
func (*Source) Descriptor() ([]byte, []int) {
return fileDescriptor_689dc58a5060aff5, []int{1}
}
func (m *Source) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Source.Unmarshal(m, b)
}
func (m *Source) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Source.Marshal(b, m, deterministic)
}
func (m *Source) XXX_Merge(src proto.Message) {
xxx_messageInfo_Source.Merge(m, src)
}
func (m *Source) XXX_Size() int {
return xxx_messageInfo_Source.Size(m)
}
func (m *Source) XXX_DiscardUnknown() {
xxx_messageInfo_Source.DiscardUnknown(m)
return file_errdefs_proto_rawDescGZIP(), []int{1}
}
var xxx_messageInfo_Source proto.InternalMessageInfo
func (m *Source) GetInfo() *pb.SourceInfo {
if m != nil {
return m.Info
func (x *Source) GetInfo() *pb.SourceInfo {
if x != nil {
return x.Info
}
return nil
}
func (m *Source) GetRanges() []*pb.Range {
if m != nil {
return m.Ranges
func (x *Source) GetRanges() []*pb.Range {
if x != nil {
return x.Ranges
}
return nil
}
type FrontendCap struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
}
func (m *FrontendCap) Reset() { *m = FrontendCap{} }
func (m *FrontendCap) String() string { return proto.CompactTextString(m) }
func (*FrontendCap) ProtoMessage() {}
func (x *FrontendCap) Reset() {
*x = FrontendCap{}
if protoimpl.UnsafeEnabled {
mi := &file_errdefs_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FrontendCap) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FrontendCap) ProtoMessage() {}
func (x *FrontendCap) ProtoReflect() protoreflect.Message {
mi := &file_errdefs_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FrontendCap.ProtoReflect.Descriptor instead.
func (*FrontendCap) Descriptor() ([]byte, []int) {
return fileDescriptor_689dc58a5060aff5, []int{2}
}
func (m *FrontendCap) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FrontendCap.Unmarshal(m, b)
}
func (m *FrontendCap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_FrontendCap.Marshal(b, m, deterministic)
}
func (m *FrontendCap) XXX_Merge(src proto.Message) {
xxx_messageInfo_FrontendCap.Merge(m, src)
}
func (m *FrontendCap) XXX_Size() int {
return xxx_messageInfo_FrontendCap.Size(m)
}
func (m *FrontendCap) XXX_DiscardUnknown() {
xxx_messageInfo_FrontendCap.DiscardUnknown(m)
return file_errdefs_proto_rawDescGZIP(), []int{2}
}
var xxx_messageInfo_FrontendCap proto.InternalMessageInfo
func (m *FrontendCap) GetName() string {
if m != nil {
return m.Name
func (x *FrontendCap) GetName() string {
if x != nil {
return x.Name
}
return ""
}
type Subrequest struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
}
func (m *Subrequest) Reset() { *m = Subrequest{} }
func (m *Subrequest) String() string { return proto.CompactTextString(m) }
func (*Subrequest) ProtoMessage() {}
func (x *Subrequest) Reset() {
*x = Subrequest{}
if protoimpl.UnsafeEnabled {
mi := &file_errdefs_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Subrequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Subrequest) ProtoMessage() {}
func (x *Subrequest) ProtoReflect() protoreflect.Message {
mi := &file_errdefs_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Subrequest.ProtoReflect.Descriptor instead.
func (*Subrequest) Descriptor() ([]byte, []int) {
return fileDescriptor_689dc58a5060aff5, []int{3}
}
func (m *Subrequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Subrequest.Unmarshal(m, b)
}
func (m *Subrequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Subrequest.Marshal(b, m, deterministic)
}
func (m *Subrequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_Subrequest.Merge(m, src)
}
func (m *Subrequest) XXX_Size() int {
return xxx_messageInfo_Subrequest.Size(m)
}
func (m *Subrequest) XXX_DiscardUnknown() {
xxx_messageInfo_Subrequest.DiscardUnknown(m)
return file_errdefs_proto_rawDescGZIP(), []int{3}
}
var xxx_messageInfo_Subrequest proto.InternalMessageInfo
func (m *Subrequest) GetName() string {
if m != nil {
return m.Name
func (x *Subrequest) GetName() string {
if x != nil {
return x.Name
}
return ""
}
type Solve struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
InputIDs []string `protobuf:"bytes,1,rep,name=inputIDs,proto3" json:"inputIDs,omitempty"`
MountIDs []string `protobuf:"bytes,2,rep,name=mountIDs,proto3" json:"mountIDs,omitempty"`
Op *pb.Op `protobuf:"bytes,3,opt,name=op,proto3" json:"op,omitempty"`
// Types that are valid to be assigned to Subject:
// Types that are assignable to Subject:
//
// *Solve_File
// *Solve_Cache
Subject isSolve_Subject `protobuf_oneof:"subject"`
Description map[string]string `protobuf:"bytes,6,rep,name=description,proto3" json:"description,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Subject isSolve_Subject `protobuf_oneof:"subject"`
Description map[string]string `protobuf:"bytes,6,rep,name=description,proto3" json:"description,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (m *Solve) Reset() { *m = Solve{} }
func (m *Solve) String() string { return proto.CompactTextString(m) }
func (*Solve) ProtoMessage() {}
func (x *Solve) Reset() {
*x = Solve{}
if protoimpl.UnsafeEnabled {
mi := &file_errdefs_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Solve) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Solve) ProtoMessage() {}
func (x *Solve) ProtoReflect() protoreflect.Message {
mi := &file_errdefs_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Solve.ProtoReflect.Descriptor instead.
func (*Solve) Descriptor() ([]byte, []int) {
return fileDescriptor_689dc58a5060aff5, []int{4}
}
func (m *Solve) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Solve.Unmarshal(m, b)
}
func (m *Solve) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Solve.Marshal(b, m, deterministic)
}
func (m *Solve) XXX_Merge(src proto.Message) {
xxx_messageInfo_Solve.Merge(m, src)
}
func (m *Solve) XXX_Size() int {
return xxx_messageInfo_Solve.Size(m)
}
func (m *Solve) XXX_DiscardUnknown() {
xxx_messageInfo_Solve.DiscardUnknown(m)
return file_errdefs_proto_rawDescGZIP(), []int{4}
}
var xxx_messageInfo_Solve proto.InternalMessageInfo
type isSolve_Subject interface {
isSolve_Subject()
func (x *Solve) GetInputIDs() []string {
if x != nil {
return x.InputIDs
}
return nil
}
type Solve_File struct {
File *FileAction `protobuf:"bytes,4,opt,name=file,proto3,oneof" json:"file,omitempty"`
}
type Solve_Cache struct {
Cache *ContentCache `protobuf:"bytes,5,opt,name=cache,proto3,oneof" json:"cache,omitempty"`
func (x *Solve) GetMountIDs() []string {
if x != nil {
return x.MountIDs
}
return nil
}
func (*Solve_File) isSolve_Subject() {}
func (*Solve_Cache) isSolve_Subject() {}
func (x *Solve) GetOp() *pb.Op {
if x != nil {
return x.Op
}
return nil
}
func (m *Solve) GetSubject() isSolve_Subject {
if m != nil {
@@ -241,173 +293,339 @@ func (m *Solve) GetSubject() isSolve_Subject {
return nil
}
func (m *Solve) GetInputIDs() []string {
if m != nil {
return m.InputIDs
}
return nil
}
func (m *Solve) GetMountIDs() []string {
if m != nil {
return m.MountIDs
}
return nil
}
func (m *Solve) GetOp() *pb.Op {
if m != nil {
return m.Op
}
return nil
}
func (m *Solve) GetFile() *FileAction {
if x, ok := m.GetSubject().(*Solve_File); ok {
func (x *Solve) GetFile() *FileAction {
if x, ok := x.GetSubject().(*Solve_File); ok {
return x.File
}
return nil
}
func (m *Solve) GetCache() *ContentCache {
if x, ok := m.GetSubject().(*Solve_Cache); ok {
func (x *Solve) GetCache() *ContentCache {
if x, ok := x.GetSubject().(*Solve_Cache); ok {
return x.Cache
}
return nil
}
func (m *Solve) GetDescription() map[string]string {
if m != nil {
return m.Description
func (x *Solve) GetDescription() map[string]string {
if x != nil {
return x.Description
}
return nil
}
// XXX_OneofWrappers is for the internal use of the proto package.
func (*Solve) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*Solve_File)(nil),
(*Solve_Cache)(nil),
type isSolve_Subject interface {
isSolve_Subject()
}
type Solve_File struct {
File *FileAction `protobuf:"bytes,4,opt,name=file,proto3,oneof"`
}
type Solve_Cache struct {
Cache *ContentCache `protobuf:"bytes,5,opt,name=cache,proto3,oneof"`
}
func (*Solve_File) isSolve_Subject() {}
func (*Solve_Cache) isSolve_Subject() {}
type FileAction struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Index of the file action that failed the exec.
Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
}
func (x *FileAction) Reset() {
*x = FileAction{}
if protoimpl.UnsafeEnabled {
mi := &file_errdefs_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
type FileAction struct {
// Index of the file action that failed the exec.
Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
func (x *FileAction) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (m *FileAction) Reset() { *m = FileAction{} }
func (m *FileAction) String() string { return proto.CompactTextString(m) }
func (*FileAction) ProtoMessage() {}
func (*FileAction) ProtoMessage() {}
func (x *FileAction) ProtoReflect() protoreflect.Message {
mi := &file_errdefs_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FileAction.ProtoReflect.Descriptor instead.
func (*FileAction) Descriptor() ([]byte, []int) {
return fileDescriptor_689dc58a5060aff5, []int{5}
}
func (m *FileAction) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FileAction.Unmarshal(m, b)
}
func (m *FileAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_FileAction.Marshal(b, m, deterministic)
}
func (m *FileAction) XXX_Merge(src proto.Message) {
xxx_messageInfo_FileAction.Merge(m, src)
}
func (m *FileAction) XXX_Size() int {
return xxx_messageInfo_FileAction.Size(m)
}
func (m *FileAction) XXX_DiscardUnknown() {
xxx_messageInfo_FileAction.DiscardUnknown(m)
return file_errdefs_proto_rawDescGZIP(), []int{5}
}
var xxx_messageInfo_FileAction proto.InternalMessageInfo
func (m *FileAction) GetIndex() int64 {
if m != nil {
return m.Index
func (x *FileAction) GetIndex() int64 {
if x != nil {
return x.Index
}
return 0
}
type ContentCache struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Original index of result that failed the slow cache calculation.
Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
}
func (m *ContentCache) Reset() { *m = ContentCache{} }
func (m *ContentCache) String() string { return proto.CompactTextString(m) }
func (*ContentCache) ProtoMessage() {}
func (x *ContentCache) Reset() {
*x = ContentCache{}
if protoimpl.UnsafeEnabled {
mi := &file_errdefs_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ContentCache) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ContentCache) ProtoMessage() {}
func (x *ContentCache) ProtoReflect() protoreflect.Message {
mi := &file_errdefs_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ContentCache.ProtoReflect.Descriptor instead.
func (*ContentCache) Descriptor() ([]byte, []int) {
return fileDescriptor_689dc58a5060aff5, []int{6}
}
func (m *ContentCache) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ContentCache.Unmarshal(m, b)
}
func (m *ContentCache) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ContentCache.Marshal(b, m, deterministic)
}
func (m *ContentCache) XXX_Merge(src proto.Message) {
xxx_messageInfo_ContentCache.Merge(m, src)
}
func (m *ContentCache) XXX_Size() int {
return xxx_messageInfo_ContentCache.Size(m)
}
func (m *ContentCache) XXX_DiscardUnknown() {
xxx_messageInfo_ContentCache.DiscardUnknown(m)
return file_errdefs_proto_rawDescGZIP(), []int{6}
}
var xxx_messageInfo_ContentCache proto.InternalMessageInfo
func (m *ContentCache) GetIndex() int64 {
if m != nil {
return m.Index
func (x *ContentCache) GetIndex() int64 {
if x != nil {
return x.Index
}
return 0
}
func init() {
proto.RegisterType((*Vertex)(nil), "errdefs.Vertex")
proto.RegisterType((*Source)(nil), "errdefs.Source")
proto.RegisterType((*FrontendCap)(nil), "errdefs.FrontendCap")
proto.RegisterType((*Subrequest)(nil), "errdefs.Subrequest")
proto.RegisterType((*Solve)(nil), "errdefs.Solve")
proto.RegisterMapType((map[string]string)(nil), "errdefs.Solve.DescriptionEntry")
proto.RegisterType((*FileAction)(nil), "errdefs.FileAction")
proto.RegisterType((*ContentCache)(nil), "errdefs.ContentCache")
var File_errdefs_proto protoreflect.FileDescriptor
var file_errdefs_proto_rawDesc = []byte{
0x0a, 0x0d, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x07, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73, 0x1a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x6f, 0x62, 0x79, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x6b,
0x69, 0x74, 0x2f, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x62, 0x2f, 0x6f, 0x70, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x20, 0x0a, 0x06, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78,
0x12, 0x16, 0x0a, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x06, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x22, 0x4f, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x12, 0x22, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x21, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73,
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67,
0x65, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x22, 0x21, 0x0a, 0x0b, 0x46, 0x72, 0x6f,
0x6e, 0x74, 0x65, 0x6e, 0x64, 0x43, 0x61, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x0a, 0x0a,
0x53, 0x75, 0x62, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xbf,
0x02, 0x0a, 0x05, 0x53, 0x6f, 0x6c, 0x76, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x70, 0x75,
0x74, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x70, 0x75,
0x74, 0x49, 0x44, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x73,
0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x73,
0x12, 0x16, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x70,
0x62, 0x2e, 0x4f, 0x70, 0x52, 0x02, 0x6f, 0x70, 0x12, 0x29, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65,
0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73,
0x2e, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x66,
0x69, 0x6c, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x63, 0x61, 0x63, 0x68, 0x65, 0x18, 0x05, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x15, 0x2e, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e,
0x74, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x63, 0x68, 0x65, 0x48, 0x00, 0x52, 0x05, 0x63, 0x61, 0x63,
0x68, 0x65, 0x12, 0x41, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66,
0x73, 0x2e, 0x53, 0x6f, 0x6c, 0x76, 0x65, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x3e, 0x0a, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74,
0x22, 0x22, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14,
0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x69,
0x6e, 0x64, 0x65, 0x78, 0x22, 0x24, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x43,
0x61, 0x63, 0x68, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20,
0x01, 0x28, 0x03, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x6f, 0x62, 0x79, 0x2f, 0x62, 0x75,
0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x2f, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x72, 0x2f, 0x65, 0x72,
0x72, 0x64, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
func init() { proto.RegisterFile("errdefs.proto", fileDescriptor_689dc58a5060aff5) }
var (
file_errdefs_proto_rawDescOnce sync.Once
file_errdefs_proto_rawDescData = file_errdefs_proto_rawDesc
)
var fileDescriptor_689dc58a5060aff5 = []byte{
// 411 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xcf, 0x6f, 0xd3, 0x30,
0x14, 0xc7, 0xd7, 0xa4, 0xcd, 0xe8, 0x2b, 0xa0, 0xc9, 0xc0, 0x14, 0xf5, 0x42, 0x66, 0x71, 0x28,
0x12, 0x24, 0xd2, 0xb8, 0x20, 0x0e, 0x48, 0xa3, 0x63, 0xda, 0x4e, 0x93, 0x5c, 0x89, 0x7b, 0x9c,
0xbc, 0x76, 0x66, 0xa9, 0x6d, 0xfc, 0x63, 0x5a, 0xff, 0x3a, 0xfe, 0x35, 0x64, 0x27, 0xeb, 0x26,
0xb4, 0x9b, 0xbf, 0xfe, 0x7c, 0x9e, 0xdb, 0xef, 0x53, 0xe0, 0x15, 0x1a, 0xd3, 0xe2, 0xda, 0x96,
0xda, 0x28, 0xa7, 0xc8, 0xe1, 0x10, 0xe7, 0x9f, 0x36, 0xc2, 0xdd, 0x78, 0x5e, 0x36, 0x6a, 0x5b,
0x6d, 0x15, 0xdf, 0x55, 0xdc, 0x8b, 0xae, 0xbd, 0x15, 0xae, 0xb2, 0xaa, 0xbb, 0x43, 0x53, 0x69,
0x5e, 0x29, 0x3d, 0x8c, 0xd1, 0x02, 0xb2, 0x5f, 0x68, 0x1c, 0xde, 0x93, 0x63, 0xc8, 0x5a, 0xb1,
0x41, 0xeb, 0xf2, 0x51, 0x31, 0x5a, 0x4c, 0xd9, 0x90, 0xe8, 0x35, 0x64, 0x2b, 0xe5, 0x4d, 0x83,
0x84, 0xc2, 0x58, 0xc8, 0xb5, 0x8a, 0x7c, 0x76, 0xfa, 0xba, 0xd4, 0xbc, 0xec, 0xc9, 0x95, 0x5c,
0x2b, 0x16, 0x19, 0x39, 0x81, 0xcc, 0xd4, 0x72, 0x83, 0x36, 0x4f, 0x8a, 0x74, 0x31, 0x3b, 0x9d,
0x06, 0x8b, 0x85, 0x1b, 0x36, 0x00, 0x7a, 0x02, 0xb3, 0x0b, 0xa3, 0xa4, 0x43, 0xd9, 0x2e, 0x6b,
0x4d, 0x08, 0x8c, 0x65, 0xbd, 0xc5, 0xe1, 0x57, 0xe3, 0x99, 0x16, 0x00, 0x2b, 0xcf, 0x0d, 0xfe,
0xf1, 0x68, 0xdd, 0xb3, 0xc6, 0xdf, 0x04, 0x26, 0xab, 0xd0, 0x87, 0xcc, 0xe1, 0x85, 0x90, 0xda,
0xbb, 0xab, 0x73, 0x9b, 0x8f, 0x8a, 0x74, 0x31, 0x65, 0xfb, 0x1c, 0xd8, 0x56, 0x79, 0x19, 0x59,
0xd2, 0xb3, 0x87, 0x4c, 0x8e, 0x21, 0x51, 0x3a, 0x4f, 0x63, 0x97, 0x2c, 0xfc, 0xcb, 0x6b, 0xcd,
0x12, 0xa5, 0xc9, 0x47, 0x18, 0xaf, 0x45, 0x87, 0xf9, 0x38, 0x92, 0x37, 0xe5, 0xc3, 0x9a, 0x2f,
0x44, 0x87, 0x67, 0x8d, 0x13, 0x4a, 0x5e, 0x1e, 0xb0, 0xa8, 0x90, 0xcf, 0x30, 0x69, 0xea, 0xe6,
0x06, 0xf3, 0x49, 0x74, 0xdf, 0xed, 0xdd, 0x65, 0xac, 0xe7, 0x96, 0x01, 0x5e, 0x1e, 0xb0, 0xde,
0x22, 0x67, 0x30, 0x6b, 0xd1, 0x36, 0x46, 0xe8, 0xf0, 0x4a, 0x9e, 0xc5, 0x05, 0xbd, 0xdf, 0x0f,
0xc5, 0x3a, 0xe5, 0xf9, 0xa3, 0xf1, 0x53, 0x3a, 0xb3, 0x63, 0x4f, 0x67, 0xe6, 0xdf, 0xe1, 0xe8,
0x7f, 0x81, 0x1c, 0x41, 0x7a, 0x8b, 0xbb, 0x61, 0x3b, 0xe1, 0x48, 0xde, 0xc2, 0xe4, 0xae, 0xee,
0x3c, 0xe6, 0x49, 0xbc, 0xeb, 0xc3, 0xb7, 0xe4, 0xeb, 0xe8, 0xc7, 0x14, 0x0e, 0xad, 0xe7, 0xbf,
0xb1, 0x71, 0x94, 0x02, 0x3c, 0x56, 0x0a, 0x23, 0x42, 0xb6, 0x78, 0x1f, 0x9f, 0x49, 0x59, 0x1f,
0xe8, 0x07, 0x78, 0xf9, 0xb4, 0xca, 0xf3, 0x16, 0xcf, 0xe2, 0xa7, 0xf4, 0xe5, 0x5f, 0x00, 0x00,
0x00, 0xff, 0xff, 0xc3, 0xd2, 0x7f, 0xe2, 0x92, 0x02, 0x00, 0x00,
func file_errdefs_proto_rawDescGZIP() []byte {
file_errdefs_proto_rawDescOnce.Do(func() {
file_errdefs_proto_rawDescData = protoimpl.X.CompressGZIP(file_errdefs_proto_rawDescData)
})
return file_errdefs_proto_rawDescData
}
var file_errdefs_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_errdefs_proto_goTypes = []interface{}{
(*Vertex)(nil), // 0: errdefs.Vertex
(*Source)(nil), // 1: errdefs.Source
(*FrontendCap)(nil), // 2: errdefs.FrontendCap
(*Subrequest)(nil), // 3: errdefs.Subrequest
(*Solve)(nil), // 4: errdefs.Solve
(*FileAction)(nil), // 5: errdefs.FileAction
(*ContentCache)(nil), // 6: errdefs.ContentCache
nil, // 7: errdefs.Solve.DescriptionEntry
(*pb.SourceInfo)(nil), // 8: pb.SourceInfo
(*pb.Range)(nil), // 9: pb.Range
(*pb.Op)(nil), // 10: pb.Op
}
var file_errdefs_proto_depIdxs = []int32{
8, // 0: errdefs.Source.info:type_name -> pb.SourceInfo
9, // 1: errdefs.Source.ranges:type_name -> pb.Range
10, // 2: errdefs.Solve.op:type_name -> pb.Op
5, // 3: errdefs.Solve.file:type_name -> errdefs.FileAction
6, // 4: errdefs.Solve.cache:type_name -> errdefs.ContentCache
7, // 5: errdefs.Solve.description:type_name -> errdefs.Solve.DescriptionEntry
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_errdefs_proto_init() }
func file_errdefs_proto_init() {
if File_errdefs_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_errdefs_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Vertex); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_errdefs_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Source); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_errdefs_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FrontendCap); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_errdefs_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Subrequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_errdefs_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Solve); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_errdefs_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FileAction); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_errdefs_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ContentCache); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_errdefs_proto_msgTypes[4].OneofWrappers = []interface{}{
(*Solve_File)(nil),
(*Solve_Cache)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_errdefs_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_errdefs_proto_goTypes,
DependencyIndexes: file_errdefs_proto_depIdxs,
MessageInfos: file_errdefs_proto_msgTypes,
}.Build()
File_errdefs_proto = out.File
file_errdefs_proto_rawDesc = nil
file_errdefs_proto_goTypes = nil
file_errdefs_proto_depIdxs = nil
}

View File

@@ -2,6 +2,8 @@ syntax = "proto3";
package errdefs;
option go_package = "github.com/moby/buildkit/solver/errdefs";
import "github.com/moby/buildkit/solver/pb/ops.proto";
message Vertex {

View File

@@ -12,7 +12,7 @@ func init() {
}
type UnsupportedFrontendCapError struct {
FrontendCap
*FrontendCap
error
}
@@ -29,13 +29,13 @@ func (e *UnsupportedFrontendCapError) Unwrap() error {
}
func (e *UnsupportedFrontendCapError) ToProto() grpcerrors.TypedErrorProto {
return &e.FrontendCap
return e.FrontendCap
}
func NewUnsupportedFrontendCapError(name string) error {
return &UnsupportedFrontendCapError{FrontendCap: FrontendCap{Name: name}}
return &UnsupportedFrontendCapError{FrontendCap: &FrontendCap{Name: name}}
}
func (v *FrontendCap) WrapError(err error) error {
return &UnsupportedFrontendCapError{error: err, FrontendCap: *v}
return &UnsupportedFrontendCapError{error: err, FrontendCap: v}
}

View File

@@ -1,3 +1,3 @@
package errdefs
//go:generate protoc -I=. -I=../../vendor/ -I=../../../../../ --gogo_out=. errdefs.proto
//go:generate protoc -I=. -I=../../vendor/ -I=../../../../../ --go_out=paths=source_relative:. errdefs.proto

View File

@@ -20,7 +20,7 @@ type IsSolve_Subject isSolve_Subject
// SolveError will be returned when an error is encountered during a solve that
// has an exec op.
type SolveError struct {
Solve
*Solve
Err error
}
@@ -33,7 +33,7 @@ func (e *SolveError) Unwrap() error {
}
func (e *SolveError) ToProto() grpcerrors.TypedErrorProto {
return &e.Solve
return e.Solve
}
func WithSolveError(err error, subject IsSolve_Subject, inputIDs, mountIDs []string) error {
@@ -51,7 +51,7 @@ func WithSolveError(err error, subject IsSolve_Subject, inputIDs, mountIDs []str
}
return &SolveError{
Err: err,
Solve: Solve{
Solve: &Solve{
InputIDs: inputIDs,
MountIDs: mountIDs,
Op: op,
@@ -62,7 +62,7 @@ func WithSolveError(err error, subject IsSolve_Subject, inputIDs, mountIDs []str
}
func (v *Solve) WrapError(err error) error {
return &SolveError{Err: err, Solve: *v}
return &SolveError{Err: err, Solve: v}
}
func (v *Solve) MarshalJSON() ([]byte, error) {

View File

@@ -8,9 +8,10 @@ import (
pb "github.com/moby/buildkit/solver/pb"
"github.com/moby/buildkit/util/grpcerrors"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
)
func WithSource(err error, src Source) error {
func WithSource(err error, src *Source) error {
if err == nil {
return nil
}
@@ -18,7 +19,7 @@ func WithSource(err error, src Source) error {
}
type ErrorSource struct {
Source
*Source
error
}
@@ -27,7 +28,7 @@ func (e *ErrorSource) Unwrap() error {
}
func (e *ErrorSource) ToProto() grpcerrors.TypedErrorProto {
return &e.Source
return e.Source
}
func Sources(err error) []*Source {
@@ -35,13 +36,13 @@ func Sources(err error) []*Source {
var es *ErrorSource
if errors.As(err, &es) {
out = Sources(es.Unwrap())
out = append(out, &es.Source)
out = append(out, proto.Clone(es.Source).(*Source))
}
return out
}
func (s *Source) WrapError(err error) error {
return &ErrorSource{error: err, Source: *s}
return &ErrorSource{error: err, Source: s}
}
func (s *Source) Print(w io.Writer) error {

View File

@@ -12,7 +12,7 @@ func init() {
}
type UnsupportedSubrequestError struct {
Subrequest
*Subrequest
error
}
@@ -29,13 +29,13 @@ func (e *UnsupportedSubrequestError) Unwrap() error {
}
func (e *UnsupportedSubrequestError) ToProto() grpcerrors.TypedErrorProto {
return &e.Subrequest
return e.Subrequest
}
func NewUnsupportedSubrequestError(name string) error {
return &UnsupportedSubrequestError{Subrequest: Subrequest{Name: name}}
return &UnsupportedSubrequestError{Subrequest: &Subrequest{Name: name}}
}
func (v *Subrequest) WrapError(err error) error {
return &UnsupportedSubrequestError{error: err, Subrequest: *v}
return &UnsupportedSubrequestError{error: err, Subrequest: v}
}

View File

@@ -12,7 +12,7 @@ func init() {
}
type VertexError struct {
Vertex
*Vertex
error
}
@@ -21,16 +21,16 @@ func (e *VertexError) Unwrap() error {
}
func (e *VertexError) ToProto() grpcerrors.TypedErrorProto {
return &e.Vertex
return e.Vertex
}
func WrapVertex(err error, dgst digest.Digest) error {
if err == nil {
return nil
}
return &VertexError{Vertex: Vertex{Digest: dgst.String()}, error: err}
return &VertexError{Vertex: &Vertex{Digest: dgst.String()}, error: err}
}
func (v *Vertex) WrapError(err error) error {
return &VertexError{error: err, Vertex: *v}
return &VertexError{error: err, Vertex: v}
}

View File

@@ -19,7 +19,7 @@ type BuildConfig struct {
type BuildStep struct {
ID string `json:"id,omitempty"`
Op pb.Op `json:"op,omitempty"`
Op *pb.Op `json:"op,omitempty"`
Inputs []string `json:"inputs,omitempty"`
ResourceUsage *resourcestypes.Samples `json:"resourceUsage,omitempty"`
}

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))
}

View File

@@ -1,3 +1,3 @@
package moby_buildkit_v1_sourcepolicy //nolint:revive
//go:generate protoc -I=. --gogofaster_out=plugins=grpc:. policy.proto
//go:generate protoc -I=. --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative,require_unimplemented_servers=false:. policy.proto

View File

@@ -1,7 +1,7 @@
package moby_buildkit_v1_sourcepolicy //nolint:revive
import (
"github.com/gogo/protobuf/proto"
"github.com/moby/buildkit/util/gogo/proto"
"github.com/pkg/errors"
)

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,8 @@ syntax = "proto3";
package moby.buildkit.v1.sourcepolicy;
option go_package = "github.com/moby/buildkit/sourcepolicy/pb;moby_buildkit_v1_sourcepolicy";
// Rule defines the action(s) to take when a source is matched
message Rule {
PolicyAction action = 1;
@@ -61,4 +63,4 @@ enum MatchType {
// REGEX treats the source identifier as a regular expression
// With regex matching you can also use match groups to replace values in the destination identifier
REGEX = 2;
}
}

View File

@@ -64,10 +64,10 @@ func (l *CapList) Init(cc ...Cap) {
}
// All reports the configuration of all known capabilities
func (l *CapList) All() []pb.APICap {
out := make([]pb.APICap, 0, len(l.m))
func (l *CapList) All() []*pb.APICap {
out := make([]*pb.APICap, 0, len(l.m))
for _, c := range l.m {
out = append(out, pb.APICap{
out = append(out, &pb.APICap{
ID: string(c.ID),
Enabled: c.Enabled,
Deprecated: c.Deprecated,
@@ -83,12 +83,11 @@ func (l *CapList) All() []pb.APICap {
}
// CapSet returns a CapSet for an capability configuration
func (l *CapList) CapSet(caps []pb.APICap) CapSet {
func (l *CapList) CapSet(caps []*pb.APICap) CapSet {
m := make(map[string]*pb.APICap, len(caps))
for _, c := range caps {
if c.ID != "" {
c := c // capture loop iterator
m[c.ID] = &c
m[c.ID] = c
}
}
return CapSet{

View File

@@ -1,567 +1,198 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc v3.11.4
// source: caps.proto
package moby_buildkit_v1_apicaps
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// APICap defines a capability supported by the service
type APICap struct {
ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
Enabled bool `protobuf:"varint,2,opt,name=Enabled,proto3" json:"Enabled,omitempty"`
Deprecated bool `protobuf:"varint,3,opt,name=Deprecated,proto3" json:"Deprecated,omitempty"`
DisabledReason string `protobuf:"bytes,4,opt,name=DisabledReason,proto3" json:"DisabledReason,omitempty"`
DisabledReasonMsg string `protobuf:"bytes,5,opt,name=DisabledReasonMsg,proto3" json:"DisabledReasonMsg,omitempty"`
DisabledAlternative string `protobuf:"bytes,6,opt,name=DisabledAlternative,proto3" json:"DisabledAlternative,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
Enabled bool `protobuf:"varint,2,opt,name=Enabled,proto3" json:"Enabled,omitempty"`
Deprecated bool `protobuf:"varint,3,opt,name=Deprecated,proto3" json:"Deprecated,omitempty"` // Unused. May be used for warnings in the future
DisabledReason string `protobuf:"bytes,4,opt,name=DisabledReason,proto3" json:"DisabledReason,omitempty"` // Reason key for detection code
DisabledReasonMsg string `protobuf:"bytes,5,opt,name=DisabledReasonMsg,proto3" json:"DisabledReasonMsg,omitempty"` // Message to the user
DisabledAlternative string `protobuf:"bytes,6,opt,name=DisabledAlternative,proto3" json:"DisabledAlternative,omitempty"` // Identifier that updated client could catch.
}
func (m *APICap) Reset() { *m = APICap{} }
func (m *APICap) String() string { return proto.CompactTextString(m) }
func (*APICap) ProtoMessage() {}
func (x *APICap) Reset() {
*x = APICap{}
if protoimpl.UnsafeEnabled {
mi := &file_caps_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *APICap) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*APICap) ProtoMessage() {}
func (x *APICap) ProtoReflect() protoreflect.Message {
mi := &file_caps_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use APICap.ProtoReflect.Descriptor instead.
func (*APICap) Descriptor() ([]byte, []int) {
return fileDescriptor_e19c39d9fcb89b83, []int{0}
}
func (m *APICap) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *APICap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_APICap.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *APICap) XXX_Merge(src proto.Message) {
xxx_messageInfo_APICap.Merge(m, src)
}
func (m *APICap) XXX_Size() int {
return m.Size()
}
func (m *APICap) XXX_DiscardUnknown() {
xxx_messageInfo_APICap.DiscardUnknown(m)
return file_caps_proto_rawDescGZIP(), []int{0}
}
var xxx_messageInfo_APICap proto.InternalMessageInfo
func (m *APICap) GetID() string {
if m != nil {
return m.ID
func (x *APICap) GetID() string {
if x != nil {
return x.ID
}
return ""
}
func (m *APICap) GetEnabled() bool {
if m != nil {
return m.Enabled
func (x *APICap) GetEnabled() bool {
if x != nil {
return x.Enabled
}
return false
}
func (m *APICap) GetDeprecated() bool {
if m != nil {
return m.Deprecated
func (x *APICap) GetDeprecated() bool {
if x != nil {
return x.Deprecated
}
return false
}
func (m *APICap) GetDisabledReason() string {
if m != nil {
return m.DisabledReason
func (x *APICap) GetDisabledReason() string {
if x != nil {
return x.DisabledReason
}
return ""
}
func (m *APICap) GetDisabledReasonMsg() string {
if m != nil {
return m.DisabledReasonMsg
func (x *APICap) GetDisabledReasonMsg() string {
if x != nil {
return x.DisabledReasonMsg
}
return ""
}
func (m *APICap) GetDisabledAlternative() string {
if m != nil {
return m.DisabledAlternative
func (x *APICap) GetDisabledAlternative() string {
if x != nil {
return x.DisabledAlternative
}
return ""
}
func init() {
proto.RegisterType((*APICap)(nil), "moby.buildkit.v1.apicaps.APICap")
}
var File_caps_proto protoreflect.FileDescriptor
func init() { proto.RegisterFile("caps.proto", fileDescriptor_e19c39d9fcb89b83) }
var fileDescriptor_e19c39d9fcb89b83 = []byte{
// 236 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4a, 0x4e, 0x2c, 0x28,
0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xc8, 0xcd, 0x4f, 0xaa, 0xd4, 0x4b, 0x2a, 0xcd,
0xcc, 0x49, 0xc9, 0xce, 0x2c, 0xd1, 0x2b, 0x33, 0xd4, 0x4b, 0x2c, 0xc8, 0x04, 0xc9, 0x4b, 0xe9,
0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, 0xe7, 0xeb,
0x83, 0x35, 0x24, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, 0x05, 0x31, 0x48, 0xe9, 0x16, 0x23,
0x17, 0x9b, 0x63, 0x80, 0xa7, 0x73, 0x62, 0x81, 0x10, 0x1f, 0x17, 0x93, 0xa7, 0x8b, 0x04, 0xa3,
0x02, 0xa3, 0x06, 0x67, 0x10, 0x93, 0xa7, 0x8b, 0x90, 0x04, 0x17, 0xbb, 0x6b, 0x5e, 0x62, 0x52,
0x4e, 0x6a, 0x8a, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x47, 0x10, 0x8c, 0x2b, 0x24, 0xc7, 0xc5, 0xe5,
0x92, 0x5a, 0x50, 0x94, 0x9a, 0x9c, 0x58, 0x92, 0x9a, 0x22, 0xc1, 0x0c, 0x96, 0x44, 0x12, 0x11,
0x52, 0xe3, 0xe2, 0x73, 0xc9, 0x2c, 0x06, 0xab, 0x0d, 0x4a, 0x4d, 0x2c, 0xce, 0xcf, 0x93, 0x60,
0x01, 0x9b, 0x8a, 0x26, 0x2a, 0xa4, 0xc3, 0x25, 0x88, 0x2a, 0xe2, 0x5b, 0x9c, 0x2e, 0xc1, 0x0a,
0x56, 0x8a, 0x29, 0x21, 0x64, 0xc0, 0x25, 0x0c, 0x13, 0x74, 0xcc, 0x29, 0x49, 0x2d, 0xca, 0x4b,
0x2c, 0xc9, 0x2c, 0x4b, 0x95, 0x60, 0x03, 0xab, 0xc7, 0x26, 0xe5, 0xc4, 0x73, 0xe2, 0x91, 0x1c,
0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x26, 0xb1, 0x81, 0x7d, 0x6c, 0x0c, 0x08,
0x00, 0x00, 0xff, 0xff, 0x02, 0x2d, 0x9e, 0x91, 0x48, 0x01, 0x00, 0x00,
}
func (m *APICap) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *APICap) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *APICap) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.DisabledAlternative) > 0 {
i -= len(m.DisabledAlternative)
copy(dAtA[i:], m.DisabledAlternative)
i = encodeVarintCaps(dAtA, i, uint64(len(m.DisabledAlternative)))
i--
dAtA[i] = 0x32
}
if len(m.DisabledReasonMsg) > 0 {
i -= len(m.DisabledReasonMsg)
copy(dAtA[i:], m.DisabledReasonMsg)
i = encodeVarintCaps(dAtA, i, uint64(len(m.DisabledReasonMsg)))
i--
dAtA[i] = 0x2a
}
if len(m.DisabledReason) > 0 {
i -= len(m.DisabledReason)
copy(dAtA[i:], m.DisabledReason)
i = encodeVarintCaps(dAtA, i, uint64(len(m.DisabledReason)))
i--
dAtA[i] = 0x22
}
if m.Deprecated {
i--
if m.Deprecated {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x18
}
if m.Enabled {
i--
if m.Enabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x10
}
if len(m.ID) > 0 {
i -= len(m.ID)
copy(dAtA[i:], m.ID)
i = encodeVarintCaps(dAtA, i, uint64(len(m.ID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintCaps(dAtA []byte, offset int, v uint64) int {
offset -= sovCaps(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *APICap) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.ID)
if l > 0 {
n += 1 + l + sovCaps(uint64(l))
}
if m.Enabled {
n += 2
}
if m.Deprecated {
n += 2
}
l = len(m.DisabledReason)
if l > 0 {
n += 1 + l + sovCaps(uint64(l))
}
l = len(m.DisabledReasonMsg)
if l > 0 {
n += 1 + l + sovCaps(uint64(l))
}
l = len(m.DisabledAlternative)
if l > 0 {
n += 1 + l + sovCaps(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovCaps(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozCaps(x uint64) (n int) {
return sovCaps(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *APICap) 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 ErrIntOverflowCaps
}
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: APICap: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: APICap: 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 ErrIntOverflowCaps
}
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 ErrInvalidLengthCaps
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCaps
}
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 Enabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCaps
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Enabled = bool(v != 0)
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Deprecated", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCaps
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Deprecated = bool(v != 0)
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DisabledReason", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCaps
}
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 ErrInvalidLengthCaps
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCaps
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DisabledReason = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DisabledReasonMsg", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCaps
}
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 ErrInvalidLengthCaps
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCaps
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DisabledReasonMsg = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DisabledAlternative", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCaps
}
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 ErrInvalidLengthCaps
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCaps
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DisabledAlternative = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipCaps(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthCaps
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipCaps(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCaps
}
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, ErrIntOverflowCaps
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowCaps
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthCaps
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupCaps
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthCaps
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
var file_caps_proto_rawDesc = []byte{
0x0a, 0x0a, 0x63, 0x61, 0x70, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x18, 0x6d, 0x6f,
0x62, 0x79, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x61,
0x70, 0x69, 0x63, 0x61, 0x70, 0x73, 0x22, 0xda, 0x01, 0x0a, 0x06, 0x41, 0x50, 0x49, 0x43, 0x61,
0x70, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49,
0x44, 0x12, 0x18, 0x0a, 0x07, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x08, 0x52, 0x07, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x44,
0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52,
0x0a, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x44,
0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x61,
0x73, 0x6f, 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52,
0x65, 0x61, 0x73, 0x6f, 0x6e, 0x4d, 0x73, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11,
0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x4d, 0x73,
0x67, 0x12, 0x30, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x41, 0x6c, 0x74,
0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13,
0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74,
0x69, 0x76, 0x65, 0x42, 0x43, 0x5a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x6d, 0x6f, 0x62, 0x79, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x2f,
0x75, 0x74, 0x69, 0x6c, 0x2f, 0x61, 0x70, 0x69, 0x63, 0x61, 0x70, 0x73, 0x2f, 0x70, 0x62, 0x3b,
0x6d, 0x6f, 0x62, 0x79, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x5f, 0x76, 0x31,
0x5f, 0x61, 0x70, 0x69, 0x63, 0x61, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
ErrInvalidLengthCaps = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowCaps = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupCaps = fmt.Errorf("proto: unexpected end of group")
file_caps_proto_rawDescOnce sync.Once
file_caps_proto_rawDescData = file_caps_proto_rawDesc
)
func file_caps_proto_rawDescGZIP() []byte {
file_caps_proto_rawDescOnce.Do(func() {
file_caps_proto_rawDescData = protoimpl.X.CompressGZIP(file_caps_proto_rawDescData)
})
return file_caps_proto_rawDescData
}
var file_caps_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_caps_proto_goTypes = []interface{}{
(*APICap)(nil), // 0: moby.buildkit.v1.apicaps.APICap
}
var file_caps_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_caps_proto_init() }
func file_caps_proto_init() {
if File_caps_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_caps_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*APICap); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_caps_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_caps_proto_goTypes,
DependencyIndexes: file_caps_proto_depIdxs,
MessageInfos: file_caps_proto_msgTypes,
}.Build()
File_caps_proto = out.File
file_caps_proto_rawDesc = nil
file_caps_proto_goTypes = nil
file_caps_proto_depIdxs = nil
}

View File

@@ -2,11 +2,7 @@ syntax = "proto3";
package moby.buildkit.v1.apicaps;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option go_package = "github.com/moby/buildkit/util/apicaps/pb;moby_buildkit_v1_apicaps";
// APICap defines a capability supported by the service
message APICap {
@@ -16,4 +12,4 @@ message APICap {
string DisabledReason = 4; // Reason key for detection code
string DisabledReasonMsg = 5; // Message to the user
string DisabledAlternative = 6; // Identifier that updated client could catch.
}
}

View File

@@ -1,3 +1,3 @@
package moby_buildkit_v1_apicaps //nolint:revive
//go:generate protoc -I=. -I=../../../vendor/ -I=../../../../../../ --gogo_out=plugins=grpc:. caps.proto
//go:generate protoc -I=. -I=../../../vendor/ -I=../../../../../../ --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative,require_unimplemented_servers=false:. caps.proto

7
vendor/github.com/moby/buildkit/util/disk/disk.go generated vendored Normal file
View File

@@ -0,0 +1,7 @@
package disk
type DiskStat struct {
Total int64
Free int64
Available int64
}

View File

@@ -0,0 +1,21 @@
//go:build openbsd
// +build openbsd
package disk
import (
"syscall"
)
func GetDiskStat(root string) (DiskStat, error) {
var st syscall.Statfs_t
if err := syscall.Statfs(root, &st); err != nil {
return DiskStat{}, err
}
return DiskStat{
Total: int64(st.F_bsize) * int64(st.F_blocks),
Free: int64(st.F_bsize) * int64(st.F_bfree),
Available: int64(st.F_bsize) * int64(st.F_bavail),
}, nil
}

21
vendor/github.com/moby/buildkit/util/disk/disk_unix.go generated vendored Normal file
View File

@@ -0,0 +1,21 @@
//go:build !windows && !openbsd
// +build !windows,!openbsd
package disk
import (
"syscall"
)
func GetDiskStat(root string) (DiskStat, error) {
var st syscall.Statfs_t
if err := syscall.Statfs(root, &st); err != nil {
return DiskStat{}, err
}
return DiskStat{
Total: int64(st.Bsize) * int64(st.Blocks),
Free: int64(st.Bsize) * int64(st.Bfree),
Available: int64(st.Bsize) * int64(st.Bavail),
}, nil
}

View File

@@ -0,0 +1,33 @@
//go:build windows
// +build windows
package disk
import (
"golang.org/x/sys/windows"
)
func GetDiskStat(root string) (DiskStat, error) {
rootUTF16, err := windows.UTF16FromString(root)
if err != nil {
return DiskStat{}, err
}
var (
totalBytes uint64
totalFreeBytes uint64
freeAvailableBytes uint64
)
if err := windows.GetDiskFreeSpaceEx(
&rootUTF16[0],
&freeAvailableBytes,
&totalBytes,
&totalFreeBytes); err != nil {
return DiskStat{}, err
}
return DiskStat{
Total: int64(totalBytes),
Free: int64(totalFreeBytes),
Available: int64(freeAvailableBytes),
}, nil
}

View File

@@ -0,0 +1,74 @@
// Protocol Buffers for Go with Gadgets
//
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
// http://github.com/gogo/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Package proto is a transition package for methods from gogo that
// are used within buildkit and don't have an existing method
// in the standard protobuf library.
package proto
import (
"encoding/json"
"strconv"
"github.com/pkg/errors"
)
func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) {
s, ok := m[value]
if !ok {
s = strconv.Itoa(int(value))
}
return json.Marshal(s)
}
// UnmarshalJSONEnum is a helper function to simplify recovering enum int values
// from their JSON-encoded representation. Given a map from the enum's symbolic
// names to its int values, and a byte buffer containing the JSON-encoded
// value, it returns an int32 that can be cast to the enum type by the caller.
//
// The function can deal with both JSON representations, numeric and symbolic.
func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) {
if data[0] == '"' {
// New style: enums are strings.
var repr string
if err := json.Unmarshal(data, &repr); err != nil {
return -1, err
}
val, ok := m[repr]
if !ok {
return 0, errors.Errorf("unrecognized enum %s value %q", enumName, repr)
}
return val, nil
}
// Old style: enums are ints.
var val int32
if err := json.Unmarshal(data, &val); err != nil {
return 0, errors.Errorf("cannot unmarshal %#q into enum %s", data, enumName)
}
return val, nil
}

View File

@@ -6,9 +6,6 @@ import (
"errors"
"github.com/containerd/typeurl/v2"
rpc "github.com/gogo/googleapis/google/rpc"
gogotypes "github.com/gogo/protobuf/types"
"github.com/golang/protobuf/proto" //nolint:staticcheck
"github.com/golang/protobuf/ptypes/any"
"github.com/moby/buildkit/errdefs"
"github.com/moby/buildkit/util/bklog"
@@ -16,6 +13,7 @@ import (
spb "google.golang.org/genproto/googleapis/rpc/status"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
type TypedError interface {
@@ -172,7 +170,7 @@ func FromGRPC(err error) error {
// details that we don't understand are copied as proto
for _, d := range pb.Details {
m, err := typeurl.UnmarshalAny(gogoAny(d))
m, err := typeurl.UnmarshalAny(d)
if err != nil {
continue
}
@@ -206,20 +204,6 @@ func FromGRPC(err error) error {
return stack.Enable(err)
}
func ToRPCStatus(st *spb.Status) *rpc.Status {
details := make([]*gogotypes.Any, len(st.Details))
for i, d := range st.Details {
details[i] = gogoAny(d)
}
return &rpc.Status{
Code: int32(st.Code),
Message: st.Message,
Details: details,
}
}
type grpcStatusError struct {
st *status.Status
}
@@ -256,10 +240,3 @@ func each(err error, fn func(error)) {
each(wrapped.Unwrap(), fn)
}
}
func gogoAny(in *any.Any) *gogotypes.Any {
return &gogotypes.Any{
TypeUrl: in.TypeUrl,
Value: in.Value,
}
}

View File

@@ -64,7 +64,7 @@ func retryError(err error) bool {
return true
}
// catches TLS timeout or other network-related temporary errors
if ne := net.Error(nil); errors.As(err, &ne) && ne.Temporary() { // ignoring "SA1019: Temporary is deprecated", continue to propagate net.Error through the "temporary" status
if ne := net.Error(nil); errors.As(err, &ne) && ne.Temporary() { //nolint:staticcheck // ignoring "SA1019: Temporary is deprecated", continue to propagate net.Error through the "temporary" status
return true
}

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.33.0
// protoc-gen-go v1.34.1
// protoc v3.11.4
// source: stack.proto

View File

@@ -220,7 +220,7 @@ func Run(t *testing.T, testCases []Test, opt ...TestOpt) {
func getFunctionName(i interface{}) string {
fullname := runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
dot := strings.LastIndex(fullname, ".") + 1
return strings.Title(fullname[dot:]) // ignoring "SA1019: strings.Title is deprecated", as for our use we don't need full unicode support
return strings.Title(fullname[dot:]) //nolint:staticcheck // ignoring "SA1019: strings.Title is deprecated", as for our use we don't need full unicode support
}
var localImageCache map[string]map[string]struct{}

View File

@@ -19,7 +19,8 @@ var windowsImagesMirrorMap = map[string]string{
// nanoserver with extra binaries, like fc.exe
// TODO(profnandaa): get an approved/compliant repo, placeholder for now
// see dockerfile here - https://github.com/microsoft/windows-container-tools/pull/178
"nanoserver:plus": "docker.io/wintools/nanoserver:ltsc2022",
"nanoserver:plus": "docker.io/wintools/nanoserver:ltsc2022",
"nanoserver:plus-busybox": "docker.io/wintools/nanoserver:ltsc2022",
}
// abstracted function to handle pipe dialing on windows.