diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000000..93ac6dfbb8b0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.pb.go linguist-generated=true +*.pb.go -diff diff --git a/.github/workflows/buildkit.yml b/.github/workflows/buildkit.yml index 3c8740a805f8..d755e5683f52 100644 --- a/.github/workflows/buildkit.yml +++ b/.github/workflows/buildkit.yml @@ -112,7 +112,7 @@ jobs: - binaries with: cache_scope: build-integration-tests - pkgs: ./client ./cmd/buildctl ./worker/containerd ./solver ./frontend + pkgs: ./client ./cmd/buildctl ./worker/containerd ./solver ./frontend ./exporter kinds: integration codecov_flags: core includes: | diff --git a/api/services/control/control.pb.go b/api/services/control/control.pb.go index 2703e042ae02..c7ff6ed34296 100644 --- a/api/services/control/control.pb.go +++ b/api/services/control/control.pb.go @@ -75,6 +75,61 @@ func (BuildHistoryEventType) EnumDescriptor() ([]byte, []int) { return file_github_com_moby_buildkit_api_services_control_control_proto_rawDescGZIP(), []int{0} } +type ExporterTarget int32 + +const ( + ExporterTarget_UNKNOWN ExporterTarget = 0 + ExporterTarget_NONE ExporterTarget = 1 + ExporterTarget_FILE ExporterTarget = 2 + ExporterTarget_DIRECTORY ExporterTarget = 3 + ExporterTarget_STORE ExporterTarget = 4 +) + +// Enum value maps for ExporterTarget. +var ( + ExporterTarget_name = map[int32]string{ + 0: "UNKNOWN", + 1: "NONE", + 2: "FILE", + 3: "DIRECTORY", + 4: "STORE", + } + ExporterTarget_value = map[string]int32{ + "UNKNOWN": 0, + "NONE": 1, + "FILE": 2, + "DIRECTORY": 3, + "STORE": 4, + } +) + +func (x ExporterTarget) Enum() *ExporterTarget { + p := new(ExporterTarget) + *p = x + return p +} + +func (x ExporterTarget) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ExporterTarget) Descriptor() protoreflect.EnumDescriptor { + return file_github_com_moby_buildkit_api_services_control_control_proto_enumTypes[1].Descriptor() +} + +func (ExporterTarget) Type() protoreflect.EnumType { + return &file_github_com_moby_buildkit_api_services_control_control_proto_enumTypes[1] +} + +func (x ExporterTarget) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ExporterTarget.Descriptor instead. +func (ExporterTarget) EnumDescriptor() ([]byte, []int) { + return file_github_com_moby_buildkit_api_services_control_control_proto_rawDescGZIP(), []int{1} +} + type PruneRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Filter []string `protobuf:"bytes,1,rep,name=filter,proto3" json:"filter,omitempty"` @@ -1973,7 +2028,9 @@ type Exporter struct { // Type identifies the exporter Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` // Attrs specifies exporter configuration - Attrs map[string]string `protobuf:"bytes,2,rep,name=Attrs,proto3" json:"Attrs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Attrs map[string]string `protobuf:"bytes,2,rep,name=Attrs,proto3" json:"Attrs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Target indicates the target type of the exporter + Target ExporterTarget `protobuf:"varint,3,opt,name=Target,proto3,enum=moby.buildkit.v1.ExporterTarget" json:"Target,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -2022,6 +2079,13 @@ func (x *Exporter) GetAttrs() map[string]string { return nil } +func (x *Exporter) GetTarget() ExporterTarget { + if x != nil { + return x.Target + } + return ExporterTarget_UNKNOWN +} + var File_github_com_moby_buildkit_api_services_control_control_proto protoreflect.FileDescriptor const file_github_com_moby_buildkit_api_services_control_control_proto_rawDesc = "" + @@ -2220,10 +2284,11 @@ const file_github_com_moby_buildkit_api_services_control_control_proto_rawDesc = "\aResults\x18\x03 \x03(\v2..moby.buildkit.v1.BuildResultInfo.ResultsEntryR\aResults\x1aX\n" + "\fResultsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\x03R\x03key\x122\n" + - "\x05value\x18\x02 \x01(\v2\x1c.moby.buildkit.v1.DescriptorR\x05value:\x028\x01\"\x95\x01\n" + + "\x05value\x18\x02 \x01(\v2\x1c.moby.buildkit.v1.DescriptorR\x05value:\x028\x01\"\xcf\x01\n" + "\bExporter\x12\x12\n" + "\x04Type\x18\x01 \x01(\tR\x04Type\x12;\n" + - "\x05Attrs\x18\x02 \x03(\v2%.moby.buildkit.v1.Exporter.AttrsEntryR\x05Attrs\x1a8\n" + + "\x05Attrs\x18\x02 \x03(\v2%.moby.buildkit.v1.Exporter.AttrsEntryR\x05Attrs\x128\n" + + "\x06Target\x18\x03 \x01(\x0e2 .moby.buildkit.v1.ExporterTargetR\x06Target\x1a8\n" + "\n" + "AttrsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + @@ -2231,7 +2296,13 @@ const file_github_com_moby_buildkit_api_services_control_control_proto_rawDesc = "\x15BuildHistoryEventType\x12\v\n" + "\aSTARTED\x10\x00\x12\f\n" + "\bCOMPLETE\x10\x01\x12\v\n" + - "\aDELETED\x10\x022\x89\x06\n" + + "\aDELETED\x10\x02*K\n" + + "\x0eExporterTarget\x12\v\n" + + "\aUNKNOWN\x10\x00\x12\b\n" + + "\x04NONE\x10\x01\x12\b\n" + + "\x04FILE\x10\x02\x12\r\n" + + "\tDIRECTORY\x10\x03\x12\t\n" + + "\x05STORE\x10\x042\x89\x06\n" + "\aControl\x12T\n" + "\tDiskUsage\x12\".moby.buildkit.v1.DiskUsageRequest\x1a#.moby.buildkit.v1.DiskUsageResponse\x12H\n" + "\x05Prune\x12\x1e.moby.buildkit.v1.PruneRequest\x1a\x1d.moby.buildkit.v1.UsageRecord0\x01\x12H\n" + @@ -2255,134 +2326,136 @@ func file_github_com_moby_buildkit_api_services_control_control_proto_rawDescGZI return file_github_com_moby_buildkit_api_services_control_control_proto_rawDescData } -var file_github_com_moby_buildkit_api_services_control_control_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_github_com_moby_buildkit_api_services_control_control_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_github_com_moby_buildkit_api_services_control_control_proto_msgTypes = make([]protoimpl.MessageInfo, 39) var file_github_com_moby_buildkit_api_services_control_control_proto_goTypes = []any{ (BuildHistoryEventType)(0), // 0: moby.buildkit.v1.BuildHistoryEventType - (*PruneRequest)(nil), // 1: moby.buildkit.v1.PruneRequest - (*DiskUsageRequest)(nil), // 2: moby.buildkit.v1.DiskUsageRequest - (*DiskUsageResponse)(nil), // 3: moby.buildkit.v1.DiskUsageResponse - (*UsageRecord)(nil), // 4: moby.buildkit.v1.UsageRecord - (*SolveRequest)(nil), // 5: moby.buildkit.v1.SolveRequest - (*CacheOptions)(nil), // 6: moby.buildkit.v1.CacheOptions - (*CacheOptionsEntry)(nil), // 7: moby.buildkit.v1.CacheOptionsEntry - (*SolveResponse)(nil), // 8: moby.buildkit.v1.SolveResponse - (*StatusRequest)(nil), // 9: moby.buildkit.v1.StatusRequest - (*StatusResponse)(nil), // 10: moby.buildkit.v1.StatusResponse - (*Vertex)(nil), // 11: moby.buildkit.v1.Vertex - (*VertexStatus)(nil), // 12: moby.buildkit.v1.VertexStatus - (*VertexLog)(nil), // 13: moby.buildkit.v1.VertexLog - (*VertexWarning)(nil), // 14: moby.buildkit.v1.VertexWarning - (*BytesMessage)(nil), // 15: moby.buildkit.v1.BytesMessage - (*ListWorkersRequest)(nil), // 16: moby.buildkit.v1.ListWorkersRequest - (*ListWorkersResponse)(nil), // 17: moby.buildkit.v1.ListWorkersResponse - (*InfoRequest)(nil), // 18: moby.buildkit.v1.InfoRequest - (*InfoResponse)(nil), // 19: moby.buildkit.v1.InfoResponse - (*BuildHistoryRequest)(nil), // 20: moby.buildkit.v1.BuildHistoryRequest - (*BuildHistoryEvent)(nil), // 21: moby.buildkit.v1.BuildHistoryEvent - (*BuildHistoryRecord)(nil), // 22: moby.buildkit.v1.BuildHistoryRecord - (*UpdateBuildHistoryRequest)(nil), // 23: moby.buildkit.v1.UpdateBuildHistoryRequest - (*UpdateBuildHistoryResponse)(nil), // 24: moby.buildkit.v1.UpdateBuildHistoryResponse - (*Descriptor)(nil), // 25: moby.buildkit.v1.Descriptor - (*BuildResultInfo)(nil), // 26: moby.buildkit.v1.BuildResultInfo - (*Exporter)(nil), // 27: moby.buildkit.v1.Exporter - nil, // 28: moby.buildkit.v1.SolveRequest.ExporterAttrsDeprecatedEntry - nil, // 29: moby.buildkit.v1.SolveRequest.FrontendAttrsEntry - nil, // 30: moby.buildkit.v1.SolveRequest.FrontendInputsEntry - nil, // 31: moby.buildkit.v1.CacheOptions.ExportAttrsDeprecatedEntry - nil, // 32: moby.buildkit.v1.CacheOptionsEntry.AttrsEntry - nil, // 33: moby.buildkit.v1.SolveResponse.ExporterResponseEntry - nil, // 34: moby.buildkit.v1.BuildHistoryRecord.FrontendAttrsEntry - nil, // 35: moby.buildkit.v1.BuildHistoryRecord.ExporterResponseEntry - nil, // 36: moby.buildkit.v1.BuildHistoryRecord.ResultsEntry - nil, // 37: moby.buildkit.v1.Descriptor.AnnotationsEntry - nil, // 38: moby.buildkit.v1.BuildResultInfo.ResultsEntry - nil, // 39: moby.buildkit.v1.Exporter.AttrsEntry - (*timestamp.Timestamp)(nil), // 40: google.protobuf.Timestamp - (*pb.Definition)(nil), // 41: pb.Definition - (*pb1.Policy)(nil), // 42: moby.buildkit.v1.sourcepolicy.Policy - (*pb.ProgressGroup)(nil), // 43: pb.ProgressGroup - (*pb.SourceInfo)(nil), // 44: pb.SourceInfo - (*pb.Range)(nil), // 45: pb.Range - (*types.WorkerRecord)(nil), // 46: moby.buildkit.v1.types.WorkerRecord - (*types.BuildkitVersion)(nil), // 47: moby.buildkit.v1.types.BuildkitVersion - (*status.Status)(nil), // 48: google.rpc.Status + (ExporterTarget)(0), // 1: moby.buildkit.v1.ExporterTarget + (*PruneRequest)(nil), // 2: moby.buildkit.v1.PruneRequest + (*DiskUsageRequest)(nil), // 3: moby.buildkit.v1.DiskUsageRequest + (*DiskUsageResponse)(nil), // 4: moby.buildkit.v1.DiskUsageResponse + (*UsageRecord)(nil), // 5: moby.buildkit.v1.UsageRecord + (*SolveRequest)(nil), // 6: moby.buildkit.v1.SolveRequest + (*CacheOptions)(nil), // 7: moby.buildkit.v1.CacheOptions + (*CacheOptionsEntry)(nil), // 8: moby.buildkit.v1.CacheOptionsEntry + (*SolveResponse)(nil), // 9: moby.buildkit.v1.SolveResponse + (*StatusRequest)(nil), // 10: moby.buildkit.v1.StatusRequest + (*StatusResponse)(nil), // 11: moby.buildkit.v1.StatusResponse + (*Vertex)(nil), // 12: moby.buildkit.v1.Vertex + (*VertexStatus)(nil), // 13: moby.buildkit.v1.VertexStatus + (*VertexLog)(nil), // 14: moby.buildkit.v1.VertexLog + (*VertexWarning)(nil), // 15: moby.buildkit.v1.VertexWarning + (*BytesMessage)(nil), // 16: moby.buildkit.v1.BytesMessage + (*ListWorkersRequest)(nil), // 17: moby.buildkit.v1.ListWorkersRequest + (*ListWorkersResponse)(nil), // 18: moby.buildkit.v1.ListWorkersResponse + (*InfoRequest)(nil), // 19: moby.buildkit.v1.InfoRequest + (*InfoResponse)(nil), // 20: moby.buildkit.v1.InfoResponse + (*BuildHistoryRequest)(nil), // 21: moby.buildkit.v1.BuildHistoryRequest + (*BuildHistoryEvent)(nil), // 22: moby.buildkit.v1.BuildHistoryEvent + (*BuildHistoryRecord)(nil), // 23: moby.buildkit.v1.BuildHistoryRecord + (*UpdateBuildHistoryRequest)(nil), // 24: moby.buildkit.v1.UpdateBuildHistoryRequest + (*UpdateBuildHistoryResponse)(nil), // 25: moby.buildkit.v1.UpdateBuildHistoryResponse + (*Descriptor)(nil), // 26: moby.buildkit.v1.Descriptor + (*BuildResultInfo)(nil), // 27: moby.buildkit.v1.BuildResultInfo + (*Exporter)(nil), // 28: moby.buildkit.v1.Exporter + nil, // 29: moby.buildkit.v1.SolveRequest.ExporterAttrsDeprecatedEntry + nil, // 30: moby.buildkit.v1.SolveRequest.FrontendAttrsEntry + nil, // 31: moby.buildkit.v1.SolveRequest.FrontendInputsEntry + nil, // 32: moby.buildkit.v1.CacheOptions.ExportAttrsDeprecatedEntry + nil, // 33: moby.buildkit.v1.CacheOptionsEntry.AttrsEntry + nil, // 34: moby.buildkit.v1.SolveResponse.ExporterResponseEntry + nil, // 35: moby.buildkit.v1.BuildHistoryRecord.FrontendAttrsEntry + nil, // 36: moby.buildkit.v1.BuildHistoryRecord.ExporterResponseEntry + nil, // 37: moby.buildkit.v1.BuildHistoryRecord.ResultsEntry + nil, // 38: moby.buildkit.v1.Descriptor.AnnotationsEntry + nil, // 39: moby.buildkit.v1.BuildResultInfo.ResultsEntry + nil, // 40: moby.buildkit.v1.Exporter.AttrsEntry + (*timestamp.Timestamp)(nil), // 41: google.protobuf.Timestamp + (*pb.Definition)(nil), // 42: pb.Definition + (*pb1.Policy)(nil), // 43: moby.buildkit.v1.sourcepolicy.Policy + (*pb.ProgressGroup)(nil), // 44: pb.ProgressGroup + (*pb.SourceInfo)(nil), // 45: pb.SourceInfo + (*pb.Range)(nil), // 46: pb.Range + (*types.WorkerRecord)(nil), // 47: moby.buildkit.v1.types.WorkerRecord + (*types.BuildkitVersion)(nil), // 48: moby.buildkit.v1.types.BuildkitVersion + (*status.Status)(nil), // 49: google.rpc.Status } var file_github_com_moby_buildkit_api_services_control_control_proto_depIdxs = []int32{ - 4, // 0: moby.buildkit.v1.DiskUsageResponse.record:type_name -> moby.buildkit.v1.UsageRecord - 40, // 1: moby.buildkit.v1.UsageRecord.CreatedAt:type_name -> google.protobuf.Timestamp - 40, // 2: moby.buildkit.v1.UsageRecord.LastUsedAt:type_name -> google.protobuf.Timestamp - 41, // 3: moby.buildkit.v1.SolveRequest.Definition:type_name -> pb.Definition - 28, // 4: moby.buildkit.v1.SolveRequest.ExporterAttrsDeprecated:type_name -> moby.buildkit.v1.SolveRequest.ExporterAttrsDeprecatedEntry - 29, // 5: moby.buildkit.v1.SolveRequest.FrontendAttrs:type_name -> moby.buildkit.v1.SolveRequest.FrontendAttrsEntry - 6, // 6: moby.buildkit.v1.SolveRequest.Cache:type_name -> moby.buildkit.v1.CacheOptions - 30, // 7: moby.buildkit.v1.SolveRequest.FrontendInputs:type_name -> moby.buildkit.v1.SolveRequest.FrontendInputsEntry - 42, // 8: moby.buildkit.v1.SolveRequest.SourcePolicy:type_name -> moby.buildkit.v1.sourcepolicy.Policy - 27, // 9: moby.buildkit.v1.SolveRequest.Exporters:type_name -> moby.buildkit.v1.Exporter - 31, // 10: moby.buildkit.v1.CacheOptions.ExportAttrsDeprecated:type_name -> moby.buildkit.v1.CacheOptions.ExportAttrsDeprecatedEntry - 7, // 11: moby.buildkit.v1.CacheOptions.Exports:type_name -> moby.buildkit.v1.CacheOptionsEntry - 7, // 12: moby.buildkit.v1.CacheOptions.Imports:type_name -> moby.buildkit.v1.CacheOptionsEntry - 32, // 13: moby.buildkit.v1.CacheOptionsEntry.Attrs:type_name -> moby.buildkit.v1.CacheOptionsEntry.AttrsEntry - 33, // 14: moby.buildkit.v1.SolveResponse.ExporterResponse:type_name -> moby.buildkit.v1.SolveResponse.ExporterResponseEntry - 11, // 15: moby.buildkit.v1.StatusResponse.vertexes:type_name -> moby.buildkit.v1.Vertex - 12, // 16: moby.buildkit.v1.StatusResponse.statuses:type_name -> moby.buildkit.v1.VertexStatus - 13, // 17: moby.buildkit.v1.StatusResponse.logs:type_name -> moby.buildkit.v1.VertexLog - 14, // 18: moby.buildkit.v1.StatusResponse.warnings:type_name -> moby.buildkit.v1.VertexWarning - 40, // 19: moby.buildkit.v1.Vertex.started:type_name -> google.protobuf.Timestamp - 40, // 20: moby.buildkit.v1.Vertex.completed:type_name -> google.protobuf.Timestamp - 43, // 21: moby.buildkit.v1.Vertex.progressGroup:type_name -> pb.ProgressGroup - 40, // 22: moby.buildkit.v1.VertexStatus.timestamp:type_name -> google.protobuf.Timestamp - 40, // 23: moby.buildkit.v1.VertexStatus.started:type_name -> google.protobuf.Timestamp - 40, // 24: moby.buildkit.v1.VertexStatus.completed:type_name -> google.protobuf.Timestamp - 40, // 25: moby.buildkit.v1.VertexLog.timestamp:type_name -> google.protobuf.Timestamp - 44, // 26: moby.buildkit.v1.VertexWarning.info:type_name -> pb.SourceInfo - 45, // 27: moby.buildkit.v1.VertexWarning.ranges:type_name -> pb.Range - 46, // 28: moby.buildkit.v1.ListWorkersResponse.record:type_name -> moby.buildkit.v1.types.WorkerRecord - 47, // 29: moby.buildkit.v1.InfoResponse.buildkitVersion:type_name -> moby.buildkit.v1.types.BuildkitVersion + 5, // 0: moby.buildkit.v1.DiskUsageResponse.record:type_name -> moby.buildkit.v1.UsageRecord + 41, // 1: moby.buildkit.v1.UsageRecord.CreatedAt:type_name -> google.protobuf.Timestamp + 41, // 2: moby.buildkit.v1.UsageRecord.LastUsedAt:type_name -> google.protobuf.Timestamp + 42, // 3: moby.buildkit.v1.SolveRequest.Definition:type_name -> pb.Definition + 29, // 4: moby.buildkit.v1.SolveRequest.ExporterAttrsDeprecated:type_name -> moby.buildkit.v1.SolveRequest.ExporterAttrsDeprecatedEntry + 30, // 5: moby.buildkit.v1.SolveRequest.FrontendAttrs:type_name -> moby.buildkit.v1.SolveRequest.FrontendAttrsEntry + 7, // 6: moby.buildkit.v1.SolveRequest.Cache:type_name -> moby.buildkit.v1.CacheOptions + 31, // 7: moby.buildkit.v1.SolveRequest.FrontendInputs:type_name -> moby.buildkit.v1.SolveRequest.FrontendInputsEntry + 43, // 8: moby.buildkit.v1.SolveRequest.SourcePolicy:type_name -> moby.buildkit.v1.sourcepolicy.Policy + 28, // 9: moby.buildkit.v1.SolveRequest.Exporters:type_name -> moby.buildkit.v1.Exporter + 32, // 10: moby.buildkit.v1.CacheOptions.ExportAttrsDeprecated:type_name -> moby.buildkit.v1.CacheOptions.ExportAttrsDeprecatedEntry + 8, // 11: moby.buildkit.v1.CacheOptions.Exports:type_name -> moby.buildkit.v1.CacheOptionsEntry + 8, // 12: moby.buildkit.v1.CacheOptions.Imports:type_name -> moby.buildkit.v1.CacheOptionsEntry + 33, // 13: moby.buildkit.v1.CacheOptionsEntry.Attrs:type_name -> moby.buildkit.v1.CacheOptionsEntry.AttrsEntry + 34, // 14: moby.buildkit.v1.SolveResponse.ExporterResponse:type_name -> moby.buildkit.v1.SolveResponse.ExporterResponseEntry + 12, // 15: moby.buildkit.v1.StatusResponse.vertexes:type_name -> moby.buildkit.v1.Vertex + 13, // 16: moby.buildkit.v1.StatusResponse.statuses:type_name -> moby.buildkit.v1.VertexStatus + 14, // 17: moby.buildkit.v1.StatusResponse.logs:type_name -> moby.buildkit.v1.VertexLog + 15, // 18: moby.buildkit.v1.StatusResponse.warnings:type_name -> moby.buildkit.v1.VertexWarning + 41, // 19: moby.buildkit.v1.Vertex.started:type_name -> google.protobuf.Timestamp + 41, // 20: moby.buildkit.v1.Vertex.completed:type_name -> google.protobuf.Timestamp + 44, // 21: moby.buildkit.v1.Vertex.progressGroup:type_name -> pb.ProgressGroup + 41, // 22: moby.buildkit.v1.VertexStatus.timestamp:type_name -> google.protobuf.Timestamp + 41, // 23: moby.buildkit.v1.VertexStatus.started:type_name -> google.protobuf.Timestamp + 41, // 24: moby.buildkit.v1.VertexStatus.completed:type_name -> google.protobuf.Timestamp + 41, // 25: moby.buildkit.v1.VertexLog.timestamp:type_name -> google.protobuf.Timestamp + 45, // 26: moby.buildkit.v1.VertexWarning.info:type_name -> pb.SourceInfo + 46, // 27: moby.buildkit.v1.VertexWarning.ranges:type_name -> pb.Range + 47, // 28: moby.buildkit.v1.ListWorkersResponse.record:type_name -> moby.buildkit.v1.types.WorkerRecord + 48, // 29: moby.buildkit.v1.InfoResponse.buildkitVersion:type_name -> moby.buildkit.v1.types.BuildkitVersion 0, // 30: moby.buildkit.v1.BuildHistoryEvent.type:type_name -> moby.buildkit.v1.BuildHistoryEventType - 22, // 31: moby.buildkit.v1.BuildHistoryEvent.record:type_name -> moby.buildkit.v1.BuildHistoryRecord - 34, // 32: moby.buildkit.v1.BuildHistoryRecord.FrontendAttrs:type_name -> moby.buildkit.v1.BuildHistoryRecord.FrontendAttrsEntry - 27, // 33: moby.buildkit.v1.BuildHistoryRecord.Exporters:type_name -> moby.buildkit.v1.Exporter - 48, // 34: moby.buildkit.v1.BuildHistoryRecord.error:type_name -> google.rpc.Status - 40, // 35: moby.buildkit.v1.BuildHistoryRecord.CreatedAt:type_name -> google.protobuf.Timestamp - 40, // 36: moby.buildkit.v1.BuildHistoryRecord.CompletedAt:type_name -> google.protobuf.Timestamp - 25, // 37: moby.buildkit.v1.BuildHistoryRecord.logs:type_name -> moby.buildkit.v1.Descriptor - 35, // 38: moby.buildkit.v1.BuildHistoryRecord.ExporterResponse:type_name -> moby.buildkit.v1.BuildHistoryRecord.ExporterResponseEntry - 26, // 39: moby.buildkit.v1.BuildHistoryRecord.Result:type_name -> moby.buildkit.v1.BuildResultInfo - 36, // 40: moby.buildkit.v1.BuildHistoryRecord.Results:type_name -> moby.buildkit.v1.BuildHistoryRecord.ResultsEntry - 25, // 41: moby.buildkit.v1.BuildHistoryRecord.trace:type_name -> moby.buildkit.v1.Descriptor - 25, // 42: moby.buildkit.v1.BuildHistoryRecord.externalError:type_name -> moby.buildkit.v1.Descriptor - 37, // 43: moby.buildkit.v1.Descriptor.annotations:type_name -> moby.buildkit.v1.Descriptor.AnnotationsEntry - 25, // 44: moby.buildkit.v1.BuildResultInfo.ResultDeprecated:type_name -> moby.buildkit.v1.Descriptor - 25, // 45: moby.buildkit.v1.BuildResultInfo.Attestations:type_name -> moby.buildkit.v1.Descriptor - 38, // 46: moby.buildkit.v1.BuildResultInfo.Results:type_name -> moby.buildkit.v1.BuildResultInfo.ResultsEntry - 39, // 47: moby.buildkit.v1.Exporter.Attrs:type_name -> moby.buildkit.v1.Exporter.AttrsEntry - 41, // 48: moby.buildkit.v1.SolveRequest.FrontendInputsEntry.value:type_name -> pb.Definition - 26, // 49: moby.buildkit.v1.BuildHistoryRecord.ResultsEntry.value:type_name -> moby.buildkit.v1.BuildResultInfo - 25, // 50: moby.buildkit.v1.BuildResultInfo.ResultsEntry.value:type_name -> moby.buildkit.v1.Descriptor - 2, // 51: moby.buildkit.v1.Control.DiskUsage:input_type -> moby.buildkit.v1.DiskUsageRequest - 1, // 52: moby.buildkit.v1.Control.Prune:input_type -> moby.buildkit.v1.PruneRequest - 5, // 53: moby.buildkit.v1.Control.Solve:input_type -> moby.buildkit.v1.SolveRequest - 9, // 54: moby.buildkit.v1.Control.Status:input_type -> moby.buildkit.v1.StatusRequest - 15, // 55: moby.buildkit.v1.Control.Session:input_type -> moby.buildkit.v1.BytesMessage - 16, // 56: moby.buildkit.v1.Control.ListWorkers:input_type -> moby.buildkit.v1.ListWorkersRequest - 18, // 57: moby.buildkit.v1.Control.Info:input_type -> moby.buildkit.v1.InfoRequest - 20, // 58: moby.buildkit.v1.Control.ListenBuildHistory:input_type -> moby.buildkit.v1.BuildHistoryRequest - 23, // 59: moby.buildkit.v1.Control.UpdateBuildHistory:input_type -> moby.buildkit.v1.UpdateBuildHistoryRequest - 3, // 60: moby.buildkit.v1.Control.DiskUsage:output_type -> moby.buildkit.v1.DiskUsageResponse - 4, // 61: moby.buildkit.v1.Control.Prune:output_type -> moby.buildkit.v1.UsageRecord - 8, // 62: moby.buildkit.v1.Control.Solve:output_type -> moby.buildkit.v1.SolveResponse - 10, // 63: moby.buildkit.v1.Control.Status:output_type -> moby.buildkit.v1.StatusResponse - 15, // 64: moby.buildkit.v1.Control.Session:output_type -> moby.buildkit.v1.BytesMessage - 17, // 65: moby.buildkit.v1.Control.ListWorkers:output_type -> moby.buildkit.v1.ListWorkersResponse - 19, // 66: moby.buildkit.v1.Control.Info:output_type -> moby.buildkit.v1.InfoResponse - 21, // 67: moby.buildkit.v1.Control.ListenBuildHistory:output_type -> moby.buildkit.v1.BuildHistoryEvent - 24, // 68: moby.buildkit.v1.Control.UpdateBuildHistory:output_type -> moby.buildkit.v1.UpdateBuildHistoryResponse - 60, // [60:69] is the sub-list for method output_type - 51, // [51:60] is the sub-list for method input_type - 51, // [51:51] is the sub-list for extension type_name - 51, // [51:51] is the sub-list for extension extendee - 0, // [0:51] is the sub-list for field type_name + 23, // 31: moby.buildkit.v1.BuildHistoryEvent.record:type_name -> moby.buildkit.v1.BuildHistoryRecord + 35, // 32: moby.buildkit.v1.BuildHistoryRecord.FrontendAttrs:type_name -> moby.buildkit.v1.BuildHistoryRecord.FrontendAttrsEntry + 28, // 33: moby.buildkit.v1.BuildHistoryRecord.Exporters:type_name -> moby.buildkit.v1.Exporter + 49, // 34: moby.buildkit.v1.BuildHistoryRecord.error:type_name -> google.rpc.Status + 41, // 35: moby.buildkit.v1.BuildHistoryRecord.CreatedAt:type_name -> google.protobuf.Timestamp + 41, // 36: moby.buildkit.v1.BuildHistoryRecord.CompletedAt:type_name -> google.protobuf.Timestamp + 26, // 37: moby.buildkit.v1.BuildHistoryRecord.logs:type_name -> moby.buildkit.v1.Descriptor + 36, // 38: moby.buildkit.v1.BuildHistoryRecord.ExporterResponse:type_name -> moby.buildkit.v1.BuildHistoryRecord.ExporterResponseEntry + 27, // 39: moby.buildkit.v1.BuildHistoryRecord.Result:type_name -> moby.buildkit.v1.BuildResultInfo + 37, // 40: moby.buildkit.v1.BuildHistoryRecord.Results:type_name -> moby.buildkit.v1.BuildHistoryRecord.ResultsEntry + 26, // 41: moby.buildkit.v1.BuildHistoryRecord.trace:type_name -> moby.buildkit.v1.Descriptor + 26, // 42: moby.buildkit.v1.BuildHistoryRecord.externalError:type_name -> moby.buildkit.v1.Descriptor + 38, // 43: moby.buildkit.v1.Descriptor.annotations:type_name -> moby.buildkit.v1.Descriptor.AnnotationsEntry + 26, // 44: moby.buildkit.v1.BuildResultInfo.ResultDeprecated:type_name -> moby.buildkit.v1.Descriptor + 26, // 45: moby.buildkit.v1.BuildResultInfo.Attestations:type_name -> moby.buildkit.v1.Descriptor + 39, // 46: moby.buildkit.v1.BuildResultInfo.Results:type_name -> moby.buildkit.v1.BuildResultInfo.ResultsEntry + 40, // 47: moby.buildkit.v1.Exporter.Attrs:type_name -> moby.buildkit.v1.Exporter.AttrsEntry + 1, // 48: moby.buildkit.v1.Exporter.Target:type_name -> moby.buildkit.v1.ExporterTarget + 42, // 49: moby.buildkit.v1.SolveRequest.FrontendInputsEntry.value:type_name -> pb.Definition + 27, // 50: moby.buildkit.v1.BuildHistoryRecord.ResultsEntry.value:type_name -> moby.buildkit.v1.BuildResultInfo + 26, // 51: moby.buildkit.v1.BuildResultInfo.ResultsEntry.value:type_name -> moby.buildkit.v1.Descriptor + 3, // 52: moby.buildkit.v1.Control.DiskUsage:input_type -> moby.buildkit.v1.DiskUsageRequest + 2, // 53: moby.buildkit.v1.Control.Prune:input_type -> moby.buildkit.v1.PruneRequest + 6, // 54: moby.buildkit.v1.Control.Solve:input_type -> moby.buildkit.v1.SolveRequest + 10, // 55: moby.buildkit.v1.Control.Status:input_type -> moby.buildkit.v1.StatusRequest + 16, // 56: moby.buildkit.v1.Control.Session:input_type -> moby.buildkit.v1.BytesMessage + 17, // 57: moby.buildkit.v1.Control.ListWorkers:input_type -> moby.buildkit.v1.ListWorkersRequest + 19, // 58: moby.buildkit.v1.Control.Info:input_type -> moby.buildkit.v1.InfoRequest + 21, // 59: moby.buildkit.v1.Control.ListenBuildHistory:input_type -> moby.buildkit.v1.BuildHistoryRequest + 24, // 60: moby.buildkit.v1.Control.UpdateBuildHistory:input_type -> moby.buildkit.v1.UpdateBuildHistoryRequest + 4, // 61: moby.buildkit.v1.Control.DiskUsage:output_type -> moby.buildkit.v1.DiskUsageResponse + 5, // 62: moby.buildkit.v1.Control.Prune:output_type -> moby.buildkit.v1.UsageRecord + 9, // 63: moby.buildkit.v1.Control.Solve:output_type -> moby.buildkit.v1.SolveResponse + 11, // 64: moby.buildkit.v1.Control.Status:output_type -> moby.buildkit.v1.StatusResponse + 16, // 65: moby.buildkit.v1.Control.Session:output_type -> moby.buildkit.v1.BytesMessage + 18, // 66: moby.buildkit.v1.Control.ListWorkers:output_type -> moby.buildkit.v1.ListWorkersResponse + 20, // 67: moby.buildkit.v1.Control.Info:output_type -> moby.buildkit.v1.InfoResponse + 22, // 68: moby.buildkit.v1.Control.ListenBuildHistory:output_type -> moby.buildkit.v1.BuildHistoryEvent + 25, // 69: moby.buildkit.v1.Control.UpdateBuildHistory:output_type -> moby.buildkit.v1.UpdateBuildHistoryResponse + 61, // [61:70] is the sub-list for method output_type + 52, // [52:61] is the sub-list for method input_type + 52, // [52:52] is the sub-list for extension type_name + 52, // [52:52] is the sub-list for extension extendee + 0, // [0:52] is the sub-list for field type_name } func init() { file_github_com_moby_buildkit_api_services_control_control_proto_init() } @@ -2395,7 +2468,7 @@ func file_github_com_moby_buildkit_api_services_control_control_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_github_com_moby_buildkit_api_services_control_control_proto_rawDesc), len(file_github_com_moby_buildkit_api_services_control_control_proto_rawDesc)), - NumEnums: 1, + NumEnums: 2, NumMessages: 39, NumExtensions: 0, NumServices: 1, diff --git a/api/services/control/control.proto b/api/services/control/control.proto index 128408e8426a..df8d010238f2 100644 --- a/api/services/control/control.proto +++ b/api/services/control/control.proto @@ -244,10 +244,20 @@ message BuildResultInfo { map Results = 3; } +enum ExporterTarget { + UNKNOWN = 0; + NONE = 1; + FILE = 2; + DIRECTORY = 3; + STORE = 4; +} + // Exporter describes the output exporter message Exporter { // Type identifies the exporter string Type = 1; // Attrs specifies exporter configuration map Attrs = 2; + // Target indicates the target type of the exporter + ExporterTarget Target = 3; } diff --git a/api/services/control/control_vtproto.pb.go b/api/services/control/control_vtproto.pb.go index 4faf1b112c5d..9a6c08535494 100644 --- a/api/services/control/control_vtproto.pb.go +++ b/api/services/control/control_vtproto.pb.go @@ -760,6 +760,7 @@ func (m *Exporter) CloneVT() *Exporter { } r := new(Exporter) r.Type = m.Type + r.Target = m.Target if rhs := m.Attrs; rhs != nil { tmpContainer := make(map[string]string, len(rhs)) for k, v := range rhs { @@ -1915,6 +1916,9 @@ func (this *Exporter) EqualVT(that *Exporter) bool { return false } } + if this.Target != that.Target { + return false + } return string(this.unknownFields) == string(that.unknownFields) } @@ -3939,6 +3943,11 @@ func (m *Exporter) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.Target != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Target)) + i-- + dAtA[i] = 0x18 + } if len(m.Attrs) > 0 { for k := range m.Attrs { v := m.Attrs[k] @@ -4789,6 +4798,9 @@ func (m *Exporter) SizeVT() (n int) { n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) } } + if m.Target != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Target)) + } n += len(m.unknownFields) return n } @@ -10815,6 +10827,25 @@ func (m *Exporter) UnmarshalVT(dAtA []byte) error { } m.Attrs[mapkey] = mapvalue iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) + } + m.Target = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Target |= ExporterTarget(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) diff --git a/api/services/control/converters.go b/api/services/control/converters.go new file mode 100644 index 000000000000..1a0b89e15087 --- /dev/null +++ b/api/services/control/converters.go @@ -0,0 +1,39 @@ +package moby_buildkit_v1 //nolint:revive,staticcheck + +import ( + "github.com/moby/buildkit/exporter/containerimage/exptypes" +) + +func ExporterTargetFromPB(target ExporterTarget) exptypes.ExporterTarget { + switch target { + case ExporterTarget_UNKNOWN: + return exptypes.ExporterTargetUnknown + case ExporterTarget_NONE: + return exptypes.ExporterTargetNone + case ExporterTarget_FILE: + return exptypes.ExporterTargetFile + case ExporterTarget_DIRECTORY: + return exptypes.ExporterTargetDirectory + case ExporterTarget_STORE: + return exptypes.ExporterTargetStore + default: + return exptypes.ExporterTargetUnknown + } +} + +func ExporterTargetToPB(target exptypes.ExporterTarget) ExporterTarget { + switch target { + case exptypes.ExporterTargetUnknown: + return ExporterTarget_UNKNOWN + case exptypes.ExporterTargetNone: + return ExporterTarget_NONE + case exptypes.ExporterTargetFile: + return ExporterTarget_FILE + case exptypes.ExporterTargetDirectory: + return ExporterTarget_DIRECTORY + case exptypes.ExporterTargetStore: + return ExporterTarget_STORE + default: + return ExporterTarget_UNKNOWN + } +} diff --git a/client/build.go b/client/build.go index 93787ba4ff55..aa9c616df48c 100644 --- a/client/build.go +++ b/client/build.go @@ -9,12 +9,14 @@ import ( "github.com/moby/buildkit/frontend/gateway/grpcclient" gatewayapi "github.com/moby/buildkit/frontend/gateway/pb" "github.com/moby/buildkit/session" + "github.com/moby/buildkit/session/exporter" + "github.com/moby/buildkit/session/exporter/exporterprovider" "github.com/moby/buildkit/util/apicaps" "github.com/pkg/errors" "google.golang.org/grpc" ) -func (c *Client) Build(ctx context.Context, opt SolveOpt, product string, buildFunc gateway.BuildFunc, statusChan chan *SolveStatus) (*SolveResponse, error) { +func (c *Client) BuildExport(ctx context.Context, opt SolveOpt, product string, buildFunc gateway.BuildFunc, exportFunc gateway.ExportFunc, statusChan chan *SolveStatus) (*SolveResponse, error) { defer func() { if statusChan != nil { close(statusChan) @@ -42,13 +44,26 @@ func (c *Client) Build(ctx context.Context, opt SolveOpt, product string, buildF }) } + var g grpcclient.GrpcClient + if exportFunc != nil { + opt.EnableSessionExporter = true + exporter := exporterprovider.New(func(ctx context.Context, _ map[string][]byte, _ []string) ([]*exporter.ExporterRequest, error) { + if g == nil { + return nil, errors.New("no build session found for export") + } + return nil, g.Export(ctx, c.conn, exportFunc) + }) + opt.Session = append(opt.Session, exporter) + } + cb := func(ref string, s *session.Session, opts map[string]string) error { if feOpts == nil { feOpts = map[string]string{} } maps.Copy(feOpts, opts) gwClient := c.gatewayClientForBuild(ref) - g, err := grpcclient.New(ctx, feOpts, s.ID(), product, gwClient, gworkers) + var err error + g, err = grpcclient.New(ctx, feOpts, s.ID(), product, gwClient, gworkers) if err != nil { return err } @@ -56,7 +71,8 @@ func (c *Client) Build(ctx context.Context, opt SolveOpt, product string, buildF caps := g.BuildOpts().Caps gwClient.caps = &caps - if err := g.Run(ctx, buildFunc); err != nil { + err = g.Build(ctx, buildFunc) + if err != nil { return errors.Wrap(err, "failed to run Build function") } return nil @@ -65,6 +81,10 @@ func (c *Client) Build(ctx context.Context, opt SolveOpt, product string, buildF return c.solve(ctx, nil, cb, opt, statusChan) } +func (c *Client) Build(ctx context.Context, opt SolveOpt, product string, buildFunc gateway.BuildFunc, statusChan chan *SolveStatus) (*SolveResponse, error) { + return c.BuildExport(ctx, opt, product, buildFunc, nil, statusChan) +} + func (c *Client) gatewayClientForBuild(buildid string) *gatewayClientForBuild { g := gatewayapi.NewLLBBridgeClient(c.conn) return &gatewayClientForBuild{ @@ -138,6 +158,11 @@ func (g *gatewayClientForBuild) Evaluate(ctx context.Context, in *gatewayapi.Eva return g.gateway.Evaluate(ctx, in, opts...) } +func (g *gatewayClientForBuild) GetRemote(ctx context.Context, in *gatewayapi.GetRemoteRequest, opts ...grpc.CallOption) (*gatewayapi.GetRemoteResponse, error) { + ctx = buildid.AppendToOutgoingContext(ctx, g.buildID) + return g.gateway.GetRemote(ctx, in, opts...) +} + func (g *gatewayClientForBuild) Ping(ctx context.Context, in *gatewayapi.PingRequest, opts ...grpc.CallOption) (*gatewayapi.PongResponse, error) { ctx = buildid.AppendToOutgoingContext(ctx, g.buildID) return g.gateway.Ping(ctx, in, opts...) @@ -148,6 +173,11 @@ func (g *gatewayClientForBuild) Return(ctx context.Context, in *gatewayapi.Retur return g.gateway.Return(ctx, in, opts...) } +func (g *gatewayClientForBuild) GetReturn(ctx context.Context, in *gatewayapi.GetReturnRequest, opts ...grpc.CallOption) (*gatewayapi.GetReturnResponse, error) { + ctx = buildid.AppendToOutgoingContext(ctx, g.buildID) + return g.gateway.GetReturn(ctx, in, opts...) +} + func (g *gatewayClientForBuild) Inputs(ctx context.Context, in *gatewayapi.InputsRequest, opts ...grpc.CallOption) (*gatewayapi.InputsResponse, error) { if g.caps != nil { if err := g.caps.Supports(gatewayapi.CapFrontendInputs); err != nil { diff --git a/client/exporters.go b/client/exporters.go index 0f70d59c8726..6e4bf23b56ef 100644 --- a/client/exporters.go +++ b/client/exporters.go @@ -1,9 +1,10 @@ package client const ( - ExporterImage = "image" - ExporterLocal = "local" - ExporterTar = "tar" - ExporterOCI = "oci" - ExporterDocker = "docker" + ExporterImage = "image" + ExporterLocal = "local" + ExporterTar = "tar" + ExporterOCI = "oci" + ExporterDocker = "docker" + ExporterGateway = "gateway" ) diff --git a/client/solve.go b/client/solve.go index 3ac415527dde..1655e229330c 100644 --- a/client/solve.go +++ b/client/solve.go @@ -168,6 +168,9 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG if supportFile && supportStore { return nil, errors.Errorf("both file and store output is not supported by %s exporter", ex.Type) } + case ExporterGateway: + supportFile = ex.Output != nil + supportDir = ex.OutputDir != "" } if !supportFile && ex.Output != nil { return nil, errors.Errorf("output file writer is not supported by %s exporter", ex.Type) @@ -290,9 +293,24 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG exportDeprecated = exp.Type exportAttrDeprecated = exp.Attrs } + target := controlapi.ExporterTarget_NONE + switch { + case exp.Output != nil: + target = controlapi.ExporterTarget_FILE + case exp.OutputDir != "": + switch exp.Type { + case ExporterOCI, ExporterDocker: + target = controlapi.ExporterTarget_STORE + default: + target = controlapi.ExporterTarget_DIRECTORY + } + case exp.OutputStore != nil: + target = controlapi.ExporterTarget_STORE + } exports = append(exports, &controlapi.Exporter{ - Type: exp.Type, - Attrs: exp.Attrs, + Type: exp.Type, + Attrs: exp.Attrs, + Target: target, }) } diff --git a/cmd/buildctl/build/output.go b/cmd/buildctl/build/output.go index 65654baa7115..75624fd948c8 100644 --- a/cmd/buildctl/build/output.go +++ b/cmd/buildctl/build/output.go @@ -42,13 +42,10 @@ func parseOutputCSV(s string) (client.ExportEntry, error) { if v, ok := ex.Attrs["output"]; ok { return ex, errors.Errorf("output=%s not supported for --output, you meant dest=%s?", v, v) } - ex.Output, ex.OutputDir, err = resolveExporterDest(ex.Type, ex.Attrs["dest"], ex.Attrs) + ex.Output, ex.OutputDir, err = resolveExporterDest(ex.Type, ex.Attrs) if err != nil { return ex, errors.Wrap(err, "invalid output option: output") } - if ex.Output != nil || ex.OutputDir != "" { - delete(ex.Attrs, "dest") - } return ex, nil } @@ -66,55 +63,83 @@ func ParseOutput(exports []string) ([]client.ExportEntry, error) { } // resolveExporterDest returns at most either one of io.WriteCloser (single file) or a string (directory path). -func resolveExporterDest(exporter, dest string, attrs map[string]string) (filesync.FileOutputFunc, string, error) { - wrapWriter := func(wc io.WriteCloser) func(map[string]string) (io.WriteCloser, error) { - return func(m map[string]string) (io.WriteCloser, error) { - return wc, nil - } - } - - var supportFile bool - var supportDir bool +func resolveExporterDest(exporter string, attrs map[string]string) (destFile filesync.FileOutputFunc, destDir string, _ error) { + var destFilePath string switch exporter { case client.ExporterLocal: - supportDir = true + var ok bool + destDir, ok = attrs["dest"] + if !ok { + return nil, "", errors.Errorf("%s exporter requires dest=", client.ExporterLocal) + } + delete(attrs, "dest") case client.ExporterTar: - supportFile = true + var ok bool + destFilePath, ok = attrs["dest"] + if !ok { + return nil, "", errors.Errorf("%s exporter requires dest=", client.ExporterTar) + } + delete(attrs, "dest") case client.ExporterOCI, client.ExporterDocker: tar, err := strconv.ParseBool(attrs["tar"]) if err != nil { tar = true } - supportFile = tar - supportDir = !tar + var ok bool + if tar { + destFilePath, ok = attrs["dest"] + } else { + destDir, ok = attrs["dest"] + } + if !ok { + return nil, "", errors.Errorf("%s exporter requires dest=", exporter) + } + delete(attrs, "dest") + case client.ExporterGateway: + destFilePath = attrs["file"] + destDir = attrs["dir"] + if destFilePath == "" && destDir == "" { + return nil, "", errors.Errorf("%s exporter requires file= or dir=", exporter) + } + if destFilePath != "" && destDir != "" { + return nil, "", errors.Errorf("%s exporter requires only one of file= or dir=", exporter) + } + delete(attrs, "file") + delete(attrs, "dir") + default: + dest, ok := attrs["dest"] + if ok { + return nil, "", errors.Errorf("output %s is not supported by %s exporter", dest, exporter) + } } - if supportDir { - if dest == "" { - return nil, "", errors.Errorf("output directory is required for %s exporter", exporter) + if destFilePath != "" { + wrapWriter := func(wc io.WriteCloser) func(map[string]string) (io.WriteCloser, error) { + return func(m map[string]string) (io.WriteCloser, error) { + return wc, nil + } } - return nil, dest, nil - } else if supportFile { - if dest != "" && dest != "-" { - fi, err := os.Stat(dest) + if destFilePath != "" && destFilePath != "-" { + fi, err := os.Stat(destFilePath) if err != nil && !errors.Is(err, os.ErrNotExist) { - return nil, "", errors.Wrapf(err, "invalid destination file: %s", dest) + return nil, "", errors.Wrapf(err, "invalid destination file: %s", destFilePath) } if err == nil && fi.IsDir() { return nil, "", errors.Errorf("destination file is a directory") } - w, err := os.Create(dest) - return wrapWriter(w), "", err - } - // if no output file is specified, use stdout - if _, err := console.ConsoleFromFile(os.Stdout); err == nil { - return nil, "", errors.Errorf("output file is required for %s exporter. refusing to write to console", exporter) + w, err := os.Create(destFilePath) + if err != nil { + return nil, "", err + } + destFile = wrapWriter(w) + } else { + // if no output file is specified, use stdout + if _, err := console.ConsoleFromFile(os.Stdout); err == nil { + return nil, "", errors.Errorf("output file is required for %s exporter. refusing to write to console", exporter) + } + destFile = wrapWriter(os.Stdout) } - return wrapWriter(os.Stdout), "", nil } - // e.g. client.ExporterImage - if dest != "" { - return nil, "", errors.Errorf("output %s is not supported by %s exporter", dest, exporter) - } - return nil, "", nil + + return destFile, destDir, nil } diff --git a/control/control.go b/control/control.go index 64b0ee1ccc49..49d9273ec6cb 100644 --- a/control/control.go +++ b/control/control.go @@ -418,7 +418,11 @@ func (c *Controller) Solve(ctx context.Context, req *controlapi.SolveRequest) (* return nil, err } bklog.G(ctx).Debugf("resolve exporter %s with %v", ex.Type, ex.Attrs) - expi, err := exp.Resolve(ctx, i, ex.Attrs) + expi, err := exp.Resolve(ctx, i, exporter.ResolveOpts{ + Target: controlapi.ExporterTargetFromPB(ex.Target), + Attrs: ex.Attrs, + FrontendAttrs: req.FrontendAttrs, + }) if err != nil { return nil, err } diff --git a/control/gateway/gateway.go b/control/gateway/gateway.go index 572c9a607a0a..37e823aafb03 100644 --- a/control/gateway/gateway.go +++ b/control/gateway/gateway.go @@ -130,6 +130,14 @@ func (gwf *GatewayForwarder) Evaluate(ctx context.Context, req *gwapi.EvaluateRe return fwd.Evaluate(ctx, req) } +func (gwf *GatewayForwarder) GetRemote(ctx context.Context, req *gwapi.GetRemoteRequest) (*gwapi.GetRemoteResponse, error) { + fwd, err := gwf.lookupForwarder(ctx) + if err != nil { + return nil, errors.Wrap(err, "forwarding GetRemote") + } + return fwd.GetRemote(ctx, req) +} + func (gwf *GatewayForwarder) Ping(ctx context.Context, req *gwapi.PingRequest) (*gwapi.PongResponse, error) { fwd, err := gwf.lookupForwarder(ctx) if err != nil { @@ -147,6 +155,14 @@ func (gwf *GatewayForwarder) Return(ctx context.Context, req *gwapi.ReturnReques return res, err } +func (gwf *GatewayForwarder) GetReturn(ctx context.Context, req *gwapi.GetReturnRequest) (*gwapi.GetReturnResponse, error) { + fwd, err := gwf.lookupForwarder(ctx) + if err != nil { + return nil, errors.Wrap(err, "forwarding GetReturn") + } + return fwd.GetReturn(ctx, req) +} + func (gwf *GatewayForwarder) Inputs(ctx context.Context, req *gwapi.InputsRequest) (*gwapi.InputsResponse, error) { fwd, err := gwf.lookupForwarder(ctx) if err != nil { diff --git a/exporter/attestation/make.go b/exporter/attestation/make.go index 13c2df5208aa..948c4d3647ca 100644 --- a/exporter/attestation/make.go +++ b/exporter/attestation/make.go @@ -70,7 +70,7 @@ func MakeInTotoStatements(ctx context.Context, s session.Group, attestations []e switch att.Kind { case gatewaypb.AttestationKind_InToto: - stmt, err := makeInTotoStatement(content, att, defaultSubjects) + stmt, err := MakeInTotoStatement(content, att, defaultSubjects) if err != nil { return err } @@ -87,7 +87,7 @@ func MakeInTotoStatements(ctx context.Context, s session.Group, attestations []e return statements, nil } -func makeInTotoStatement(content []byte, attestation exporter.Attestation, defaultSubjects []intoto.Subject) (*intoto.Statement, error) { +func MakeInTotoStatement[T any](content []byte, attestation result.Attestation[T], defaultSubjects []intoto.Subject) (*intoto.Statement, error) { if len(attestation.InToto.Subjects) == 0 { attestation.InToto.Subjects = []result.InTotoSubject{{ Kind: gatewaypb.InTotoSubjectKind_Self, diff --git a/exporter/containerimage/export.go b/exporter/containerimage/export.go index d604d0bf7d7d..fe6c0a5b833f 100644 --- a/exporter/containerimage/export.go +++ b/exporter/containerimage/export.go @@ -23,8 +23,10 @@ import ( "github.com/moby/buildkit/cache" cacheconfig "github.com/moby/buildkit/cache/config" "github.com/moby/buildkit/client" + "github.com/moby/buildkit/executor" "github.com/moby/buildkit/exporter" "github.com/moby/buildkit/exporter/containerimage/exptypes" + "github.com/moby/buildkit/frontend" "github.com/moby/buildkit/session" "github.com/moby/buildkit/snapshot" "github.com/moby/buildkit/util/compression" @@ -68,12 +70,17 @@ func New(opt Opt) (exporter.Exporter, error) { return im, nil } -func (e *imageExporter) Resolve(ctx context.Context, id int, opt map[string]string) (exporter.ExporterInstance, error) { +func (e *imageExporter) Resolve(ctx context.Context, id int, opts exporter.ResolveOpts) (exporter.ExporterInstance, error) { + if opts.Target != exptypes.ExporterTargetUnknown && opts.Target != exptypes.ExporterTargetNone { + return nil, errors.New("image exporter does not support client target") + } + opts.Target = exptypes.ExporterTargetNone + i := &imageExporterInstance{ imageExporter: e, id: id, - attrs: opt, - opts: ImageCommitOpts{ + opts: opts, + commit: ImageCommitOpts{ RefCfg: cacheconfig.RefConfig{ Compression: compression.New(compression.Default), }, @@ -82,7 +89,7 @@ func (e *imageExporter) Resolve(ctx context.Context, id int, opt map[string]stri store: true, } - opt, err := i.opts.Load(ctx, opt) + opt, err := i.commit.Load(ctx, opts.Attrs) if err != nil { return nil, err } @@ -183,10 +190,10 @@ func (e *imageExporter) Resolve(ctx context.Context, id int, opt map[string]stri type imageExporterInstance struct { *imageExporter - id int - attrs map[string]string + id int + opts exporter.ResolveOpts - opts ImageCommitOpts + commit ImageCommitOpts push bool pushByDigest bool unpack bool @@ -208,25 +215,25 @@ func (e *imageExporterInstance) Name() string { } func (e *imageExporterInstance) Config() *exporter.Config { - return exporter.NewConfigWithCompression(e.opts.RefCfg.Compression) + return exporter.NewConfigWithCompression(e.commit.RefCfg.Compression) } func (e *imageExporterInstance) Type() string { return client.ExporterImage } -func (e *imageExporterInstance) Attrs() map[string]string { - return e.attrs +func (e *imageExporterInstance) Opts() exporter.ResolveOpts { + return e.opts } -func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source, inlineCache exptypes.InlineCache, sessionID string) (_ map[string]string, descref exporter.DescriptorReference, err error) { +func (e *imageExporterInstance) Export(ctx context.Context, llbBridge frontend.FrontendLLBBridge, exec executor.Executor, src *exporter.Source, inlineCache exptypes.InlineCache, sessionID string) (_ map[string]string, descref exporter.DescriptorReference, err error) { src = src.Clone() if src.Metadata == nil { src.Metadata = make(map[string][]byte) } maps.Copy(src.Metadata, e.meta) - opts := e.opts + opts := e.commit as, _, err := ParseAnnotations(src.Metadata) if err != nil { return nil, nil, err @@ -255,23 +262,23 @@ func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source resp := make(map[string]string) - if n, ok := src.Metadata["image.name"]; e.opts.ImageName == "*" && ok { - e.opts.ImageName = string(n) + if n, ok := src.Metadata["image.name"]; e.commit.ImageName == "*" && ok { + e.commit.ImageName = string(n) } nameCanonical := e.nameCanonical - if e.danglingPrefix != "" && (!e.danglingEmptyOnly || e.opts.ImageName == "") { + if e.danglingPrefix != "" && (!e.danglingEmptyOnly || e.commit.ImageName == "") { danglingImageName := e.danglingPrefix + "@" + desc.Digest.String() - if e.opts.ImageName != "" { - e.opts.ImageName += "," + danglingImageName + if e.commit.ImageName != "" { + e.commit.ImageName += "," + danglingImageName } else { - e.opts.ImageName = danglingImageName + e.commit.ImageName = danglingImageName nameCanonical = false } } - if e.opts.ImageName != "" { - targetNames := strings.SplitSeq(e.opts.ImageName, ",") + if e.commit.ImageName != "" { + targetNames := strings.SplitSeq(e.commit.ImageName, ",") for targetName := range targetNames { if e.opt.Images != nil && e.store { tagDone := progress.OneOff(ctx, "naming to "+targetName) @@ -282,8 +289,8 @@ func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source // However, due to a bug of containerd, we are temporarily stuck with this workaround. // https://github.com/containerd/containerd/issues/8322 imageClientCtx := ctx - if e.opts.Epoch != nil { - imageClientCtx = epoch.WithSourceDateEpoch(imageClientCtx, e.opts.Epoch) + if e.commit.Epoch != nil { + imageClientCtx = epoch.WithSourceDateEpoch(imageClientCtx, e.commit.Epoch) } img := images.Image{ Target: *desc, @@ -336,7 +343,7 @@ func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source eg, ctx := errgroup.WithContext(ctx) for _, ref := range refs { eg.Go(func() error { - remotes, err := ref.GetRemotes(ctx, false, e.opts.RefCfg, false, session.NewGroup(sessionID)) + remotes, err := ref.GetRemotes(ctx, false, e.commit.RefCfg, false, session.NewGroup(sessionID)) if err != nil { return err } @@ -365,7 +372,7 @@ func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source } } } - resp[exptypes.ExporterImageNameKey] = e.opts.ImageName + resp[exptypes.ExporterImageNameKey] = e.commit.ImageName } resp[exptypes.ExporterImageDigestKey] = desc.Digest.String() @@ -398,7 +405,7 @@ func (e *imageExporterInstance) pushImage(ctx context.Context, src *exporter.Sou annotations := map[digest.Digest]map[string]string{} mprovider := contentutil.NewMultiProvider(e.opt.ImageWriter.ContentStore()) for _, ref := range refs { - remotes, err := ref.GetRemotes(ctx, false, e.opts.RefCfg, false, session.NewGroup(sessionID)) + remotes, err := ref.GetRemotes(ctx, false, e.commit.RefCfg, false, session.NewGroup(sessionID)) if err != nil { return err } @@ -455,7 +462,7 @@ func (e *imageExporterInstance) unpackImage(ctx context.Context, img images.Imag return err } - remotes, err := ref.GetRemotes(ctx, true, e.opts.RefCfg, false, s) + remotes, err := ref.GetRemotes(ctx, true, e.commit.RefCfg, false, s) if err != nil { return err } diff --git a/exporter/containerimage/exptypes/exporters.go b/exporter/containerimage/exptypes/exporters.go new file mode 100644 index 000000000000..830f260a17e3 --- /dev/null +++ b/exporter/containerimage/exptypes/exporters.go @@ -0,0 +1,15 @@ +package exptypes + +type ExporterTarget string + +const ( + ExporterTargetUnknown ExporterTarget = "" + ExporterTargetNone ExporterTarget = "none" + ExporterTargetFile ExporterTarget = "file" + ExporterTargetDirectory ExporterTarget = "directory" + ExporterTargetStore ExporterTarget = "store" +) + +func (t ExporterTarget) String() string { + return string(t) +} diff --git a/exporter/exporter.go b/exporter/exporter.go index c16f174558ba..3dd68b405c13 100644 --- a/exporter/exporter.go +++ b/exporter/exporter.go @@ -4,18 +4,39 @@ import ( "context" "github.com/moby/buildkit/cache" + "github.com/moby/buildkit/executor" "github.com/moby/buildkit/exporter/containerimage/exptypes" + "github.com/moby/buildkit/frontend" "github.com/moby/buildkit/solver/result" "github.com/moby/buildkit/util/compression" ocispecs "github.com/opencontainers/image-spec/specs-go/v1" ) -type Source = result.Result[cache.ImmutableRef] +type Source struct { + *result.Result[cache.ImmutableRef] + FrontendResult *frontend.Result +} + +func (src *Source) Clone() *Source { + if src == nil { + return nil + } + return &Source{ + Result: src.Result.Clone(), + FrontendResult: src.FrontendResult.Clone(), + } +} type Attestation = result.Attestation[cache.ImmutableRef] type Exporter interface { - Resolve(context.Context, int, map[string]string) (ExporterInstance, error) + Resolve(ctx context.Context, id int, opts ResolveOpts) (ExporterInstance, error) +} + +type ResolveOpts struct { + Attrs map[string]string + Target exptypes.ExporterTarget + FrontendAttrs map[string]string } type ExporterInstance interface { @@ -23,8 +44,8 @@ type ExporterInstance interface { Name() string Config() *Config Type() string - Attrs() map[string]string - Export(ctx context.Context, src *Source, inlineCache exptypes.InlineCache, sessionID string) (map[string]string, DescriptorReference, error) + Opts() ResolveOpts + Export(ctx context.Context, llbBridge frontend.FrontendLLBBridge, exec executor.Executor, src *Source, inlineCache exptypes.InlineCache, sessionID string) (map[string]string, DescriptorReference, error) } type DescriptorReference interface { diff --git a/exporter/exporter_test.go b/exporter/exporter_test.go new file mode 100644 index 000000000000..9ec5bcf087bd --- /dev/null +++ b/exporter/exporter_test.go @@ -0,0 +1,623 @@ +package exporter + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "os" + "path/filepath" + "testing" + + "github.com/containerd/containerd/v2/core/content" + "github.com/containerd/platforms" + intoto "github.com/in-toto/in-toto-golang/in_toto" + "github.com/moby/buildkit/cache/config" + "github.com/moby/buildkit/client" + "github.com/moby/buildkit/client/llb" + "github.com/moby/buildkit/exporter/containerimage/exptypes" + "github.com/moby/buildkit/frontend/dockerui" + gateway "github.com/moby/buildkit/frontend/gateway/client" + ptypes "github.com/moby/buildkit/solver/llbsolver/provenance/types" + "github.com/moby/buildkit/util/compression" + "github.com/moby/buildkit/util/testutil/integration" + "github.com/moby/buildkit/util/testutil/workers" + digest "github.com/opencontainers/go-digest" + ocispecs "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/stretchr/testify/require" + "github.com/tonistiigi/fsutil" +) + +func init() { + if workers.IsTestDockerd() { + workers.InitDockerdWorker() + } else { + workers.InitOCIWorker() + workers.InitContainerdWorker() + } +} + +func TestExporterIntegration(t *testing.T) { + testIntegration(t, + testGatewayExporter, + testGatewayIsolatedRemotes, + testExternalExporter, + testExternalExporterMultiplatform, + testGatewayExporterCompression, + ) +} + +func testIntegration(t *testing.T, funcs ...func(t *testing.T, sb integration.Sandbox)) { + // NOTE: to build the test exporter image, we need to mirror all the Dockerfile images + mirroredImages := integration.OfficialImages("golang:1.25-alpine3.22") + mirroredImages["tonistiigi/xx:1.6.1"] = "docker.io/tonistiigi/xx:1.6.1" + mirrors := integration.WithMirroredImages(mirroredImages) + + tests := integration.TestFuncs(funcs...) + integration.Run(t, tests, mirrors) +} + +func testGatewayExporter(t *testing.T, sb integration.Sandbox) { + workers.CheckFeatureCompat(t, sb, workers.FeatureOCIExporter, workers.FeatureOCILayout) + + c, err := client.New(sb.Context(), sb.Address()) + require.NoError(t, err) + defer c.Close() + + frontend := func(ctx context.Context, c gateway.Client) (*gateway.Result, error) { + st := llb.Scratch(). + File(llb.Mkfile("/foo.txt", 0644, []byte("foo"))). + File(llb.Mkfile("/bar.txt", 0644, []byte("bar"))) + def, err := st.Marshal(sb.Context()) + if err != nil { + return nil, err + } + return c.Solve(ctx, gateway.SolveRequest{ + Definition: def.ToPB(), + }) + } + + var foundFiles []string + var foundDescs []ocispecs.Descriptor + export := func(ctx context.Context, c gateway.Client, handle gateway.ExportHandle, result *gateway.Result) error { + entries, err := result.Ref.ReadDir(ctx, gateway.ReadDirRequest{Path: "/"}) + if err != nil { + return err + } + for _, entry := range entries { + foundFiles = append(foundFiles, entry.Path) + } + + descs, err := result.Ref.GetRemote(ctx, config.RefConfig{}) + if err != nil { + return err + } + err = checkDescriptors(ctx, handle.ContentStore(), descs) + if err != nil { + return err + } + foundDescs = descs + + return nil + } + + _, err = c.BuildExport(sb.Context(), client.SolveOpt{}, "", frontend, export, nil) + require.NoError(t, err) + + require.Equal(t, []string{"bar.txt", "foo.txt"}, foundFiles) + require.Len(t, foundDescs, 2) // 2 layers +} + +func testGatewayIsolatedRemotes(t *testing.T, sb integration.Sandbox) { + workers.CheckFeatureCompat(t, sb, workers.FeatureOCIExporter, workers.FeatureOCILayout) + + c, err := client.New(sb.Context(), sb.Address()) + require.NoError(t, err) + defer c.Close() + + p := platforms.DefaultSpec() + ps := platforms.Format(p) + + registry, err := sb.NewRegistry() + if errors.Is(err, integration.ErrRequirements) { + t.Skip(err.Error()) + } + require.NoError(t, err) + + exporter := registry + "/buildkit/exporter/sample-isolate:latest" + err = buildTestExporter(sb.Context(), c, exporter) + require.NoError(t, err) + + frontend := func(content string) gateway.BuildFunc { + return func(ctx context.Context, c gateway.Client) (*gateway.Result, error) { + st := llb.Scratch().File(llb.Mkfile("/file.txt", 0644, []byte(content))) + def, err := st.Marshal(sb.Context()) + if err != nil { + return nil, err + } + return c.Solve(ctx, gateway.SolveRequest{ + Definition: def.ToPB(), + }) + } + } + + destFile := filepath.Join(t.TempDir(), "output.txt") + fileOutput := func(map[string]string) (io.WriteCloser, error) { + return os.Create(destFile) + } + + _, err = c.Build(sb.Context(), client.SolveOpt{ + Exports: []client.ExportEntry{ + { + Type: "gateway", + Output: fileOutput, + Attrs: map[string]string{ + "source": exporter, + }, + }, + }, + }, "", frontend("foo"), nil) + require.NoError(t, err) + + reportData, err := os.ReadFile(destFile) + require.NoError(t, err) + report := &report{} + err = json.Unmarshal(reportData, report) + require.NoError(t, err) + require.NotEmpty(t, report.Refs) + require.NotEmpty(t, report.Refs[ps].Layers) + + descsDt, err := json.Marshal(report.Refs[ps].Layers) + require.NoError(t, err) + + _, err = c.Build(sb.Context(), client.SolveOpt{ + Exports: []client.ExportEntry{ + { + Type: "gateway", + Attrs: map[string]string{ + "source": exporter, + "fetch-descs": string(descsDt), + }, + }, + }, + }, "", frontend("foo"), nil) + // should succeed, because this is the same content, so it's accessible + require.NoError(t, err) + + _, err = c.Build(sb.Context(), client.SolveOpt{ + Exports: []client.ExportEntry{ + { + Type: "gateway", + Attrs: map[string]string{ + "source": exporter, + "fetch-descs": string(descsDt), + }, + }, + }, + }, "", frontend("bar"), nil) + // should fail because the content store is isolated per build + require.Error(t, err) + require.ErrorContains(t, err, "failed to get reader for fetch-desc") +} + +func testExternalExporter(t *testing.T, sb integration.Sandbox) { + workers.CheckFeatureCompat(t, sb, workers.FeatureOCIExporter, workers.FeatureOCILayout) + + c, err := client.New(sb.Context(), sb.Address()) + require.NoError(t, err) + defer c.Close() + + registry, err := sb.NewRegistry() + if errors.Is(err, integration.ErrRequirements) { + t.Skip(err.Error()) + } + require.NoError(t, err) + + exporter := registry + "/buildkit/exporter/sample:latest" + err = buildTestExporter(sb.Context(), c, exporter) + require.NoError(t, err) + + destFile := filepath.Join(t.TempDir(), "output.txt") + fileOutput := func(map[string]string) (io.WriteCloser, error) { + return os.Create(destFile) + } + + destDir := filepath.Join(t.TempDir(), "outputd") + + frontend := func(ctx context.Context, c gateway.Client) (*gateway.Result, error) { + st := llb.Scratch(). + File(llb.Mkfile("/foo.txt", 0644, []byte("foo"))). + File(llb.Mkfile("/bar.txt", 0644, []byte("bar"))) + def, err := st.Marshal(sb.Context()) + if err != nil { + return nil, err + } + + res, err := c.Solve(ctx, gateway.SolveRequest{ + Definition: def.ToPB(), + }) + if err != nil { + return nil, err + } + + img := ocispecs.Image{ + Platform: platforms.DefaultSpec(), + Config: ocispecs.ImageConfig{ + Labels: map[string]string{ + "testlabel": "testvalue", + }, + }, + } + config, err := json.Marshal(img) + if err != nil { + return nil, err + } + res.AddMeta(exptypes.ExporterImageConfigKey, config) + + return res, nil + } + + _, err = c.Build(sb.Context(), client.SolveOpt{ + FrontendAttrs: map[string]string{ + "attest:provenance": "mode=max", + }, + Exports: []client.ExportEntry{ + { + Type: "gateway", + Output: fileOutput, + Attrs: map[string]string{ + "opt1": "value1", + "source": exporter, + }, + }, + { + Type: "gateway", + OutputDir: destDir, + Attrs: map[string]string{ + "opt1": "value1", + "source": exporter, + }, + }, + }, + }, "", frontend, nil) + require.NoError(t, err) + + destFileData, err := os.ReadFile(destFile) + require.NoError(t, err) + destDirData, err := os.ReadFile(destDir + "/report.json") + require.NoError(t, err) + + fileReport := &report{} + err = json.Unmarshal(destFileData, fileReport) + require.NoError(t, err) + require.Equal(t, "file", fileReport.Target) + dirReport := &report{} + err = json.Unmarshal(destDirData, dirReport) + require.NoError(t, err) + require.Equal(t, "directory", dirReport.Target) + + for _, report := range []*report{fileReport, dirReport} { + require.Contains(t, report.Opts, "opt1") + require.Equal(t, "value1", report.Opts["opt1"]) + + require.NotEmpty(t, report.Platforms) + require.NotEmpty(t, report.Refs) + require.Equal(t, len(report.Platforms), len(report.Refs)) + + for p, ref := range report.Refs { + require.Contains(t, report.Platforms, p) + + var img ocispecs.Image + err := json.Unmarshal(ref.Config, &img) + require.NoError(t, err) + require.Equal(t, "testvalue", img.Config.Labels["testlabel"]) + + // files checked using ReadDir/ReadFile + require.Equal(t, []string{"/bar.txt", "/foo.txt"}, ref.AllFiles) + + // layers read using content api + require.Equal(t, 2, len(ref.Layers)) + require.Equal(t, []string{"foo.txt"}, ref.LayerFiles[ref.Layers[0].Digest]) + require.Equal(t, []string{"bar.txt"}, ref.LayerFiles[ref.Layers[1].Digest]) + + // attestations created + require.GreaterOrEqual(t, len(ref.Attestations), 1) + for _, att := range ref.Attestations { + require.Equal(t, intoto.StatementInTotoV01, att.Type) + require.Equal(t, "report.json", att.Subject[0].Name) + require.Equal(t, ptypes.BuildKitBuildType02, att.Predicate.(map[string]any)["buildType"]) + } + } + } +} + +func testExternalExporterMultiplatform(t *testing.T, sb integration.Sandbox) { + workers.CheckFeatureCompat(t, sb, workers.FeatureOCIExporter, workers.FeatureOCILayout) + + c, err := client.New(sb.Context(), sb.Address()) + require.NoError(t, err) + defer c.Close() + + registry, err := sb.NewRegistry() + if errors.Is(err, integration.ErrRequirements) { + t.Skip(err.Error()) + } + require.NoError(t, err) + + exporter := registry + "/buildkit/exporter/sample-mp:latest" + err = buildTestExporter(sb.Context(), c, exporter) + require.NoError(t, err) + + destFile := filepath.Join(t.TempDir(), "output.txt") + fileOutput := func(map[string]string) (io.WriteCloser, error) { + return os.Create(destFile) + } + + destDir := filepath.Join(t.TempDir(), "outputd") + + platformsToTest := []string{"linux/amd64", "linux/arm64"} + + frontend := func(ctx context.Context, c gateway.Client) (*gateway.Result, error) { + st := llb.Scratch(). + File(llb.Mkfile("/foo.txt", 0644, []byte("foo"))). + File(llb.Mkfile("/bar.txt", 0644, []byte("bar"))) + def, err := st.Marshal(sb.Context()) + if err != nil { + return nil, err + } + + res, err := c.Solve(ctx, gateway.SolveRequest{ + Definition: def.ToPB(), + }) + if err != nil { + return nil, err + } + ref := res.Ref + + res = gateway.NewResult() + expPlatforms := &exptypes.Platforms{ + Platforms: make([]exptypes.Platform, len(platformsToTest)), + } + for i, platform := range platformsToTest { + platformSpec := platforms.MustParse(platform) + expPlatforms.Platforms[i] = exptypes.Platform{ID: platform, Platform: platformSpec} + img := ocispecs.Image{ + Platform: platformSpec, + Config: ocispecs.ImageConfig{ + Labels: map[string]string{ + "testlabel": "testvalue", + }, + }, + } + config, err := json.Marshal(img) + if err != nil { + return nil, err + } + res.AddRef(platform, ref) + res.AddMeta(fmt.Sprintf("%s/%s", exptypes.ExporterImageConfigKey, platform), config) + } + dt, err := json.Marshal(expPlatforms) + if err != nil { + return nil, err + } + res.AddMeta(exptypes.ExporterPlatformsKey, dt) + + return res, nil + } + + _, err = c.Build(sb.Context(), client.SolveOpt{ + FrontendAttrs: map[string]string{ + "attest:provenance": "mode=max", + }, + Exports: []client.ExportEntry{ + { + Type: "gateway", + Output: fileOutput, + Attrs: map[string]string{ + "opt1": "value1", + "source": exporter, + }, + }, + { + Type: "gateway", + OutputDir: destDir, + Attrs: map[string]string{ + "opt1": "value1", + "source": exporter, + }, + }, + }, + }, "", frontend, nil) + require.NoError(t, err) + + destFileData, err := os.ReadFile(destFile) + require.NoError(t, err) + destDirData, err := os.ReadFile(destDir + "/report.json") + require.NoError(t, err) + + fileReport := &report{} + err = json.Unmarshal(destFileData, fileReport) + require.NoError(t, err) + require.Equal(t, "file", fileReport.Target) + dirReport := &report{} + err = json.Unmarshal(destDirData, dirReport) + require.NoError(t, err) + require.Equal(t, "directory", dirReport.Target) + + for _, report := range []*report{fileReport, dirReport} { + require.Contains(t, report.Opts, "opt1") + require.Equal(t, "value1", report.Opts["opt1"]) + + require.Len(t, report.Platforms, 2) + require.Len(t, report.Refs, 2) + require.Contains(t, report.Platforms, "linux/amd64") + require.Contains(t, report.Platforms, "linux/arm64") + + for p, ref := range report.Refs { + require.Contains(t, report.Platforms, p) + + var img ocispecs.Image + err := json.Unmarshal(ref.Config, &img) + require.NoError(t, err) + require.Equal(t, "testvalue", img.Config.Labels["testlabel"]) + + // files checked using ReadDir/ReadFile + require.Equal(t, []string{"/bar.txt", "/foo.txt"}, ref.AllFiles) + + // layers read using content api + require.Equal(t, 2, len(ref.Layers)) + require.Equal(t, []string{"foo.txt"}, ref.LayerFiles[ref.Layers[0].Digest]) + require.Equal(t, []string{"bar.txt"}, ref.LayerFiles[ref.Layers[1].Digest]) + + // attestations created + require.GreaterOrEqual(t, len(ref.Attestations), 1) + for _, att := range ref.Attestations { + require.Equal(t, intoto.StatementInTotoV01, att.Type) + require.Equal(t, "report.json", att.Subject[0].Name) + require.Equal(t, ptypes.BuildKitBuildType02, att.Predicate.(map[string]any)["buildType"]) + } + } + } +} + +func testGatewayExporterCompression(t *testing.T, sb integration.Sandbox) { + workers.CheckFeatureCompat(t, sb, workers.FeatureOCIExporter, workers.FeatureOCILayout) + + c, err := client.New(sb.Context(), sb.Address()) + require.NoError(t, err) + defer c.Close() + + frontend := func(ctx context.Context, c gateway.Client) (*gateway.Result, error) { + st := llb.Scratch().File(llb.Mkfile("/foo.txt", 0644, []byte("foo"))) + def, err := st.Marshal(sb.Context()) + if err != nil { + return nil, err + } + return c.Solve(ctx, gateway.SolveRequest{ + Definition: def.ToPB(), + }) + } + + var uncompressedDescs, gzipDescs, zstdDescs []ocispecs.Descriptor + export := func(ctx context.Context, c gateway.Client, handle gateway.ExportHandle, result *gateway.Result) error { + store := handle.ContentStore() + + descs, err := result.Ref.GetRemote(ctx, config.RefConfig{ + Compression: compression.New(compression.Uncompressed).SetForce(true), + }) + if err != nil { + return err + } + if err := checkDescriptors(ctx, store, descs); err != nil { + return err + } + uncompressedDescs = descs + + descs, err = result.Ref.GetRemote(ctx, config.RefConfig{ + Compression: compression.New(compression.Gzip).SetForce(true), + }) + if err != nil { + return err + } + if err := checkDescriptors(ctx, store, descs); err != nil { + return err + } + gzipDescs = descs + + descs, err = result.Ref.GetRemote(ctx, config.RefConfig{ + Compression: compression.New(compression.Zstd).SetForce(true), + }) + if err != nil { + return err + } + if err := checkDescriptors(ctx, store, descs); err != nil { + return err + } + zstdDescs = descs + + return nil + } + + _, err = c.BuildExport(sb.Context(), client.SolveOpt{}, "", frontend, export, nil) + require.NoError(t, err) + + require.Len(t, uncompressedDescs, 1) + for _, desc := range uncompressedDescs { + require.Equal(t, ocispecs.MediaTypeImageLayer, desc.MediaType) + } + + _ = gzipDescs + for _, desc := range gzipDescs { + require.Equal(t, ocispecs.MediaTypeImageLayerGzip, desc.MediaType) + } + + require.Len(t, zstdDescs, 1) + for _, desc := range zstdDescs { + require.Equal(t, ocispecs.MediaTypeImageLayerZstd, desc.MediaType) + } +} + +func buildTestExporter(ctx context.Context, c *client.Client, dest string) error { + gatewayDir, err := fsutil.NewFS(integration.BuildkitSourcePath) + if err != nil { + return err + } + + exporter := dest + _, err = c.Solve(ctx, nil, client.SolveOpt{ + Frontend: "dockerfile.v0", + FrontendAttrs: map[string]string{ + "filename": "exporter/gateway/test/Dockerfile", + }, + LocalMounts: map[string]fsutil.FS{ + dockerui.DefaultLocalNameDockerfile: gatewayDir, + dockerui.DefaultLocalNameContext: gatewayDir, + }, + Exports: []client.ExportEntry{ + { + Type: client.ExporterImage, + Attrs: map[string]string{ + "name": exporter, + "push": "true", + }, + }, + }, + }, nil) + return err +} + +type report struct { + Opts map[string]string `json:"opts"` + Target string `json:"target"` + Platforms []string `json:"platforms"` + + Refs map[string]*reportRef `json:"refs"` +} + +type reportRef struct { + Config json.RawMessage `json:"config"` + + AllFiles []string `json:"all_files"` + + Layers []ocispecs.Descriptor `json:"layers"` + LayerFiles map[digest.Digest][]string `json:"layer_files"` + + Attestations []intoto.Statement `json:"attestations"` +} + +func checkDescriptors(ctx context.Context, store content.Store, descs []ocispecs.Descriptor) error { + for _, desc := range descs { + r, err := store.ReaderAt(ctx, desc) + if err != nil { + return err + } + defer r.Close() + sr := io.NewSectionReader(r, 0, r.Size()) + _, err = io.Copy(io.Discard, sr) + if err != nil { + return err + } + } + return nil +} diff --git a/exporter/gateway/export.go b/exporter/gateway/export.go new file mode 100644 index 000000000000..32c6d4d836dc --- /dev/null +++ b/exporter/gateway/export.go @@ -0,0 +1,244 @@ +package gateway + +import ( + "context" + "fmt" + "os" + + api "github.com/containerd/containerd/api/services/content/v1" + "github.com/containerd/containerd/v2/core/content" + "github.com/containerd/containerd/v2/core/leases" + "github.com/containerd/containerd/v2/plugins/services/content/contentserver" + "github.com/moby/buildkit/cache" + "github.com/moby/buildkit/client" + "github.com/moby/buildkit/executor" + "github.com/moby/buildkit/exporter" + "github.com/moby/buildkit/exporter/containerimage" + "github.com/moby/buildkit/exporter/containerimage/exptypes" + "github.com/moby/buildkit/frontend" + "github.com/moby/buildkit/frontend/gateway" + "github.com/moby/buildkit/frontend/gateway/container" + "github.com/moby/buildkit/frontend/gateway/forwarder" + "github.com/moby/buildkit/session" + "github.com/moby/buildkit/session/filesync" + "github.com/moby/buildkit/solver" + "github.com/moby/buildkit/util/progress/logs" + "github.com/moby/buildkit/worker" + "github.com/pkg/errors" + "google.golang.org/grpc" +) + +const ( + keySource = "source" +) + +type Opt struct { + CacheManager cache.Manager + SessionManager *session.Manager + ImageWriter *containerimage.ImageWriter + LeaseManager leases.Manager + + WorkerInfo client.WorkerInfo +} + +type gatewayExporter struct { + opt Opt +} + +func New(opt Opt) (exporter.Exporter, error) { + im := &gatewayExporter{opt: opt} + return im, nil +} + +func (e *gatewayExporter) Resolve(ctx context.Context, id int, opts exporter.ResolveOpts) (exporter.ExporterInstance, error) { + i := &gatewayExporterInstance{ + gatewayExporter: e, + id: id, + opts: opts, + workerInfo: workerInfo{ + cm: e.opt.CacheManager, + info: e.opt.WorkerInfo, + }, + } + + for k, v := range opts.Attrs { + switch k { + case keySource: + i.image = v + + default: + if i.meta == nil { + i.meta = make(map[string][]byte) + } + i.meta[k] = []byte(v) + } + } + return i, nil +} + +type gatewayExporterInstance struct { + *gatewayExporter + id int + opts exporter.ResolveOpts + + workerInfo worker.Infos + + image string + + meta map[string][]byte +} + +func (e *gatewayExporterInstance) ID() int { + return e.id +} + +func (e *gatewayExporterInstance) Name() string { + return fmt.Sprintf("exporting using %s", e.image) +} + +func (e *gatewayExporterInstance) Type() string { + return client.ExporterGateway +} + +func (e *gatewayExporterInstance) Opts() exporter.ResolveOpts { + return e.opts +} + +func (e *gatewayExporterInstance) Config() *exporter.Config { + return exporter.NewConfig() +} + +func (e *gatewayExporterInstance) Export(ctx context.Context, llbBridge frontend.FrontendLLBBridge, exec executor.Executor, src *exporter.Source, inlineCache exptypes.InlineCache, sessionID string) (_ map[string]string, descref exporter.DescriptorReference, err error) { + c, err := forwarder.LLBBridgeToGatewayClient(ctx, llbBridge, exec, e.opts.FrontendAttrs, nil, e.workerInfo, sessionID, e.opt.SessionManager) + if err != nil { + return nil, nil, err + } + st, img, mfstDigest, err := gateway.LoadImage(ctx, c, e.image) + if err != nil { + return nil, nil, err + } + _ = mfstDigest + + def, err := st.Marshal(ctx) + if err != nil { + return nil, nil, err + } + + res, err := llbBridge.Solve(ctx, frontend.SolveRequest{ + Definition: def.ToPB(), + }, sessionID) + if err != nil { + return nil, nil, err + } + defer func() { + ctx := context.WithoutCancel(ctx) + res.EachRef(func(ref solver.ResultProxy) error { + return ref.Release(ctx) + }) + }() + if res.Ref == nil { + return nil, nil, errors.Errorf("gateway source didn't return default result") + } + frontendDef := res.Ref.Definition() + r, err := res.Ref.Result(ctx) + if err != nil { + return nil, nil, err + } + workerRef, ok := r.Sys().(*worker.WorkerRef) + if !ok { + return nil, nil, errors.Errorf("invalid ref: %T", r.Sys()) + } + rootFS, err := workerRef.Worker.CacheManager().New(ctx, workerRef.ImmutableRef, session.NewGroup(sessionID)) + if err != nil { + return nil, nil, err + } + defer rootFS.Release(context.TODO()) + + opts := make(map[string]string) + for k, v := range e.meta { + opts[k] = string(v) + } + meta, err := gateway.GetEnv(*img, opts, e.workerInfo, sessionID) + if err != nil { + return nil, nil, err + } + meta.Env = append(meta.Env, "BUILDKIT_EXPORTER_TARGET="+e.opts.Target.String()) + + err = gateway.CheckCaps(*img, opts, nil, mfstDigest) + if err != nil { + return nil, nil, err + } + + caller, err := e.opt.SessionManager.Get(ctx, sessionID, false) + if err != nil { + return nil, nil, err + } + + lbf := gateway.NewBridgeForwarder(ctx, llbBridge, exec, e.workerInfo, nil, sessionID, e.opt.SessionManager) + lbf.SetResult(src.FrontendResult, nil) + + attachables := []session.Attachable{} + attachables = append(attachables, &proxyStore{lbf.Store(e.opt.ImageWriter.ContentStore())}) + switch e.opts.Target { + case exptypes.ExporterTargetFile: + attachables = append(attachables, &filesync.ProxyStreamWriter{Caller: caller, ExporterID: e.id}) + case exptypes.ExporterTargetDirectory: + attachables = append(attachables, &filesync.ProxyDiffCopy{Caller: caller, ExporterID: e.id}) + } + + ctx = lbf.Serve(ctx, attachables...) + defer lbf.Close() + defer lbf.Discard() + + mdmnt, release, err := gateway.MetadataMount(frontendDef) + if err != nil { + return nil, nil, err + } + if release != nil { + defer release() + } + var mnts []executor.Mount + if mdmnt != nil { + mnts = append(mnts, *mdmnt) + } + + stdout, stderr, flush := logs.NewLogStreams(ctx, os.Getenv("BUILDKIT_DEBUG_EXEC_OUTPUT") == "1") + defer stdout.Close() + defer stderr.Close() + defer func() { + if err != nil { + flush() + } + }() + + connIn, connOut := lbf.Conn() + _, err = exec.Run(ctx, "", container.MountWithSession(rootFS, session.NewGroup(sessionID)), mnts, executor.ProcessInfo{Meta: *meta, Stdin: connIn, Stdout: connOut, Stderr: stderr}, nil) + if err != nil { + lbf.SetResult(nil, err) + } + + _, err = lbf.Result(ctx) + return nil, nil, err +} + +type workerInfo struct { + cm cache.Manager + info client.WorkerInfo +} + +func (i workerInfo) DefaultCacheManager() (cache.Manager, error) { + return i.cm, nil +} + +func (i workerInfo) WorkerInfos() []client.WorkerInfo { + return []client.WorkerInfo{i.info} +} + +type proxyStore struct { + store content.Store +} + +func (s *proxyStore) Register(server *grpc.Server) { + service := contentserver.New(s.store) + api.RegisterContentServer(server, service) +} diff --git a/exporter/gateway/test/Dockerfile b/exporter/gateway/test/Dockerfile new file mode 100644 index 000000000000..5a564f907461 --- /dev/null +++ b/exporter/gateway/test/Dockerfile @@ -0,0 +1,31 @@ +# syntax=docker/dockerfile-upstream:master + +ARG GO_VERSION=1.25 +ARG ALPINE_VERSION=3.22 +ARG XX_VERSION=1.6.1 + +# xx is a helper for cross-compilation +FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx + +FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base +RUN apk add git bash +COPY --from=xx / / +WORKDIR /src +ENV GOFLAGS=-mod=vendor + +FROM base AS build +RUN apk add --no-cache file +ARG BUILDTAGS="" +ARG TARGETPLATFORM +RUN --mount=target=. --mount=type=cache,target=/root/.cache \ + --mount=target=/go/pkg/mod,type=cache \ + CGO_ENABLED=0 xx-go build -o /test-exporter -tags "$BUILDTAGS netgo static_build osusergo" ./exporter/gateway/test && \ + xx-verify --static /test-exporter + +FROM scratch AS release +LABEL moby.buildkit.frontend.network.none="true" +# LABEL moby.buildkit.frontend.caps="" # currently no caps defined +COPY --from=build /test-exporter /bin/test-exporter +ENTRYPOINT ["/bin/test-exporter"] + +FROM release diff --git a/exporter/gateway/test/attestation.go b/exporter/gateway/test/attestation.go new file mode 100644 index 000000000000..1155be6c59d0 --- /dev/null +++ b/exporter/gateway/test/attestation.go @@ -0,0 +1,62 @@ +package main + +import ( + "context" + + intoto "github.com/in-toto/in-toto-golang/in_toto" + "github.com/moby/buildkit/exporter/attestation" + "github.com/moby/buildkit/frontend/gateway/client" + gatewaypb "github.com/moby/buildkit/frontend/gateway/pb" + "github.com/moby/buildkit/solver/result" + "github.com/pkg/errors" + "golang.org/x/sync/errgroup" +) + +func MakeInTotoStatements(ctx context.Context, attestations []result.Attestation[client.Reference], defaultSubjects []intoto.Subject) ([]intoto.Statement, error) { + eg, ctx := errgroup.WithContext(ctx) + statements := make([]intoto.Statement, len(attestations)) + + for i, att := range attestations { + i, att := i, att + eg.Go(func() error { + content, err := readAttestation(ctx, att) + if err != nil { + return err + } + + switch att.Kind { + case gatewaypb.AttestationKind_InToto: + stmt, err := attestation.MakeInTotoStatement(content, att, defaultSubjects) + if err != nil { + return err + } + statements[i] = *stmt + case gatewaypb.AttestationKind_Bundle: + return errors.New("bundle attestation kind must be un-bundled first") + } + return nil + }) + } + if err := eg.Wait(); err != nil { + return nil, err + } + return statements, nil +} + +func readAttestation(ctx context.Context, att result.Attestation[client.Reference]) ([]byte, error) { + var content []byte + var err error + if att.ContentFunc != nil { + content, err = att.ContentFunc(ctx) + } + if att.Ref != nil { + content, err = att.Ref.ReadFile(ctx, client.ReadRequest{Filename: att.Path}) + } + if err != nil { + return nil, err + } + if len(content) == 0 { + content = nil + } + return content, nil +} diff --git a/exporter/gateway/test/main.go b/exporter/gateway/test/main.go new file mode 100644 index 000000000000..377164cc0807 --- /dev/null +++ b/exporter/gateway/test/main.go @@ -0,0 +1,227 @@ +package main + +import ( + "archive/tar" + "compress/gzip" + "context" + "encoding/json" + "fmt" + "io" + "os" + "path" + + intoto "github.com/in-toto/in-toto-golang/in_toto" + "github.com/moby/buildkit/cache/config" + "github.com/moby/buildkit/exporter/containerimage/exptypes" + "github.com/moby/buildkit/frontend/gateway/client" + "github.com/moby/buildkit/frontend/gateway/grpcclient" + "github.com/moby/buildkit/solver/result" + "github.com/moby/buildkit/util/appcontext" + "github.com/moby/buildkit/util/bklog" + _ "github.com/moby/buildkit/util/grpcutil/encoding/proto" + "github.com/moby/buildkit/util/staticfs" + digest "github.com/opencontainers/go-digest" + ocispecs "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" + fstypes "github.com/tonistiigi/fsutil/types" +) + +func main() { + if err := grpcclient.ExportFromEnvironment(appcontext.Context(), export); err != nil { + bklog.L.Errorf("fatal error: %+v", err) + panic(err) + } +} + +type report struct { + Opts map[string]string `json:"opts"` + Target string `json:"target"` + Platforms []string `json:"platforms"` + + Refs map[string]*reportRef `json:"refs"` +} + +type reportRef struct { + Config json.RawMessage `json:"config"` + + AllFiles []string `json:"all_files"` + + Layers []ocispecs.Descriptor `json:"layers"` + LayerFiles map[digest.Digest][]string `json:"layer_files"` + + Attestations []intoto.Statement `json:"attestations"` +} + +func export(ctx context.Context, c client.Client, handle client.ExportHandle, res *client.Result) (err error) { + opts := c.BuildOpts().Opts + if opts == nil { + opts = map[string]string{} + } + + store := handle.ContentStore() + + report := &report{ + Opts: opts, + Target: string(handle.Target), + Refs: map[string]*reportRef{}, + } + + ps, err := exptypes.ParsePlatforms(res.Metadata) + if err != nil { + return err + } + for _, p := range ps.Platforms { + report.Platforms = append(report.Platforms, p.ID) + ref, ok := res.FindRef(p.ID) + if !ok { + return errors.Errorf("no ref for platform %s", p.ID) + } + + reportRef := &reportRef{} + report.Refs[p.ID] = reportRef + + reportRef.Config = exptypes.ParseKey(res.Metadata, exptypes.ExporterImageConfigKey, &p) + + err := walkDir(ctx, ref, "/", func(path string, info *fstypes.Stat) error { + reportRef.AllFiles = append(reportRef.AllFiles, path) + return nil + }) + if err != nil { + return errors.Wrapf(err, "failed to walk ref for platform %s", p.ID) + } + + descs, err := ref.GetRemote(ctx, config.RefConfig{}) + if err != nil { + return errors.Wrapf(err, "failed to get remote descs for platform %s", p.ID) + } + + reportRef.LayerFiles = map[digest.Digest][]string{} + for _, desc := range descs { + reportRef.Layers = append(reportRef.Layers, desc) + + err := func() (rerr error) { + r, err := store.ReaderAt(ctx, desc) + if err != nil { + return errors.Wrap(err, "failed to get reader for exported content") + } + defer func() { + err := r.Close() + if rerr == nil { + rerr = err + } + }() + + sr := io.NewSectionReader(r, 0, r.Size()) + rr, err := gzip.NewReader(sr) + if err != nil { + return errors.Wrap(err, "failed to create gzip reader") + } + tr := tar.NewReader(rr) + + for { + hdr, err := tr.Next() + if errors.Is(err, io.EOF) { + break + } + if err != nil { + return errors.Wrap(err, "failed to read tar header") + } + reportRef.LayerFiles[desc.Digest] = append(reportRef.LayerFiles[desc.Digest], hdr.Name) + } + + return nil + }() + if err != nil { + return err + } + } + + var defaultSubjects []intoto.Subject + defaultSubjects = append(defaultSubjects, intoto.Subject{ + Name: "report.json", + Digest: result.ToDigestMap(digest.FromString("report.json")), + }) + atts, ok := res.Attestations[p.ID] + if ok { + stmts, err := MakeInTotoStatements(ctx, atts, defaultSubjects) + if err != nil { + return errors.Wrapf(err, "failed to make in-toto statements for platform %s", p.ID) + } + + reportRef.Attestations = stmts + } + } + + if descs, ok := opts["fetch-descs"]; ok { + var fetchDescs []ocispecs.Descriptor + if err := json.Unmarshal([]byte(descs), &fetchDescs); err != nil { + return errors.Wrap(err, "failed to unmarshal fetch-descs") + } + + store := handle.ContentStore() + for _, desc := range fetchDescs { + r, err := store.ReaderAt(ctx, desc) + if err != nil { + return errors.Wrapf(err, "failed to get reader for fetch-desc %s", desc.Digest) + } + defer r.Close() + sr := io.NewSectionReader(r, 0, r.Size()) + + _, err = io.Copy(io.Discard, sr) + if err != nil { + return errors.Wrapf(err, "failed to read fetch-desc %s", desc.Digest) + } + } + } + + out, err := json.MarshalIndent(report, "", " ") + if err != nil { + return errors.Wrap(err, "failed to marshal report") + } + out = append(out, '\n') + fmt.Fprint(os.Stderr, string(out)) + + switch handle.Target { + case exptypes.ExporterTargetNone: + case exptypes.ExporterTargetFile: + w, err := handle.SendFile(ctx) + if err != nil { + return err + } + _, err = fmt.Fprint(w, string(out)) + if err != nil { + return err + } + if err := w.Close(); err != nil { + return err + } + case exptypes.ExporterTargetDirectory: + fs := staticfs.NewFS() + fs.Add("report.json", &fstypes.Stat{Mode: 0644}, out) + return handle.SendFS(ctx, fs) + } + + return nil +} + +func walkDir(ctx context.Context, ref client.Reference, root string, fn func(path string, info *fstypes.Stat) error) error { + entries, err := ref.ReadDir(ctx, client.ReadDirRequest{Path: root}) + if err != nil { + return err + } + for _, entry := range entries { + entryPath := path.Join(root, entry.Path) + if entry.IsDir() { + entryPath += "/" + } + if err := fn(entryPath, entry); err != nil { + return err + } + if entry.IsDir() { + if err := walkDir(ctx, ref, entryPath, fn); err != nil { + return err + } + } + } + return nil +} diff --git a/exporter/local/export.go b/exporter/local/export.go index 10e3a87ce3a0..ece23255ad0a 100644 --- a/exporter/local/export.go +++ b/exporter/local/export.go @@ -9,9 +9,11 @@ import ( "github.com/moby/buildkit/cache" "github.com/moby/buildkit/client" + "github.com/moby/buildkit/executor" "github.com/moby/buildkit/exporter" "github.com/moby/buildkit/exporter/containerimage/exptypes" "github.com/moby/buildkit/exporter/util/epoch" + "github.com/moby/buildkit/frontend" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/filesync" "github.com/moby/buildkit/util/progress" @@ -36,13 +38,18 @@ func New(opt Opt) (exporter.Exporter, error) { return le, nil } -func (e *localExporter) Resolve(ctx context.Context, id int, opt map[string]string) (exporter.ExporterInstance, error) { +func (e *localExporter) Resolve(ctx context.Context, id int, opts exporter.ResolveOpts) (exporter.ExporterInstance, error) { + if opts.Target != exptypes.ExporterTargetUnknown && opts.Target != exptypes.ExporterTargetDirectory { + return nil, errors.Errorf("local exporter only supports directory target") + } + opts.Target = exptypes.ExporterTargetDirectory + i := &localExporterInstance{ id: id, - attrs: opt, + opts: opts, localExporter: e, } - _, err := i.opts.Load(opt) + _, err := i.fsOpts.Load(opts.Attrs) if err != nil { return nil, err } @@ -52,10 +59,10 @@ func (e *localExporter) Resolve(ctx context.Context, id int, opt map[string]stri type localExporterInstance struct { *localExporter - id int - attrs map[string]string + id int + opts exporter.ResolveOpts - opts CreateFSOpts + fsOpts CreateFSOpts } func (e *localExporterInstance) ID() int { @@ -70,24 +77,28 @@ func (e *localExporterInstance) Type() string { return client.ExporterLocal } -func (e *localExporterInstance) Attrs() map[string]string { - return e.attrs +func (e *localExporterInstance) Opts() exporter.ResolveOpts { + return e.opts +} + +func (e *localExporterInstance) Target() exptypes.ExporterTarget { + return exptypes.ExporterTargetDirectory } func (e *localExporter) Config() *exporter.Config { return exporter.NewConfig() } -func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source, _ exptypes.InlineCache, sessionID string) (map[string]string, exporter.DescriptorReference, error) { +func (e *localExporterInstance) Export(ctx context.Context, llbBridge frontend.FrontendLLBBridge, exec executor.Executor, inp *exporter.Source, _ exptypes.InlineCache, sessionID string) (map[string]string, exporter.DescriptorReference, error) { timeoutCtx, cancel := context.WithCancelCause(ctx) timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, 5*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet defer func() { cancel(errors.WithStack(context.Canceled)) }() - if e.opts.Epoch == nil { + if e.fsOpts.Epoch == nil { if tm, ok, err := epoch.ParseSource(inp); err != nil { return nil, nil, err } else if ok { - e.opts.Epoch = tm + e.fsOpts.Epoch = tm } } @@ -117,7 +128,7 @@ func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source export := func(ctx context.Context, k string, ref cache.ImmutableRef, attestations []exporter.Attestation) func() error { return func() error { - outputFS, cleanup, err := CreateFS(ctx, sessionID, k, ref, attestations, now, isMap, e.opts) + outputFS, cleanup, err := CreateFS(ctx, sessionID, k, ref, attestations, now, isMap, e.fsOpts) if err != nil { return err } @@ -126,7 +137,7 @@ func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source } lbl := "copying files" - if !e.opts.UsePlatformSplit(isMap) { + if !e.fsOpts.UsePlatformSplit(isMap) { // check for duplicate paths err = fsWalk(ctx, outputFS, "", func(p string, entry os.DirEntry, err error) error { if entry.IsDir() { @@ -152,8 +163,8 @@ func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source Mode: uint32(os.ModeDir | 0755), Path: strings.ReplaceAll(k, "/", "_"), } - if e.opts.Epoch != nil { - st.ModTime = e.opts.Epoch.UnixNano() + if e.fsOpts.Epoch != nil { + st.ModTime = e.fsOpts.Epoch.UnixNano() } outputFS, err = fsutil.SubDirFS([]fsutil.Dir{{FS: outputFS, Stat: st}}) if err != nil { diff --git a/exporter/oci/export.go b/exporter/oci/export.go index 0ba04d12314c..943120fd88fe 100644 --- a/exporter/oci/export.go +++ b/exporter/oci/export.go @@ -16,9 +16,11 @@ import ( "github.com/moby/buildkit/cache" cacheconfig "github.com/moby/buildkit/cache/config" "github.com/moby/buildkit/client" + "github.com/moby/buildkit/executor" "github.com/moby/buildkit/exporter" "github.com/moby/buildkit/exporter/containerimage" "github.com/moby/buildkit/exporter/containerimage/exptypes" + "github.com/moby/buildkit/frontend" "github.com/moby/buildkit/session" sessioncontent "github.com/moby/buildkit/session/content" "github.com/moby/buildkit/session/filesync" @@ -60,13 +62,13 @@ func New(opt Opt) (exporter.Exporter, error) { return im, nil } -func (e *imageExporter) Resolve(ctx context.Context, id int, opt map[string]string) (exporter.ExporterInstance, error) { +func (e *imageExporter) Resolve(ctx context.Context, id int, opts exporter.ResolveOpts) (exporter.ExporterInstance, error) { i := &imageExporterInstance{ imageExporter: e, id: id, - attrs: opt, + opts: opts, tar: true, - opts: containerimage.ImageCommitOpts{ + image: containerimage.ImageCommitOpts{ RefCfg: cacheconfig.RefConfig{ Compression: compression.New(compression.Default), }, @@ -74,7 +76,7 @@ func (e *imageExporter) Resolve(ctx context.Context, id int, opt map[string]stri }, } - opt, err := i.opts.Load(ctx, opt) + opt, err := i.image.Load(ctx, opts.Attrs) if err != nil { return nil, err } @@ -98,17 +100,30 @@ func (e *imageExporter) Resolve(ctx context.Context, id int, opt map[string]stri i.meta[k] = []byte(v) } } + + if i.tar { + if opts.Target != exptypes.ExporterTargetFile && opts.Target != exptypes.ExporterTargetUnknown { + return nil, errors.Errorf("tar=true exporter only supports file target") + } + opts.Target = exptypes.ExporterTargetFile + } else { + if opts.Target != exptypes.ExporterTargetStore && opts.Target != exptypes.ExporterTargetUnknown { + return nil, errors.Errorf("tar=false exporter only supports content store target") + } + opts.Target = exptypes.ExporterTargetStore + } + return i, nil } type imageExporterInstance struct { *imageExporter - id int - attrs map[string]string + id int + opts exporter.ResolveOpts - opts containerimage.ImageCommitOpts - tar bool - meta map[string][]byte + image containerimage.ImageCommitOpts + tar bool + meta map[string][]byte } func (e *imageExporterInstance) ID() int { @@ -123,15 +138,22 @@ func (e *imageExporterInstance) Type() string { return string(e.opt.Variant) } -func (e *imageExporterInstance) Attrs() map[string]string { - return e.attrs +func (e *imageExporterInstance) Opts() exporter.ResolveOpts { + return e.opts +} + +func (e *imageExporterInstance) Target() exptypes.ExporterTarget { + if e.tar { + return exptypes.ExporterTargetFile + } + return exptypes.ExporterTargetStore } func (e *imageExporterInstance) Config() *exporter.Config { - return exporter.NewConfigWithCompression(e.opts.RefCfg.Compression) + return exporter.NewConfigWithCompression(e.image.RefCfg.Compression) } -func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source, inlineCache exptypes.InlineCache, sessionID string) (_ map[string]string, descref exporter.DescriptorReference, err error) { +func (e *imageExporterInstance) Export(ctx context.Context, llbBridge frontend.FrontendLLBBridge, exec executor.Executor, src *exporter.Source, inlineCache exptypes.InlineCache, sessionID string) (_ map[string]string, descref exporter.DescriptorReference, err error) { if e.opt.Variant == VariantDocker && len(src.Refs) > 0 { return nil, nil, errors.Errorf("docker exporter does not currently support exporting manifest lists") } @@ -142,7 +164,7 @@ func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source } maps.Copy(src.Metadata, e.meta) - opts := e.opts + opts := e.image as, _, err := containerimage.ParseAnnotations(src.Metadata) if err != nil { return nil, nil, err @@ -194,11 +216,11 @@ func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source } resp[exptypes.ExporterImageDescriptorKey] = base64.StdEncoding.EncodeToString(dtdesc) - if n, ok := src.Metadata["image.name"]; e.opts.ImageName == "*" && ok { - e.opts.ImageName = string(n) + if n, ok := src.Metadata["image.name"]; e.image.ImageName == "*" && ok { + e.image.ImageName = string(n) } - names, err := normalizedNames(e.opts.ImageName) + names, err := normalizedNames(e.image.ImageName) if err != nil { return nil, nil, err } @@ -239,7 +261,7 @@ func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source if ref == nil { return nil } - remotes, err := ref.GetRemotes(egCtx, false, e.opts.RefCfg, false, session.NewGroup(sessionID)) + remotes, err := ref.GetRemotes(egCtx, false, e.image.RefCfg, false, session.NewGroup(sessionID)) if err != nil { return err } diff --git a/exporter/tar/export.go b/exporter/tar/export.go index 57d9eef10464..02e57273442b 100644 --- a/exporter/tar/export.go +++ b/exporter/tar/export.go @@ -8,10 +8,12 @@ import ( "github.com/moby/buildkit/cache" "github.com/moby/buildkit/client" + "github.com/moby/buildkit/executor" "github.com/moby/buildkit/exporter" "github.com/moby/buildkit/exporter/containerimage/exptypes" "github.com/moby/buildkit/exporter/local" "github.com/moby/buildkit/exporter/util/epoch" + "github.com/moby/buildkit/frontend" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/filesync" "github.com/moby/buildkit/util/progress" @@ -34,27 +36,31 @@ func New(opt Opt) (exporter.Exporter, error) { return le, nil } -func (e *localExporter) Resolve(ctx context.Context, id int, opt map[string]string) (exporter.ExporterInstance, error) { +func (e *localExporter) Resolve(ctx context.Context, id int, opts exporter.ResolveOpts) (exporter.ExporterInstance, error) { + if opts.Target != exptypes.ExporterTargetFile && opts.Target != exptypes.ExporterTargetUnknown { + return nil, errors.Errorf("local exporter only supports file target") + } + opts.Target = exptypes.ExporterTargetFile + li := &localExporterInstance{ localExporter: e, id: id, - attrs: opt, + opts: opts, } - _, err := li.opts.Load(opt) + _, err := li.fsOpts.Load(opts.Attrs) if err != nil { return nil, err } - _ = opt return li, nil } type localExporterInstance struct { *localExporter - id int - attrs map[string]string + id int + opts exporter.ResolveOpts - opts local.CreateFSOpts + fsOpts local.CreateFSOpts } func (e *localExporterInstance) ID() int { @@ -69,15 +75,19 @@ func (e *localExporterInstance) Type() string { return client.ExporterTar } -func (e *localExporterInstance) Attrs() map[string]string { - return e.attrs +func (e *localExporterInstance) Opts() exporter.ResolveOpts { + return e.opts +} + +func (e *localExporterInstance) Target() exptypes.ExporterTarget { + return exptypes.ExporterTargetFile } func (e *localExporterInstance) Config() *exporter.Config { return exporter.NewConfig() } -func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source, _ exptypes.InlineCache, sessionID string) (map[string]string, exporter.DescriptorReference, error) { +func (e *localExporterInstance) Export(ctx context.Context, llbBridge frontend.FrontendLLBBridge, exec executor.Executor, inp *exporter.Source, _ exptypes.InlineCache, sessionID string) (map[string]string, exporter.DescriptorReference, error) { var defers []func() error defer func() { @@ -86,11 +96,11 @@ func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source } }() - if e.opts.Epoch == nil { + if e.fsOpts.Epoch == nil { if tm, ok, err := epoch.ParseSource(inp); err != nil { return nil, nil, err } else if ok { - e.opts.Epoch = tm + e.fsOpts.Epoch = tm } } @@ -98,7 +108,7 @@ func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source isMap := len(inp.Refs) > 0 getDir := func(ctx context.Context, k string, ref cache.ImmutableRef, attestations []exporter.Attestation) (*fsutil.Dir, error) { - outputFS, cleanup, err := local.CreateFS(ctx, sessionID, k, ref, attestations, now, isMap, e.opts) + outputFS, cleanup, err := local.CreateFS(ctx, sessionID, k, ref, attestations, now, isMap, e.fsOpts) if err != nil { return nil, err } @@ -110,8 +120,8 @@ func (e *localExporterInstance) Export(ctx context.Context, inp *exporter.Source Mode: uint32(os.ModeDir | 0755), Path: strings.ReplaceAll(k, "/", "_"), } - if e.opts.Epoch != nil { - st.ModTime = e.opts.Epoch.UnixNano() + if e.fsOpts.Epoch != nil { + st.ModTime = e.fsOpts.Epoch.UnixNano() } return &fsutil.Dir{ diff --git a/frontend/dockerfile/cmd/dockerfile-frontend/main.go b/frontend/dockerfile/cmd/dockerfile-frontend/main.go index 1d1065ffdcfe..8179c99b88a1 100644 --- a/frontend/dockerfile/cmd/dockerfile-frontend/main.go +++ b/frontend/dockerfile/cmd/dockerfile-frontend/main.go @@ -27,7 +27,7 @@ func main() { os.Exit(0) } - if err := grpcclient.RunFromEnvironment(appcontext.Context(), dockerfile.Build); err != nil { + if err := grpcclient.BuildFromEnvironment(appcontext.Context(), dockerfile.Build); err != nil { bklog.L.Errorf("fatal error: %+v", err) panic(err) } diff --git a/frontend/gateway/client/attestation.go b/frontend/gateway/client/attestation.go index 6ff39cc3b3b4..9e7671999eba 100644 --- a/frontend/gateway/client/attestation.go +++ b/frontend/gateway/client/attestation.go @@ -1,17 +1,15 @@ package client import ( + "context" + pb "github.com/moby/buildkit/frontend/gateway/pb" "github.com/moby/buildkit/solver/result" digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" ) -func AttestationToPB[T any](a *result.Attestation[T]) (*pb.Attestation, error) { - if a.ContentFunc != nil { - return nil, errors.Errorf("attestation callback cannot be sent through gateway") - } - +func AttestationToPB[T any](ctx context.Context, a *result.Attestation[T]) (*pb.Attestation, error) { subjects := make([]*pb.InTotoSubject, len(a.InToto.Subjects)) for i, subject := range a.InToto.Subjects { subjects[i] = &pb.InTotoSubject{ @@ -21,10 +19,20 @@ func AttestationToPB[T any](a *result.Attestation[T]) (*pb.Attestation, error) { } } + var content []byte + if a.ContentFunc != nil { + var err error + content, err = a.ContentFunc(ctx) + if err != nil { + return nil, errors.Wrap(err, "failed to get attestation content") + } + } + return &pb.Attestation{ Kind: a.Kind, Metadata: a.Metadata, Path: a.Path, + Content: content, InTotoPredicateType: a.InToto.PredicateType, InTotoSubjects: subjects, }, nil @@ -46,10 +54,19 @@ func AttestationFromPB[T any](a *pb.Attestation) (*result.Attestation[T], error) } } + var contentF func(context.Context) ([]byte, error) + if a.Content != nil { + content := a.Content + contentF = func(ctx context.Context) ([]byte, error) { + return content, nil + } + } + return &result.Attestation[T]{ - Kind: a.Kind, - Metadata: a.Metadata, - Path: a.Path, + Kind: a.Kind, + Metadata: a.Metadata, + Path: a.Path, + ContentFunc: contentF, InToto: result.InTotoAttestation{ PredicateType: a.InTotoPredicateType, Subjects: subjects, diff --git a/frontend/gateway/client/client.go b/frontend/gateway/client/client.go index 042d66c9c4a5..5bf038fa82b3 100644 --- a/frontend/gateway/client/client.go +++ b/frontend/gateway/client/client.go @@ -5,6 +5,7 @@ import ( "io" "syscall" + "github.com/moby/buildkit/cache/config" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/client/llb/sourceresolver" "github.com/moby/buildkit/solver/pb" @@ -21,6 +22,7 @@ type Result = result.Result[Reference] type Attestation = result.Attestation[Reference] type BuildFunc func(context.Context, Client) (*Result, error) +type ExportFunc func(context.Context, Client, ExportHandle, *Result) error func NewResult() *Result { return &Result{} @@ -101,9 +103,12 @@ type ContainerProcess interface { type Reference interface { ToState() (llb.State, error) Evaluate(ctx context.Context) error + ReadFile(ctx context.Context, req ReadRequest) ([]byte, error) StatFile(ctx context.Context, req StatRequest) (*fstypes.Stat, error) ReadDir(ctx context.Context, req ReadDirRequest) ([]*fstypes.Stat, error) + + GetRemote(ctx context.Context, cfg config.RefConfig) ([]ocispecs.Descriptor, error) } type ReadRequest struct { diff --git a/frontend/gateway/client/exporter.go b/frontend/gateway/client/exporter.go new file mode 100644 index 000000000000..a96bc82e55ac --- /dev/null +++ b/frontend/gateway/client/exporter.go @@ -0,0 +1,49 @@ +package client + +import ( + "context" + "io" + + "github.com/containerd/containerd/v2/core/content" + contentproxy "github.com/containerd/containerd/v2/core/content/proxy" + "github.com/moby/buildkit/exporter/containerimage/exptypes" + "github.com/moby/buildkit/session/filesync" + "github.com/pkg/errors" + "github.com/tonistiigi/fsutil" + "google.golang.org/grpc" +) + +type ExportHandle struct { + Target exptypes.ExporterTarget + Conn *grpc.ClientConn +} + +func (e *ExportHandle) ContentStore() content.Store { + return contentproxy.NewContentStore(e.Conn) +} + +func (e *ExportHandle) SendFile(ctx context.Context) (io.WriteCloser, error) { + if e.Target != exptypes.ExporterTargetFile { + return nil, errors.Errorf("invalid target for file export: %s", e.Target) + } + + client := filesync.NewFileSendClient(e.Conn) + cc, err := client.DiffCopy(ctx) + if err != nil { + return nil, err + } + return filesync.NewStreamWriter(cc), nil +} + +func (e *ExportHandle) SendFS(ctx context.Context, fs fsutil.FS) error { + if e.Target != exptypes.ExporterTargetDirectory { + return errors.Errorf("invalid target for directory export: %s", e.Target) + } + + client := filesync.NewFileSendClient(e.Conn) + cc, err := client.DiffCopy(ctx) + if err != nil { + return err + } + return errors.WithStack(fsutil.Send(cc.Context(), cc, fs, nil)) +} diff --git a/frontend/gateway/content.go b/frontend/gateway/content.go new file mode 100644 index 000000000000..d8d1105dbdb8 --- /dev/null +++ b/frontend/gateway/content.go @@ -0,0 +1,84 @@ +package gateway + +import ( + "context" + "sync" + + "github.com/containerd/containerd/v2/core/content" + cerrdefs "github.com/containerd/errdefs" + digest "github.com/opencontainers/go-digest" + ocispecs "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +type storeFilter struct { + allowed map[digest.Digest]ocispecs.Descriptor + mu sync.Mutex +} + +func (f *storeFilter) allow(descs ...ocispecs.Descriptor) { + f.mu.Lock() + if f.allowed == nil { + f.allowed = make(map[digest.Digest]ocispecs.Descriptor) + } + for _, desc := range descs { + f.allowed[desc.Digest] = desc + } + f.mu.Unlock() +} + +func (f *storeFilter) isAllowed(desc ocispecs.Descriptor) bool { + f.mu.Lock() + _, allowed := f.allowed[desc.Digest] + f.mu.Unlock() + return allowed +} + +func (f *storeFilter) isDigestAllowed(dgst digest.Digest) bool { + f.mu.Lock() + _, allowed := f.allowed[dgst] + f.mu.Unlock() + return allowed +} + +type filteredStore struct { + content.Store + *storeFilter +} + +func newFilteredStore(store content.Store, filter *storeFilter) content.Store { + return &filteredStore{ + Store: store, + storeFilter: filter, + } +} + +func (cs *filteredStore) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error) { + return nil, errors.Errorf("read-only content store") +} + +func (cs *filteredStore) Delete(ctx context.Context, dgst digest.Digest) error { + return errors.Errorf("read-only content store") +} + +func (cs *filteredStore) Update(ctx context.Context, info content.Info, fieldpaths ...string) (content.Info, error) { + return content.Info{}, errors.Errorf("read-only content store") +} + +func (cs *filteredStore) Abort(ctx context.Context, ref string) error { + return errors.Errorf("read-only content store") +} + +func (cs *filteredStore) ReaderAt(ctx context.Context, desc ocispecs.Descriptor) (content.ReaderAt, error) { + if !cs.isAllowed(desc) { + return nil, cerrdefs.ErrNotFound + } + return cs.Store.ReaderAt(ctx, desc) +} + +func (cs *filteredStore) Info(ctx context.Context, dgst digest.Digest) (content.Info, error) { + if !cs.isDigestAllowed(dgst) { + return content.Info{}, cerrdefs.ErrNotFound + } + return cs.Store.Info(ctx, dgst) +} diff --git a/frontend/gateway/forwarder/forward.go b/frontend/gateway/forwarder/forward.go index 4180896a1f86..f2570568ccc0 100644 --- a/frontend/gateway/forwarder/forward.go +++ b/frontend/gateway/forwarder/forward.go @@ -4,6 +4,8 @@ import ( "context" "sync" + "github.com/moby/buildkit/cache" + "github.com/moby/buildkit/cache/config" cacheutil "github.com/moby/buildkit/cache/util" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/client/llb/sourceresolver" @@ -23,6 +25,7 @@ import ( "github.com/moby/buildkit/util/apicaps" "github.com/moby/buildkit/worker" digest "github.com/opencontainers/go-digest" + ocispecs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" fstypes "github.com/tonistiigi/fsutil/types" "golang.org/x/sync/errgroup" @@ -63,13 +66,6 @@ func (c *BridgeClient) Solve(ctx context.Context, req client.SolveRequest) (*cli if err != nil { return nil, c.wrapSolveError(err) } - for _, atts := range res.Attestations { - for _, att := range atts { - if att.ContentFunc != nil { - return nil, errors.Errorf("attestation callback cannot be sent through gateway") - } - } - } c.mu.Lock() cRes, err := result.ConvertResult(res, func(r solver.ResultProxy) (client.Reference, error) { @@ -187,13 +183,6 @@ func (c *BridgeClient) toFrontendResult(r *client.Result) (*frontend.Result, err if r == nil { return nil, nil } - for _, atts := range r.Attestations { - for _, att := range atts { - if att.ContentFunc != nil { - return nil, errors.Errorf("attestation callback cannot be sent through gateway") - } - } - } res, err := result.ConvertResult(r, func(r client.Reference) (solver.ResultProxy, error) { rr, ok := r.(*ref) @@ -381,6 +370,34 @@ func (r *ref) StatFile(ctx context.Context, req client.StatRequest) (*fstypes.St return cacheutil.StatFile(ctx, m, req.Path) } +func (r *ref) GetRemote(ctx context.Context, cfg config.RefConfig) ([]ocispecs.Descriptor, error) { + if cfg.PreferNonDistributable { + return nil, errors.New("prefer-nondistributable is not supported over gateway") + } + + rr, err := r.resultProxy.Result(ctx) + if err != nil { + return nil, r.c.wrapSolveError(err) + } + ref, ok := rr.Sys().(*worker.WorkerRef) + if !ok { + return nil, errors.Errorf("invalid ref: %T", rr.Sys()) + } + + remotes, err := ref.ImmutableRef.GetRemotes(ctx, true, cfg, false, session.NewGroup(r.c.sid)) + if err != nil { + return nil, err + } + remote := remotes[0] + if unlazier, ok := remote.Provider.(cache.Unlazier); ok { + if err := unlazier.Unlazy(ctx); err != nil { + return nil, err + } + } + + return remote.Descriptors, nil +} + func (r *ref) getMountable(ctx context.Context) (snapshot.Mountable, error) { rr, err := r.resultProxy.Result(ctx) if err != nil { diff --git a/frontend/gateway/gateway.go b/frontend/gateway/gateway.go index fd8bba5c582e..1d322d4fa111 100644 --- a/frontend/gateway/gateway.go +++ b/frontend/gateway/gateway.go @@ -16,12 +16,14 @@ import ( "syscall" "time" + "github.com/containerd/containerd/v2/core/content" "github.com/containerd/containerd/v2/core/mount" "github.com/containerd/containerd/v2/defaults" "github.com/distribution/reference" "github.com/golang/protobuf/ptypes/timestamp" apitypes "github.com/moby/buildkit/api/types" "github.com/moby/buildkit/cache" + "github.com/moby/buildkit/cache/config" cacheutil "github.com/moby/buildkit/cache/util" "github.com/moby/buildkit/client" "github.com/moby/buildkit/client/llb" @@ -116,11 +118,6 @@ func (gf *gatewayFrontend) Solve(ctx context.Context, llbBridge frontend.Fronten return nil, errors.Errorf("no source specified for gateway") } - var img dockerspec.DockerOCIImage - var mfstDigest digest.Digest - var rootFS cache.MutableRef - var readonly bool // TODO: try to switch to read-only by default. - var frontendDef *opspb.Definition err := gf.checkSourceIsAllowed(source) @@ -132,60 +129,10 @@ func (gf *gatewayFrontend) Solve(ctx context.Context, llbBridge frontend.Fronten if err != nil { return nil, err } - dc, err := dockerui.NewClient(c) + st, img, mfstDigest, err := LoadImage(ctx, c, source) if err != nil { return nil, err } - nc, err := dc.NamedContext(source, dockerui.ContextOpt{ - CaptureDigest: &mfstDigest, - }) - if err != nil { - return nil, err - } - var st *llb.State - if nc != nil { - var dockerImage *dockerspec.DockerOCIImage - st, dockerImage, err = nc.Load(ctx) - if err != nil { - return nil, err - } - if dockerImage != nil { - img = *dockerImage - } - } - if st == nil { - sourceRef, err := reference.ParseNormalizedNamed(source) - if err != nil { - return nil, err - } - - imr := sourceresolver.NewImageMetaResolver(llbBridge) - ref, dgst, config, err := imr.ResolveImageConfig(ctx, reference.TagNameOnly(sourceRef).String(), sourceresolver.Opt{}) - if err != nil { - return nil, err - } - - sourceRef, err = reference.ParseNormalizedNamed(ref) - if err != nil { - return nil, err - } - - mfstDigest = dgst - - if err := json.Unmarshal(config, &img); err != nil { - return nil, err - } - - if dgst != "" { - sourceRef, err = reference.WithDigest(sourceRef, dgst) - if err != nil { - return nil, err - } - } - - src := llb.Image(sourceRef.String(), &markTypeFrontend{}) - st = &src - } def, err := st.Marshal(ctx) if err != nil { @@ -216,47 +163,87 @@ func (gf *gatewayFrontend) Solve(ctx context.Context, llbBridge frontend.Fronten if !ok { return nil, errors.Errorf("invalid ref: %T", r.Sys()) } - rootFS, err = workerRef.Worker.CacheManager().New(ctx, workerRef.ImmutableRef, session.NewGroup(sid)) + rootFS, err := workerRef.Worker.CacheManager().New(ctx, workerRef.ImmutableRef, session.NewGroup(sid)) if err != nil { return nil, err } defer rootFS.Release(context.TODO()) - args := []string{"/run"} - env := []string{} - cwd := "/" - if img.Config.Env != nil { - env = img.Config.Env + meta, err := GetEnv(*img, opts, gf.workers, sid) + if err != nil { + return nil, err } - if img.Config.Entrypoint != nil { - args = img.Config.Entrypoint + + err = CheckCaps(*img, opts, inputs, mfstDigest) + if err != nil { + return nil, err } - if img.Config.WorkingDir != "" { - cwd = img.Config.WorkingDir + + lbf := NewBridgeForwarder(ctx, llbBridge, exec, gf.workers, inputs, sid, sm) + ctx = lbf.Serve(ctx) + defer lbf.Close() + defer lbf.Discard() + + mdmnt, release, err := metadataMount(frontendDef) + if err != nil { + return nil, err + } + if release != nil { + defer release() } + var mnts []executor.Mount + if mdmnt != nil { + mnts = append(mnts, *mdmnt) + } + + connIn, connOut := lbf.Conn() + _, err = exec.Run(ctx, "", container.MountWithSession(rootFS, session.NewGroup(sid)), mnts, executor.ProcessInfo{Meta: *meta, Stdin: connIn, Stdout: connOut, Stderr: os.Stderr}, nil) + if err != nil { + lbf.SetResult(nil, err) + } + return lbf.Result(ctx) +} + +func GetEnv(img dockerspec.DockerOCIImage, opts map[string]string, workers worker.Infos, sid string) (meta *executor.Meta, _ error) { + meta = &executor.Meta{ + RemoveMountStubsRecursive: true, + // TODO: try to switch to read-only by default + // ReadonlyRootFS: false, + } + + if img.Config.Entrypoint == nil { + meta.Args = []string{"/run"} + } else { + meta.Args = img.Config.Entrypoint + } + + if img.Config.Env == nil { + meta.Env = []string{} + } else { + meta.Env = img.Config.Env + } + + if img.Config.WorkingDir == "" { + meta.Cwd = "/" + } else { + meta.Cwd = img.Config.WorkingDir + } + i := 0 for k, v := range opts { - env = append(env, fmt.Sprintf("BUILDKIT_FRONTEND_OPT_%d", i)+"="+k+"="+v) + meta.Env = append(meta.Env, fmt.Sprintf("BUILDKIT_FRONTEND_OPT_%d", i)+"="+k+"="+v) i++ } - env = append(env, "BUILDKIT_SESSION_ID="+sid) + meta.Env = append(meta.Env, "BUILDKIT_SESSION_ID="+sid) - dt, err := json.Marshal(gf.workers.WorkerInfos()) + dt, err := json.Marshal(workers) if err != nil { return nil, errors.Wrap(err, "failed to marshal workers array") } - env = append(env, "BUILDKIT_WORKERS="+string(dt)) + meta.Env = append(meta.Env, "BUILDKIT_WORKERS="+string(dt)) - env = append(env, "BUILDKIT_EXPORTEDPRODUCT="+apicaps.ExportedProduct) - - meta := executor.Meta{ - Env: env, - Args: args, - Cwd: cwd, - ReadonlyRootFS: readonly, - RemoveMountStubsRecursive: true, - } + meta.Env = append(meta.Env, "BUILDKIT_EXPORTEDPRODUCT="+apicaps.ExportedProduct) if v, ok := img.Config.Labels["moby.buildkit.frontend.network.none"]; ok { if ok, _ := strconv.ParseBool(v); ok { @@ -264,8 +251,13 @@ func (gf *gatewayFrontend) Solve(ctx context.Context, llbBridge frontend.Fronten } } + return meta, nil +} + +func CheckCaps(img dockerspec.DockerOCIImage, opts map[string]string, inputs map[string]*opspb.Definition, mfstDigest digest.Digest) error { curCaps := getCaps(img.Config.Labels["moby.buildkit.frontend.caps"]) addCapsForKnownFrontends(curCaps, mfstDigest) + reqCaps := getCaps(opts["frontend.caps"]) if len(inputs) > 0 { reqCaps["moby.buildkit.frontend.inputs"] = struct{}{} @@ -273,43 +265,73 @@ func (gf *gatewayFrontend) Solve(ctx context.Context, llbBridge frontend.Fronten for c := range reqCaps { if _, ok := curCaps[c]; !ok { - return nil, stack.Enable(grpcerrors.WrapCode(errdefs.NewUnsupportedFrontendCapError(c), codes.Unimplemented)) + return stack.Enable(grpcerrors.WrapCode(errdefs.NewUnsupportedFrontendCapError(c), codes.Unimplemented)) } } - lbf, ctx := serveLLBBridgeForwarder(ctx, llbBridge, exec, gf.workers, inputs, sid, sm) - defer lbf.conn.Close() - defer lbf.Discard() + return nil +} - mdmnt, release, err := metadataMount(frontendDef) +func LoadImage(ctx context.Context, c *forwarder.BridgeClient, source string) (st *llb.State, img *dockerspec.DockerOCIImage, mfstDigest digest.Digest, err error) { + dc, err := dockerui.NewClient(c) if err != nil { - return nil, err + return nil, nil, "", err } - if release != nil { - defer release() + nc, err := dc.NamedContext(source, dockerui.ContextOpt{ + CaptureDigest: &mfstDigest, + }) + if err != nil { + return nil, nil, "", err } - var mnts []executor.Mount - if mdmnt != nil { - mnts = append(mnts, *mdmnt) + if nc != nil { + var dockerImage *dockerspec.DockerOCIImage + st, dockerImage, err = nc.Load(ctx) + if err != nil { + return nil, nil, "", err + } + if dockerImage != nil { + img = dockerImage + } } + if st == nil { + sourceRef, err := reference.ParseNormalizedNamed(source) + if err != nil { + return nil, nil, "", err + } - _, err = exec.Run(ctx, "", container.MountWithSession(rootFS, session.NewGroup(sid)), mnts, executor.ProcessInfo{Meta: meta, Stdin: lbf.Stdin, Stdout: lbf.Stdout, Stderr: os.Stderr}, nil) - if err != nil { - if errdefs.IsCanceled(ctx, err) && lbf.isErrServerClosed { - err = errors.Errorf("frontend grpc server closed unexpectedly") + imr := sourceresolver.NewImageMetaResolver(c.FrontendLLBBridge) + ref, dgst, config, err := imr.ResolveImageConfig(ctx, reference.TagNameOnly(sourceRef).String(), sourceresolver.Opt{}) + if err != nil { + return nil, nil, "", err } - // An existing error (set via Return rpc) takes - // precedence over this error, which in turn takes - // precedence over a success reported via Return. - lbf.mu.Lock() - if lbf.err == nil { - lbf.result = nil - lbf.err = err + + sourceRef, err = reference.ParseNormalizedNamed(ref) + if err != nil { + return nil, nil, "", err } - lbf.mu.Unlock() + + mfstDigest = dgst + + if err := json.Unmarshal(config, &img); err != nil { + return nil, nil, "", err + } + + if dgst != "" { + sourceRef, err = reference.WithDigest(sourceRef, dgst) + if err != nil { + return nil, nil, "", err + } + } + + src := llb.Image(sourceRef.String(), &markTypeFrontend{}) + st = &src } - return lbf.Result() + return st, img, mfstDigest, nil +} + +func MetadataMount(def *opspb.Definition) (*executor.Mount, func(), error) { + return metadataMount(def) } func metadataMount(def *opspb.Definition) (*executor.Mount, func(), error) { @@ -398,17 +420,18 @@ func (lbf *llbBridgeForwarder) setResult(r *frontend.Result, err error) (*pb.Ret return nil, errors.New("gateway return must be either result or err") } - if lbf.result != nil || lbf.err != nil { + if lbf.done { return nil, errors.New("gateway result is already set") } lbf.result = r lbf.err = err close(lbf.doneCh) + lbf.done = true return &pb.ReturnResponse{}, nil } -func (lbf *llbBridgeForwarder) Result() (*frontend.Result, error) { +func (lbf *llbBridgeForwarder) Result(ctx context.Context) (*frontend.Result, error) { lbf.mu.Lock() defer lbf.mu.Unlock() @@ -417,6 +440,9 @@ func (lbf *llbBridgeForwarder) Result() (*frontend.Result, error) { } if lbf.err != nil { + if errdefs.IsCanceled(ctx, lbf.err) && lbf.isErrServerClosed { + return nil, errors.Errorf("frontend grpc server closed unexpectedly") + } return nil, lbf.err } @@ -424,10 +450,6 @@ func (lbf *llbBridgeForwarder) Result() (*frontend.Result, error) { } func NewBridgeForwarder(ctx context.Context, llbBridge frontend.FrontendLLBBridge, exec executor.Executor, workers worker.Infos, inputs map[string]*opspb.Definition, sid string, sm *session.Manager) LLBBridgeForwarder { - return newBridgeForwarder(ctx, llbBridge, exec, workers, inputs, sid, sm) -} - -func newBridgeForwarder(ctx context.Context, llbBridge frontend.FrontendLLBBridge, exec executor.Executor, workers worker.Infos, inputs map[string]*opspb.Definition, sid string, sm *session.Manager) *llbBridgeForwarder { lbf := &llbBridgeForwarder{ callCtx: ctx, llbBridge: llbBridge, @@ -441,36 +463,11 @@ func newBridgeForwarder(ctx context.Context, llbBridge frontend.FrontendLLBBridg sm: sm, ctrs: map[string]gwclient.Container{}, executor: exec, + storeFilter: &storeFilter{}, } return lbf } -func serveLLBBridgeForwarder(ctx context.Context, llbBridge frontend.FrontendLLBBridge, exec executor.Executor, workers worker.Infos, inputs map[string]*opspb.Definition, sid string, sm *session.Manager) (*llbBridgeForwarder, context.Context) { - ctx, cancel := context.WithCancelCause(ctx) - lbf := newBridgeForwarder(ctx, llbBridge, exec, workers, inputs, sid, sm) - serverOpt := []grpc.ServerOption{ - grpc.UnaryInterceptor(grpcerrors.UnaryServerInterceptor), - grpc.StreamInterceptor(grpcerrors.StreamServerInterceptor), - grpc.MaxRecvMsgSize(defaults.DefaultMaxRecvMsgSize), - grpc.MaxSendMsgSize(defaults.DefaultMaxSendMsgSize), - } - server := grpc.NewServer(serverOpt...) - grpc_health_v1.RegisterHealthServer(server, health.NewServer()) - pb.RegisterLLBBridgeServer(server, lbf) - - go func() { - serve(ctx, server, lbf.conn) - select { - case <-ctx.Done(): - default: - lbf.isErrServerClosed = true - } - cancel(errors.WithStack(context.Canceled)) - }() - - return lbf, ctx -} - type pipe struct { Stdin io.ReadCloser Stdout io.WriteCloser @@ -529,9 +526,20 @@ func (d dummyAddr) String() string { type LLBBridgeForwarder interface { pb.LLBBridgeServer + + Serve(ctx context.Context, attachables ...session.Attachable) context.Context Done() <-chan struct{} - Result() (*frontend.Result, error) + Close() error Discard() + + Result(ctx context.Context) (*frontend.Result, error) + SetResult(r *frontend.Result, err error) + + Store(store content.Store) content.Store + + // Conn returns the stdin and stdout pipes that can be used to communicate + // using the gateway API + Conn() (io.ReadCloser, io.WriteCloser) } type llbBridgeForwarder struct { @@ -543,6 +551,7 @@ type llbBridgeForwarder struct { // lastRef solver.CachedResult // lastRefs map[string]solver.CachedResult // err error + done bool doneCh chan struct{} // closed when result or err become valid through a call to a Return result *frontend.Result err error @@ -553,8 +562,45 @@ type llbBridgeForwarder struct { sm *session.Manager executor executor.Executor *pipe - ctrs map[string]gwclient.Container - ctrsMu sync.Mutex + ctrs map[string]gwclient.Container + ctrsMu sync.Mutex + storeFilter *storeFilter +} + +func (lbf *llbBridgeForwarder) Serve(ctx context.Context, attachables ...session.Attachable) context.Context { + ctx, cancel := context.WithCancelCause(ctx) + serverOpt := []grpc.ServerOption{ + grpc.UnaryInterceptor(grpcerrors.UnaryServerInterceptor), + grpc.StreamInterceptor(grpcerrors.StreamServerInterceptor), + grpc.MaxRecvMsgSize(defaults.DefaultMaxRecvMsgSize), + grpc.MaxSendMsgSize(defaults.DefaultMaxSendMsgSize), + } + server := grpc.NewServer(serverOpt...) + grpc_health_v1.RegisterHealthServer(server, health.NewServer()) + pb.RegisterLLBBridgeServer(server, lbf) + for _, a := range attachables { + a.Register(server) + } + + go func() { + serve(ctx, server, lbf.conn) + select { + case <-ctx.Done(): + default: + lbf.isErrServerClosed = true + } + cancel(errors.WithStack(context.Canceled)) + }() + + return ctx +} + +func (lbf *llbBridgeForwarder) Conn() (io.ReadCloser, io.WriteCloser) { + return lbf.Stdin, lbf.Stdout +} + +func (lbf *llbBridgeForwarder) Close() error { + return lbf.conn.Close() } func (lbf *llbBridgeForwarder) ResolveSourceMeta(ctx context.Context, req *pb.ResolveSourceMetaRequest) (*pb.ResolveSourceMetaResponse, error) { @@ -734,82 +780,11 @@ func (lbf *llbBridgeForwarder) Solve(ctx context.Context, req *pb.SolveRequest) return nil, errors.Errorf("solve did not return default result") } - pbRes := &pb.Result{ - Metadata: res.Metadata, - } - var defaultID string - - lbf.mu.Lock() - - if res.Refs != nil { - ids := make(map[string]string, len(res.Refs)) - defs := make(map[string]*opspb.Definition, len(res.Refs)) - for k, ref := range res.Refs { - var id string - var def *opspb.Definition - if ref != nil { - id = identity.NewID() - def = ref.Definition() - lbf.refs[id] = ref - } - ids[k] = id - defs[k] = def - } - - if req.AllowResultArrayRef { - refMap := make(map[string]*pb.Ref, len(res.Refs)) - for k, id := range ids { - refMap[k] = &pb.Ref{Id: id, Def: defs[k]} - } - pbRes.Result = &pb.Result_Refs{Refs: &pb.RefMap{Refs: refMap}} - } else { - pbRes.Result = &pb.Result_RefsDeprecated{RefsDeprecated: &pb.RefMapDeprecated{Refs: ids}} - } - } else { - ref := res.Ref - var id string - var def *opspb.Definition - if ref != nil { - id = identity.NewID() - def = ref.Definition() - lbf.refs[id] = ref - } - defaultID = id - - if req.AllowResultArrayRef { - pbRes.Result = &pb.Result_Ref{Ref: &pb.Ref{Id: id, Def: def}} - } else { - pbRes.Result = &pb.Result_RefDeprecated{RefDeprecated: id} - } - } - - if res.Attestations != nil { - pbRes.Attestations = map[string]*pb.Attestations{} - for k, atts := range res.Attestations { - for _, att := range atts { - pbAtt, err := gwclient.AttestationToPB(&att) - if err != nil { - lbf.mu.Unlock() - return nil, err - } - - if att.Ref != nil { - id := identity.NewID() - def := att.Ref.Definition() - lbf.refs[id] = att.Ref - pbAtt.Ref = &pb.Ref{Id: id, Def: def} - } - - if pbRes.Attestations[k] == nil { - pbRes.Attestations[k] = &pb.Attestations{} - } - pbRes.Attestations[k].Attestation = append(pbRes.Attestations[k].Attestation, pbAtt) - } - } + pbRes, defaultID, err := lbf.stashResult(ctx, res, req) + if err != nil { + return nil, err } - lbf.mu.Unlock() - // compatibility mode for older clients if req.Final { exp := map[string][]byte{} @@ -988,11 +963,19 @@ func (lbf *llbBridgeForwarder) Return(ctx context.Context, in *pb.ReturnRequest) Details: in.Error.Details, }))) } - r := &frontend.Result{ - Metadata: in.Result.Metadata, + + r, err := lbf.loadResult(in.Result) + if err != nil { + return nil, err } + return lbf.setResult(r, nil) +} - switch res := in.Result.Result.(type) { +func (lbf *llbBridgeForwarder) loadResult(pbRes *pb.Result) (*frontend.Result, error) { + r := &frontend.Result{ + Metadata: pbRes.Metadata, + } + switch res := pbRes.Result.(type) { case *pb.Result_RefDeprecated: ref, err := lbf.cloneRef(res.RefDeprecated) if err != nil { @@ -1023,8 +1006,8 @@ func (lbf *llbBridgeForwarder) Return(ctx context.Context, in *pb.ReturnRequest) } } - if in.Result.Attestations != nil { - for k, pbAtts := range in.Result.Attestations { + if pbRes.Attestations != nil { + for k, pbAtts := range pbRes.Attestations { for _, pbAtt := range pbAtts.Attestation { att, err := gwclient.AttestationFromPB[solver.ResultProxy](pbAtt) if err != nil { @@ -1042,7 +1025,152 @@ func (lbf *llbBridgeForwarder) Return(ctx context.Context, in *pb.ReturnRequest) } } - return lbf.setResult(r, nil) + return r, nil +} + +func (lbf *llbBridgeForwarder) stashResult(ctx context.Context, res *frontend.Result, req *pb.SolveRequest) (*pb.Result, string, error) { + var defaultID string + pbRes := &pb.Result{ + Metadata: res.Metadata, + } + + lbf.mu.Lock() + defer lbf.mu.Unlock() + + if res.Refs != nil { + ids := make(map[string]string, len(res.Refs)) + defs := make(map[string]*opspb.Definition, len(res.Refs)) + for k, ref := range res.Refs { + var id string + var def *opspb.Definition + if ref != nil { + id = identity.NewID() + def = ref.Definition() + lbf.refs[id] = ref + } + ids[k] = id + defs[k] = def + } + + if req != nil && req.AllowResultArrayRef { + refMap := make(map[string]*pb.Ref, len(res.Refs)) + for k, id := range ids { + refMap[k] = &pb.Ref{Id: id, Def: defs[k]} + } + pbRes.Result = &pb.Result_Refs{Refs: &pb.RefMap{Refs: refMap}} + } else { + pbRes.Result = &pb.Result_RefsDeprecated{RefsDeprecated: &pb.RefMapDeprecated{Refs: ids}} + } + } else { + ref := res.Ref + var id string + var def *opspb.Definition + if ref != nil { + id = identity.NewID() + def = ref.Definition() + lbf.refs[id] = ref + } + defaultID = id + + if req != nil && req.AllowResultArrayRef { + pbRes.Result = &pb.Result_Ref{Ref: &pb.Ref{Id: id, Def: def}} + } else { + pbRes.Result = &pb.Result_RefDeprecated{RefDeprecated: id} + } + } + + if res.Attestations != nil { + pbRes.Attestations = map[string]*pb.Attestations{} + for k, atts := range res.Attestations { + for _, att := range atts { + pbAtt, err := gwclient.AttestationToPB(ctx, &att) + if err != nil { + return nil, "", err + } + + if att.Ref != nil { + id := identity.NewID() + def := att.Ref.Definition() + lbf.refs[id] = att.Ref + pbAtt.Ref = &pb.Ref{Id: id, Def: def} + } + + if pbRes.Attestations[k] == nil { + pbRes.Attestations[k] = &pb.Attestations{} + } + pbRes.Attestations[k].Attestation = append(pbRes.Attestations[k].Attestation, pbAtt) + } + } + } + + return pbRes, defaultID, nil +} + +func (lbf *llbBridgeForwarder) SetResult(result *frontend.Result, err error) { + lbf.mu.Lock() + if result != nil { + lbf.result = result + } + if err != nil && lbf.err == nil { + // An existing error (set via Return rpc) takes + // precedence over this error + lbf.err = err + lbf.result = nil + } + lbf.mu.Unlock() +} + +func (lbf *llbBridgeForwarder) GetReturn(ctx context.Context, in *pb.GetReturnRequest) (*pb.GetReturnResponse, error) { + res, err := lbf.Result(ctx) + if err != nil { + return nil, err + } + if res == nil { + return nil, errors.New("no result to export") + } + + pbRes, _, err := lbf.stashResult(ctx, res, nil) + if err != nil { + return nil, err + } + resp := &pb.GetReturnResponse{ + Result: pbRes, + } + return resp, nil +} + +func (lbf *llbBridgeForwarder) Store(store content.Store) content.Store { + return newFilteredStore(store, lbf.storeFilter) +} + +func (lbf *llbBridgeForwarder) GetRemote(ctx context.Context, in *pb.GetRemoteRequest) (*pb.GetRemoteResponse, error) { + r, err := lbf.getImmutableRef(ctx, in.Ref) + if err != nil { + return nil, err + } + + rc := config.RefConfig{ + Compression: pb.CompressionFromPB(in.Compression), + } + remotes, err := r.GetRemotes(ctx, true, rc, false, session.NewGroup(lbf.sid)) + if err != nil { + return nil, err + } + remote := remotes[0] + if unlazier, ok := remote.Provider.(cache.Unlazier); ok { + if err := unlazier.Unlazy(ctx); err != nil { + return nil, err + } + } + + resp := &pb.GetRemoteResponse{ + Descriptors: make([]*pb.Descriptor, 0, len(remote.Descriptors)), + } + for _, desc := range remote.Descriptors { + resp.Descriptors = append(resp.Descriptors, pb.DescriptorToPB(desc)) + } + lbf.storeFilter.allow(remote.Descriptors...) + return resp, nil } func (lbf *llbBridgeForwarder) Inputs(ctx context.Context, in *pb.InputsRequest) (*pb.InputsResponse, error) { @@ -1669,13 +1797,8 @@ func toPBAttestationChain(ac *sourceresolver.AttestationChain) *pb.AttestationCh } for k, v := range ac.Blobs { out.Blobs[k.String()] = &pb.Blob{ - Descriptor_: &pb.Descriptor{ - MediaType: v.Descriptor.MediaType, - Size: v.Descriptor.Size, - Digest: string(v.Descriptor.Digest), - Annotations: maps.Clone(v.Descriptor.Annotations), - }, - Data: v.Data, + Descriptor_: pb.DescriptorToPB(v.Descriptor), + Data: v.Data, } } return out diff --git a/frontend/gateway/grpcclient/client.go b/frontend/gateway/grpcclient/client.go index 42e449a47bab..dc58c7025e96 100644 --- a/frontend/gateway/grpcclient/client.go +++ b/frontend/gateway/grpcclient/client.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "io" - "maps" "net" "os" "strings" @@ -14,8 +13,10 @@ import ( "time" distreference "github.com/distribution/reference" + "github.com/moby/buildkit/cache/config" "github.com/moby/buildkit/client/llb" "github.com/moby/buildkit/client/llb/sourceresolver" + "github.com/moby/buildkit/exporter/containerimage/exptypes" "github.com/moby/buildkit/frontend/gateway/client" pb "github.com/moby/buildkit/frontend/gateway/pb" "github.com/moby/buildkit/identity" @@ -41,7 +42,9 @@ const frontendPrefix = "BUILDKIT_FRONTEND_OPT_" type GrpcClient interface { client.Client - Run(context.Context, client.BuildFunc) error + + Build(context.Context, client.BuildFunc) error + Export(context.Context, *grpc.ClientConn, client.ExportFunc) error } func New(ctx context.Context, opts map[string]string, session, product string, c pb.LLBBridgeClient, w []client.WorkerInfo) (GrpcClient, error) { @@ -74,17 +77,22 @@ func New(ctx context.Context, opts map[string]string, session, product string, c }, nil } -func current() (GrpcClient, error) { +func current() (GrpcClient, *grpc.ClientConn, error) { if ep := product(); ep != "" { apicaps.ExportedProduct = ep } ctx, conn, err := grpcClientConn(context.Background()) if err != nil { - return nil, err + return nil, nil, err + } + + gc, err := New(ctx, opts(), sessionID(), product(), pb.NewLLBBridgeClient(conn), workers()) + if err != nil { + return nil, nil, err } - return New(ctx, opts(), sessionID(), product(), pb.NewLLBBridgeClient(conn), workers()) + return gc, conn, nil } func convertRef(ref client.Reference) (*pb.Ref, error) { @@ -98,15 +106,20 @@ func convertRef(ref client.Reference) (*pb.Ref, error) { return &pb.Ref{Id: r.id, Def: r.def}, nil } +// Deprecated: use BuildFromEnvironment func RunFromEnvironment(ctx context.Context, f client.BuildFunc) error { - client, err := current() + return BuildFromEnvironment(ctx, f) +} + +func BuildFromEnvironment(ctx context.Context, f client.BuildFunc) error { + client, _, err := current() if err != nil { return errors.Wrapf(err, "failed to initialize client from environment") } - return client.Run(ctx, f) + return client.Build(ctx, f) } -func (c *grpcClient) Run(ctx context.Context, f client.BuildFunc) (retError error) { +func (c *grpcClient) Build(ctx context.Context, f client.BuildFunc) (retError error) { export := c.caps.Supports(pb.CapReturnResult) == nil var ( @@ -168,7 +181,7 @@ func (c *grpcClient) Run(ctx context.Context, f client.BuildFunc) (retError erro attestations := map[string]*pb.Attestations{} for k, as := range res.Attestations { for _, a := range as { - pbAtt, err := client.AttestationToPB(&a) + pbAtt, err := client.AttestationToPB(ctx, &a) if err != nil { retError = err continue @@ -248,6 +261,60 @@ func (c *grpcClient) Run(ctx context.Context, f client.BuildFunc) (retError erro return nil } +func ExportFromEnvironment(ctx context.Context, f client.ExportFunc) error { + client, conn, err := current() + if err != nil { + return errors.Wrapf(err, "failed to initialize client from environment") + } + return client.Export(ctx, conn, f) +} + +func (c *grpcClient) Export(ctx context.Context, conn *grpc.ClientConn, f client.ExportFunc) (retError error) { + export := c.caps.Supports(pb.CapGatewayGetReturn) == nil + if !export { + return errors.New("gateway does not support export") + } + + resp, err := c.client.GetReturn(ctx, &pb.GetReturnRequest{}) + if err != nil { + return err + } + result, err := c.loadResult(resp.Result) + if err != nil { + return err + } + if result == nil { + return errors.Errorf("no result returned from gateway") + } + + defer func() { + if retError != nil { + st, _ := status.FromError(grpcerrors.ToGRPC(ctx, retError)) + stp := st.Proto() + req := &pb.ReturnRequest{} + req.Error = &spb.Status{ + Code: stp.Code, + Message: stp.Message, + Details: stp.Details, + } + _, _ = c.client.Return(ctx, req) + } + }() + + defer func() { + err = c.execMsgs.Release() + if err != nil && retError != nil { + retError = err + } + }() + + handle := client.ExportHandle{ + Conn: conn, + Target: exportTarget(), + } + return f(ctx, c, handle, result) +} + // 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 { @@ -416,53 +483,63 @@ func (c *grpcClient) Solve(ctx context.Context, creq client.SolveRequest) (res * return nil, err } - res = client.NewResult() if resp.Result == nil { + res = client.NewResult() if id := resp.Ref; id != "" { c.requests[id] = req } res.SetRef(&reference{id: resp.Ref, c: c}) } else { - res.Metadata = resp.Result.Metadata - switch pbRes := resp.Result.Result.(type) { - case *pb.Result_RefDeprecated: - if id := pbRes.RefDeprecated; id != "" { - res.SetRef(&reference{id: id, c: c}) - } - case *pb.Result_RefsDeprecated: - for k, v := range pbRes.RefsDeprecated.Refs { - var ref client.Reference - if v != "" { - ref = &reference{id: v, c: c} - } - res.AddRef(k, ref) - } - case *pb.Result_Ref: - if pbRes.Ref.Id != "" { - res.SetRef(newReference(c, pbRes.Ref)) + res, err = c.loadResult(resp.Result) + if err != nil { + return nil, err + } + } + + return res, nil +} + +func (c *grpcClient) loadResult(pbRes *pb.Result) (*client.Result, error) { + res := client.NewResult() + res.Metadata = pbRes.Metadata + switch pbRes := pbRes.Result.(type) { + case *pb.Result_RefDeprecated: + if id := pbRes.RefDeprecated; id != "" { + res.SetRef(&reference{id: id, c: c}) + } + case *pb.Result_RefsDeprecated: + for k, v := range pbRes.RefsDeprecated.Refs { + var ref client.Reference + if v != "" { + ref = &reference{id: v, c: c} } - case *pb.Result_Refs: - for k, v := range pbRes.Refs.Refs { - var ref client.Reference - if v.Id != "" { - ref = newReference(c, v) - } - res.AddRef(k, ref) + res.AddRef(k, ref) + } + case *pb.Result_Ref: + if pbRes.Ref.Id != "" { + res.SetRef(newReference(c, pbRes.Ref)) + } + case *pb.Result_Refs: + for k, v := range pbRes.Refs.Refs { + var ref client.Reference + if v.Id != "" { + ref = newReference(c, v) } + res.AddRef(k, ref) } + } - if resp.Result.Attestations != nil { - for p, as := range resp.Result.Attestations { - for _, a := range as.Attestation { - att, err := client.AttestationFromPB[client.Reference](a) - if err != nil { - return nil, err - } - if a.Ref.Id != "" { - att.Ref = newReference(c, a.Ref) - } - res.AddAttestation(p, *att) + if pbRes.Attestations != nil { + for p, as := range pbRes.Attestations { + for _, a := range as.Attestation { + att, err := client.AttestationFromPB[client.Reference](a) + if err != nil { + return nil, err + } + if a.Ref != nil && a.Ref.Id != "" { + att.Ref = newReference(c, a.Ref) } + res.AddAttestation(p, *att) } } } @@ -591,7 +668,7 @@ func imgResponseFromPB(resp *pb.ResolveSourceImageResponse) *sourceresolver.Reso } for k, v := range resp.AttestationChain.Blobs { ac.Blobs[digest.Digest(k)] = sourceresolver.Blob{ - Descriptor: descriptorFromPB(v.GetDescriptor_()), + Descriptor: pb.DescriptorFromPB(v.GetDescriptor_()), Data: v.Data, } } @@ -600,18 +677,6 @@ func imgResponseFromPB(resp *pb.ResolveSourceImageResponse) *sourceresolver.Reso return r } -func descriptorFromPB(pbDesc *pb.Descriptor) ocispecs.Descriptor { - if pbDesc == nil { - return ocispecs.Descriptor{} - } - return ocispecs.Descriptor{ - MediaType: pbDesc.GetMediaType(), - Size: pbDesc.GetSize(), - Digest: digest.Digest(pbDesc.GetDigest()), - Annotations: maps.Clone(pbDesc.GetAnnotations()), - } -} - func (c *grpcClient) resolveImageConfigViaSourceMetadata(ctx context.Context, ref string, opt sourceresolver.Opt, p *opspb.Platform) (string, digest.Digest, []byte, error) { op := &opspb.SourceOp{ Identifier: "docker-image://" + ref, @@ -753,6 +818,18 @@ func (c *grpcClient) Inputs(ctx context.Context) (map[string]llb.State, error) { return inputs, nil } +func (c *grpcClient) GetReturn(ctx context.Context) (*client.Result, error) { + result, err := c.client.GetReturn(ctx, &pb.GetReturnRequest{}) + if err != nil { + return nil, err + } + res, err := c.loadResult(result.Result) + if err != nil { + return nil, err + } + return res, nil +} + // procMessageForwarder is created per container process to act as the // communication channel between the process and the ExecProcess message // stream. @@ -1322,6 +1399,24 @@ func (r *reference) StatFile(ctx context.Context, req client.StatRequest) (*fsty return resp.Stat, nil } +func (r *reference) GetRemote(ctx context.Context, cfg config.RefConfig) ([]ocispecs.Descriptor, error) { + if cfg.PreferNonDistributable { + return nil, errors.New("prefer-nondistributable is not supported over gateway") + } + resp, err := r.c.client.GetRemote(ctx, &pb.GetRemoteRequest{ + Ref: r.id, + Compression: pb.CompressionToPB(cfg.Compression), + }) + if err != nil { + return nil, err + } + descs := make([]ocispecs.Descriptor, len(resp.Descriptors)) + for i, d := range resp.Descriptors { + descs[i] = pb.DescriptorFromPB(d) + } + return descs, nil +} + func grpcClientConn(ctx context.Context) (context.Context, *grpc.ClientConn, error) { dialOpts := []grpc.DialOption{ grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) { @@ -1424,3 +1519,8 @@ func workers() []client.WorkerInfo { func product() string { return os.Getenv("BUILDKIT_EXPORTEDPRODUCT") } + +func exportTarget() exptypes.ExporterTarget { + v := os.Getenv("BUILDKIT_EXPORTER_TARGET") + return exptypes.ExporterTarget(v) +} diff --git a/frontend/gateway/pb/caps.go b/frontend/gateway/pb/caps.go index 7e43259e2cdb..ab1c105160d4 100644 --- a/frontend/gateway/pb/caps.go +++ b/frontend/gateway/pb/caps.go @@ -72,6 +72,12 @@ const ( // CapSourceMetaResolver is the capability to indicates support for ResolveSourceMetadata // function in gateway API CapSourceMetaResolver apicaps.CapID = "source.metaresolver" + + // CapGatewayGetReturn is the capability allowing fetching a previously returned result. + CapGatewayGetReturn apicaps.CapID = "gateway.getreturn" + + // CapGatewayGetRemote is the capability that allows fetching ref blobs from the content store. + CapGatewayGetRemote apicaps.CapID = "gateway.remote" ) func init() { @@ -242,4 +248,18 @@ func init() { Enabled: true, Status: apicaps.CapStatusExperimental, }) + + Caps.Init(apicaps.Cap{ + ID: CapGatewayGetReturn, + Name: "gateway get return", + Enabled: true, + Status: apicaps.CapStatusExperimental, + }) + + Caps.Init(apicaps.Cap{ + ID: CapGatewayGetRemote, + Name: "gateway get remote", + Enabled: true, + Status: apicaps.CapStatusExperimental, + }) } diff --git a/frontend/gateway/pb/converters.go b/frontend/gateway/pb/converters.go new file mode 100644 index 000000000000..075638b33157 --- /dev/null +++ b/frontend/gateway/pb/converters.go @@ -0,0 +1,92 @@ +package moby_buildkit_v1_frontend //nolint:revive,staticcheck + +import ( + "maps" + + "github.com/moby/buildkit/util/compression" + digest "github.com/opencontainers/go-digest" + ocispecs "github.com/opencontainers/image-spec/specs-go/v1" +) + +func DescriptorFromPB(pb *Descriptor) ocispecs.Descriptor { + if pb == nil { + return ocispecs.Descriptor{} + } + return ocispecs.Descriptor{ + MediaType: pb.MediaType, + Size: pb.Size, + Digest: digest.Digest(pb.Digest), + Annotations: maps.Clone(pb.Annotations), + } +} + +func DescriptorToPB(desc ocispecs.Descriptor) *Descriptor { + return &Descriptor{ + MediaType: desc.MediaType, + Size: desc.Size, + Digest: desc.Digest.String(), + Annotations: maps.Clone(desc.Annotations), + } +} + +func CompressionFromPB(pb *Compression) compression.Config { + if pb == nil { + return compression.New(compression.Default) + } + + tp := compressTypeFromPB(pb.Type) + if tp == nil { + tp = compression.Default + } + cfg := compression.New(tp) + if pb.Force { + cfg = cfg.SetForce(true) + } + if pb.HasLevel { + cfg = cfg.SetLevel(int(pb.Level)) + } + return cfg +} + +func compressTypeFromPB(t Compression_Type) compression.Type { + switch t { + case Compression_UNCOMPRESSED: + return compression.Uncompressed + case Compression_GZIP: + return compression.Gzip + case Compression_ESTARGZ: + return compression.EStargz + case Compression_ZSTD: + return compression.Zstd + default: + return nil + } +} + +func CompressionToPB(cfg compression.Config) *Compression { + t := compressTypeToPB(cfg.Type) + pb := &Compression{ + Type: t, + Force: cfg.Force, + } + if cfg.Level != nil { + pb.HasLevel = true + pb.Level = int32(*cfg.Level) + } + return pb +} + +func compressTypeToPB(t compression.Type) Compression_Type { + switch t { + case compression.Uncompressed: + return Compression_UNCOMPRESSED + case compression.Gzip: + return Compression_GZIP + case compression.EStargz: + return Compression_ESTARGZ + case compression.Zstd: + return Compression_ZSTD + default: + return Compression_UNKNOWN + } +} diff --git a/frontend/gateway/pb/gateway.pb.go b/frontend/gateway/pb/gateway.pb.go index 4a958a42ada0..f75fa610514e 100644 --- a/frontend/gateway/pb/gateway.pb.go +++ b/frontend/gateway/pb/gateway.pb.go @@ -120,6 +120,61 @@ func (InTotoSubjectKind) EnumDescriptor() ([]byte, []int) { return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{1} } +type Compression_Type int32 + +const ( + Compression_UNKNOWN Compression_Type = 0 + Compression_UNCOMPRESSED Compression_Type = 1 + Compression_GZIP Compression_Type = 2 + Compression_ESTARGZ Compression_Type = 3 + Compression_ZSTD Compression_Type = 4 +) + +// Enum value maps for Compression_Type. +var ( + Compression_Type_name = map[int32]string{ + 0: "UNKNOWN", + 1: "UNCOMPRESSED", + 2: "GZIP", + 3: "ESTARGZ", + 4: "ZSTD", + } + Compression_Type_value = map[string]int32{ + "UNKNOWN": 0, + "UNCOMPRESSED": 1, + "GZIP": 2, + "ESTARGZ": 3, + "ZSTD": 4, + } +) + +func (x Compression_Type) Enum() *Compression_Type { + p := new(Compression_Type) + *p = x + return p +} + +func (x Compression_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Compression_Type) Descriptor() protoreflect.EnumDescriptor { + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_enumTypes[2].Descriptor() +} + +func (Compression_Type) Type() protoreflect.EnumType { + return &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_enumTypes[2] +} + +func (x Compression_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Compression_Type.Descriptor instead. +func (Compression_Type) EnumDescriptor() ([]byte, []int) { + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{55, 0} +} + type Result struct { state protoimpl.MessageState `protogen:"open.v1"` // Types that are valid to be assigned to Result: @@ -442,6 +497,7 @@ type Attestation struct { Metadata map[string][]byte `protobuf:"bytes,2,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` Ref *Ref `protobuf:"bytes,3,opt,name=ref,proto3" json:"ref,omitempty"` Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` + Content []byte `protobuf:"bytes,7,opt,name=content,proto3" json:"content,omitempty"` InTotoPredicateType string `protobuf:"bytes,5,opt,name=inTotoPredicateType,proto3" json:"inTotoPredicateType,omitempty"` InTotoSubjects []*InTotoSubject `protobuf:"bytes,6,rep,name=inTotoSubjects,proto3" json:"inTotoSubjects,omitempty"` unknownFields protoimpl.UnknownFields @@ -506,6 +562,13 @@ func (x *Attestation) GetPath() string { return "" } +func (x *Attestation) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + func (x *Attestation) GetInTotoPredicateType() string { if x != nil { return x.InTotoPredicateType @@ -668,6 +731,86 @@ func (*ReturnResponse) Descriptor() ([]byte, []int) { return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{8} } +type GetReturnRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetReturnRequest) Reset() { + *x = GetReturnRequest{} + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetReturnRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetReturnRequest) ProtoMessage() {} + +func (x *GetReturnRequest) ProtoReflect() protoreflect.Message { + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetReturnRequest.ProtoReflect.Descriptor instead. +func (*GetReturnRequest) Descriptor() ([]byte, []int) { + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{9} +} + +type GetReturnResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Result *Result `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetReturnResponse) Reset() { + *x = GetReturnResponse{} + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetReturnResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetReturnResponse) ProtoMessage() {} + +func (x *GetReturnResponse) ProtoReflect() protoreflect.Message { + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetReturnResponse.ProtoReflect.Descriptor instead. +func (*GetReturnResponse) Descriptor() ([]byte, []int) { + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{10} +} + +func (x *GetReturnResponse) GetResult() *Result { + if x != nil { + return x.Result + } + return nil +} + type InputsRequest struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -676,7 +819,7 @@ type InputsRequest struct { func (x *InputsRequest) Reset() { *x = InputsRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[9] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -688,7 +831,7 @@ func (x *InputsRequest) String() string { func (*InputsRequest) ProtoMessage() {} func (x *InputsRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[9] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -701,7 +844,7 @@ func (x *InputsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use InputsRequest.ProtoReflect.Descriptor instead. func (*InputsRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{9} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{11} } type InputsResponse struct { @@ -713,7 +856,7 @@ type InputsResponse struct { func (x *InputsResponse) Reset() { *x = InputsResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[10] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -725,7 +868,7 @@ func (x *InputsResponse) String() string { func (*InputsResponse) ProtoMessage() {} func (x *InputsResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[10] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -738,7 +881,7 @@ func (x *InputsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use InputsResponse.ProtoReflect.Descriptor instead. func (*InputsResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{10} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{12} } func (x *InputsResponse) GetDefinitions() map[string]*pb.Definition { @@ -764,7 +907,7 @@ type ResolveImageConfigRequest struct { func (x *ResolveImageConfigRequest) Reset() { *x = ResolveImageConfigRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[11] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -776,7 +919,7 @@ func (x *ResolveImageConfigRequest) String() string { func (*ResolveImageConfigRequest) ProtoMessage() {} func (x *ResolveImageConfigRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[11] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -789,7 +932,7 @@ func (x *ResolveImageConfigRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ResolveImageConfigRequest.ProtoReflect.Descriptor instead. func (*ResolveImageConfigRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{11} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{13} } func (x *ResolveImageConfigRequest) GetRef() string { @@ -859,7 +1002,7 @@ type ResolveImageConfigResponse struct { func (x *ResolveImageConfigResponse) Reset() { *x = ResolveImageConfigResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[12] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -871,7 +1014,7 @@ func (x *ResolveImageConfigResponse) String() string { func (*ResolveImageConfigResponse) ProtoMessage() {} func (x *ResolveImageConfigResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[12] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -884,7 +1027,7 @@ func (x *ResolveImageConfigResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ResolveImageConfigResponse.ProtoReflect.Descriptor instead. func (*ResolveImageConfigResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{12} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{14} } func (x *ResolveImageConfigResponse) GetDigest() string { @@ -923,7 +1066,7 @@ type ResolveSourceMetaRequest struct { func (x *ResolveSourceMetaRequest) Reset() { *x = ResolveSourceMetaRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[13] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -935,7 +1078,7 @@ func (x *ResolveSourceMetaRequest) String() string { func (*ResolveSourceMetaRequest) ProtoMessage() {} func (x *ResolveSourceMetaRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[13] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -948,7 +1091,7 @@ func (x *ResolveSourceMetaRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ResolveSourceMetaRequest.ProtoReflect.Descriptor instead. func (*ResolveSourceMetaRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{13} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{15} } func (x *ResolveSourceMetaRequest) GetSource() *pb.SourceOp { @@ -1012,7 +1155,7 @@ type ResolveSourceMetaResponse struct { func (x *ResolveSourceMetaResponse) Reset() { *x = ResolveSourceMetaResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[14] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1024,7 +1167,7 @@ func (x *ResolveSourceMetaResponse) String() string { func (*ResolveSourceMetaResponse) ProtoMessage() {} func (x *ResolveSourceMetaResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[14] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1037,7 +1180,7 @@ func (x *ResolveSourceMetaResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ResolveSourceMetaResponse.ProtoReflect.Descriptor instead. func (*ResolveSourceMetaResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{14} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{16} } func (x *ResolveSourceMetaResponse) GetSource() *pb.SourceOp { @@ -1078,7 +1221,7 @@ type ResolveSourceImageRequest struct { func (x *ResolveSourceImageRequest) Reset() { *x = ResolveSourceImageRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[15] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1090,7 +1233,7 @@ func (x *ResolveSourceImageRequest) String() string { func (*ResolveSourceImageRequest) ProtoMessage() {} func (x *ResolveSourceImageRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[15] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1103,7 +1246,7 @@ func (x *ResolveSourceImageRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ResolveSourceImageRequest.ProtoReflect.Descriptor instead. func (*ResolveSourceImageRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{15} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{17} } func (x *ResolveSourceImageRequest) GetNoConfig() bool { @@ -1133,7 +1276,7 @@ type AttestationChain struct { func (x *AttestationChain) Reset() { *x = AttestationChain{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[16] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1145,7 +1288,7 @@ func (x *AttestationChain) String() string { func (*AttestationChain) ProtoMessage() {} func (x *AttestationChain) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[16] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1158,7 +1301,7 @@ func (x *AttestationChain) ProtoReflect() protoreflect.Message { // Deprecated: Use AttestationChain.ProtoReflect.Descriptor instead. func (*AttestationChain) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{16} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{18} } func (x *AttestationChain) GetRoot() string { @@ -1207,7 +1350,7 @@ type ResolveSourceImageResponse struct { func (x *ResolveSourceImageResponse) Reset() { *x = ResolveSourceImageResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[17] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1219,7 +1362,7 @@ func (x *ResolveSourceImageResponse) String() string { func (*ResolveSourceImageResponse) ProtoMessage() {} func (x *ResolveSourceImageResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[17] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1232,7 +1375,7 @@ func (x *ResolveSourceImageResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ResolveSourceImageResponse.ProtoReflect.Descriptor instead. func (*ResolveSourceImageResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{17} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{19} } func (x *ResolveSourceImageResponse) GetDigest() string { @@ -1266,7 +1409,7 @@ type ResolveSourceGitRequest struct { func (x *ResolveSourceGitRequest) Reset() { *x = ResolveSourceGitRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[18] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1278,7 +1421,7 @@ func (x *ResolveSourceGitRequest) String() string { func (*ResolveSourceGitRequest) ProtoMessage() {} func (x *ResolveSourceGitRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[18] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1291,7 +1434,7 @@ func (x *ResolveSourceGitRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ResolveSourceGitRequest.ProtoReflect.Descriptor instead. func (*ResolveSourceGitRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{18} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{20} } func (x *ResolveSourceGitRequest) GetReturnObject() bool { @@ -1314,7 +1457,7 @@ type ResolveSourceGitResponse struct { func (x *ResolveSourceGitResponse) Reset() { *x = ResolveSourceGitResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[19] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1326,7 +1469,7 @@ func (x *ResolveSourceGitResponse) String() string { func (*ResolveSourceGitResponse) ProtoMessage() {} func (x *ResolveSourceGitResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[19] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1339,7 +1482,7 @@ func (x *ResolveSourceGitResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ResolveSourceGitResponse.ProtoReflect.Descriptor instead. func (*ResolveSourceGitResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{19} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{21} } func (x *ResolveSourceGitResponse) GetChecksum() string { @@ -1388,7 +1531,7 @@ type ResolveSourceHTTPResponse struct { func (x *ResolveSourceHTTPResponse) Reset() { *x = ResolveSourceHTTPResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[20] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1400,7 +1543,7 @@ func (x *ResolveSourceHTTPResponse) String() string { func (*ResolveSourceHTTPResponse) ProtoMessage() {} func (x *ResolveSourceHTTPResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[20] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1413,7 +1556,7 @@ func (x *ResolveSourceHTTPResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ResolveSourceHTTPResponse.ProtoReflect.Descriptor instead. func (*ResolveSourceHTTPResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{20} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{22} } func (x *ResolveSourceHTTPResponse) GetChecksum() string { @@ -1461,7 +1604,7 @@ type SolveRequest struct { func (x *SolveRequest) Reset() { *x = SolveRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[21] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1473,7 +1616,7 @@ func (x *SolveRequest) String() string { func (*SolveRequest) ProtoMessage() {} func (x *SolveRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[21] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1486,7 +1629,7 @@ func (x *SolveRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SolveRequest.ProtoReflect.Descriptor instead. func (*SolveRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{21} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{23} } func (x *SolveRequest) GetDefinition() *pb.Definition { @@ -1577,7 +1720,7 @@ type CacheOptionsEntry struct { func (x *CacheOptionsEntry) Reset() { *x = CacheOptionsEntry{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[22] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1589,7 +1732,7 @@ func (x *CacheOptionsEntry) String() string { func (*CacheOptionsEntry) ProtoMessage() {} func (x *CacheOptionsEntry) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[22] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1602,7 +1745,7 @@ func (x *CacheOptionsEntry) ProtoReflect() protoreflect.Message { // Deprecated: Use CacheOptionsEntry.ProtoReflect.Descriptor instead. func (*CacheOptionsEntry) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{22} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{24} } func (x *CacheOptionsEntry) GetType() string { @@ -1631,7 +1774,7 @@ type SolveResponse struct { func (x *SolveResponse) Reset() { *x = SolveResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[23] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1643,7 +1786,7 @@ func (x *SolveResponse) String() string { func (*SolveResponse) ProtoMessage() {} func (x *SolveResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[23] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1656,7 +1799,7 @@ func (x *SolveResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SolveResponse.ProtoReflect.Descriptor instead. func (*SolveResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{23} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{25} } func (x *SolveResponse) GetRef() string { @@ -1684,7 +1827,7 @@ type ReadFileRequest struct { func (x *ReadFileRequest) Reset() { *x = ReadFileRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[24] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1696,7 +1839,7 @@ func (x *ReadFileRequest) String() string { func (*ReadFileRequest) ProtoMessage() {} func (x *ReadFileRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[24] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1709,7 +1852,7 @@ func (x *ReadFileRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReadFileRequest.ProtoReflect.Descriptor instead. func (*ReadFileRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{24} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{26} } func (x *ReadFileRequest) GetRef() string { @@ -1743,7 +1886,7 @@ type FileRange struct { func (x *FileRange) Reset() { *x = FileRange{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[25] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1755,7 +1898,7 @@ func (x *FileRange) String() string { func (*FileRange) ProtoMessage() {} func (x *FileRange) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[25] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[27] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1768,7 +1911,7 @@ func (x *FileRange) ProtoReflect() protoreflect.Message { // Deprecated: Use FileRange.ProtoReflect.Descriptor instead. func (*FileRange) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{25} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{27} } func (x *FileRange) GetOffset() int64 { @@ -1794,7 +1937,7 @@ type ReadFileResponse struct { func (x *ReadFileResponse) Reset() { *x = ReadFileResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[26] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1806,7 +1949,7 @@ func (x *ReadFileResponse) String() string { func (*ReadFileResponse) ProtoMessage() {} func (x *ReadFileResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[26] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[28] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1819,7 +1962,7 @@ func (x *ReadFileResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ReadFileResponse.ProtoReflect.Descriptor instead. func (*ReadFileResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{26} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{28} } func (x *ReadFileResponse) GetData() []byte { @@ -1840,7 +1983,7 @@ type ReadDirRequest struct { func (x *ReadDirRequest) Reset() { *x = ReadDirRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[27] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1852,7 +1995,7 @@ func (x *ReadDirRequest) String() string { func (*ReadDirRequest) ProtoMessage() {} func (x *ReadDirRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[27] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[29] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1865,7 +2008,7 @@ func (x *ReadDirRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReadDirRequest.ProtoReflect.Descriptor instead. func (*ReadDirRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{27} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{29} } func (x *ReadDirRequest) GetRef() string { @@ -1898,7 +2041,7 @@ type ReadDirResponse struct { func (x *ReadDirResponse) Reset() { *x = ReadDirResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[28] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1910,7 +2053,7 @@ func (x *ReadDirResponse) String() string { func (*ReadDirResponse) ProtoMessage() {} func (x *ReadDirResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[28] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[30] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1923,7 +2066,7 @@ func (x *ReadDirResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ReadDirResponse.ProtoReflect.Descriptor instead. func (*ReadDirResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{28} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{30} } func (x *ReadDirResponse) GetEntries() []*types.Stat { @@ -1943,7 +2086,7 @@ type StatFileRequest struct { func (x *StatFileRequest) Reset() { *x = StatFileRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[29] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1955,7 +2098,7 @@ func (x *StatFileRequest) String() string { func (*StatFileRequest) ProtoMessage() {} func (x *StatFileRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[29] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[31] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1968,7 +2111,7 @@ func (x *StatFileRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StatFileRequest.ProtoReflect.Descriptor instead. func (*StatFileRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{29} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{31} } func (x *StatFileRequest) GetRef() string { @@ -1994,7 +2137,7 @@ type StatFileResponse struct { func (x *StatFileResponse) Reset() { *x = StatFileResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[30] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2006,7 +2149,7 @@ func (x *StatFileResponse) String() string { func (*StatFileResponse) ProtoMessage() {} func (x *StatFileResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[30] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[32] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2019,7 +2162,7 @@ func (x *StatFileResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use StatFileResponse.ProtoReflect.Descriptor instead. func (*StatFileResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{30} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{32} } func (x *StatFileResponse) GetStat() *types.Stat { @@ -2038,7 +2181,7 @@ type EvaluateRequest struct { func (x *EvaluateRequest) Reset() { *x = EvaluateRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[31] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2050,7 +2193,7 @@ func (x *EvaluateRequest) String() string { func (*EvaluateRequest) ProtoMessage() {} func (x *EvaluateRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[31] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[33] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2063,7 +2206,7 @@ func (x *EvaluateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use EvaluateRequest.ProtoReflect.Descriptor instead. func (*EvaluateRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{31} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{33} } func (x *EvaluateRequest) GetRef() string { @@ -2081,7 +2224,7 @@ type EvaluateResponse struct { func (x *EvaluateResponse) Reset() { *x = EvaluateResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[32] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2093,7 +2236,7 @@ func (x *EvaluateResponse) String() string { func (*EvaluateResponse) ProtoMessage() {} func (x *EvaluateResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[32] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[34] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2106,7 +2249,103 @@ func (x *EvaluateResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use EvaluateResponse.ProtoReflect.Descriptor instead. func (*EvaluateResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{32} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{34} +} + +type GetRemoteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ref string `protobuf:"bytes,1,opt,name=Ref,proto3" json:"Ref,omitempty"` + Compression *Compression `protobuf:"bytes,2,opt,name=compression,proto3" json:"compression,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRemoteRequest) Reset() { + *x = GetRemoteRequest{} + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRemoteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRemoteRequest) ProtoMessage() {} + +func (x *GetRemoteRequest) ProtoReflect() protoreflect.Message { + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRemoteRequest.ProtoReflect.Descriptor instead. +func (*GetRemoteRequest) Descriptor() ([]byte, []int) { + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{35} +} + +func (x *GetRemoteRequest) GetRef() string { + if x != nil { + return x.Ref + } + return "" +} + +func (x *GetRemoteRequest) GetCompression() *Compression { + if x != nil { + return x.Compression + } + return nil +} + +type GetRemoteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Descriptors []*Descriptor `protobuf:"bytes,1,rep,name=descriptors,proto3" json:"descriptors,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRemoteResponse) Reset() { + *x = GetRemoteResponse{} + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRemoteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRemoteResponse) ProtoMessage() {} + +func (x *GetRemoteResponse) ProtoReflect() protoreflect.Message { + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetRemoteResponse.ProtoReflect.Descriptor instead. +func (*GetRemoteResponse) Descriptor() ([]byte, []int) { + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{36} +} + +func (x *GetRemoteResponse) GetDescriptors() []*Descriptor { + if x != nil { + return x.Descriptors + } + return nil } type PingRequest struct { @@ -2117,7 +2356,7 @@ type PingRequest struct { func (x *PingRequest) Reset() { *x = PingRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[33] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2129,7 +2368,7 @@ func (x *PingRequest) String() string { func (*PingRequest) ProtoMessage() {} func (x *PingRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[33] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[37] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2142,7 +2381,7 @@ func (x *PingRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PingRequest.ProtoReflect.Descriptor instead. func (*PingRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{33} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{37} } type PongResponse struct { @@ -2156,7 +2395,7 @@ type PongResponse struct { func (x *PongResponse) Reset() { *x = PongResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[34] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[38] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2168,7 +2407,7 @@ func (x *PongResponse) String() string { func (*PongResponse) ProtoMessage() {} func (x *PongResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[34] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[38] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2181,7 +2420,7 @@ func (x *PongResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PongResponse.ProtoReflect.Descriptor instead. func (*PongResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{34} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{38} } func (x *PongResponse) GetFrontendAPICaps() []*pb2.APICap { @@ -2220,7 +2459,7 @@ type WarnRequest struct { func (x *WarnRequest) Reset() { *x = WarnRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[35] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[39] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2232,7 +2471,7 @@ func (x *WarnRequest) String() string { func (*WarnRequest) ProtoMessage() {} func (x *WarnRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[35] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[39] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2245,7 +2484,7 @@ func (x *WarnRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use WarnRequest.ProtoReflect.Descriptor instead. func (*WarnRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{35} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{39} } func (x *WarnRequest) GetDigest() string { @@ -2305,7 +2544,7 @@ type WarnResponse struct { func (x *WarnResponse) Reset() { *x = WarnResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[36] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2317,7 +2556,7 @@ func (x *WarnResponse) String() string { func (*WarnResponse) ProtoMessage() {} func (x *WarnResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[36] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[40] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2330,7 +2569,7 @@ func (x *WarnResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use WarnResponse.ProtoReflect.Descriptor instead. func (*WarnResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{36} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{40} } type NewContainerRequest struct { @@ -2349,7 +2588,7 @@ type NewContainerRequest struct { func (x *NewContainerRequest) Reset() { *x = NewContainerRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[37] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[41] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2361,7 +2600,7 @@ func (x *NewContainerRequest) String() string { func (*NewContainerRequest) ProtoMessage() {} func (x *NewContainerRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[37] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[41] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2374,7 +2613,7 @@ func (x *NewContainerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use NewContainerRequest.ProtoReflect.Descriptor instead. func (*NewContainerRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{37} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{41} } func (x *NewContainerRequest) GetContainerID() string { @@ -2434,7 +2673,7 @@ type NewContainerResponse struct { func (x *NewContainerResponse) Reset() { *x = NewContainerResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[38] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[42] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2446,7 +2685,7 @@ func (x *NewContainerResponse) String() string { func (*NewContainerResponse) ProtoMessage() {} func (x *NewContainerResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[38] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[42] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2459,7 +2698,7 @@ func (x *NewContainerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use NewContainerResponse.ProtoReflect.Descriptor instead. func (*NewContainerResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{38} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{42} } type ReleaseContainerRequest struct { @@ -2471,7 +2710,7 @@ type ReleaseContainerRequest struct { func (x *ReleaseContainerRequest) Reset() { *x = ReleaseContainerRequest{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[39] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[43] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2483,7 +2722,7 @@ func (x *ReleaseContainerRequest) String() string { func (*ReleaseContainerRequest) ProtoMessage() {} func (x *ReleaseContainerRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[39] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[43] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2496,7 +2735,7 @@ func (x *ReleaseContainerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseContainerRequest.ProtoReflect.Descriptor instead. func (*ReleaseContainerRequest) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{39} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{43} } func (x *ReleaseContainerRequest) GetContainerID() string { @@ -2514,7 +2753,7 @@ type ReleaseContainerResponse struct { func (x *ReleaseContainerResponse) Reset() { *x = ReleaseContainerResponse{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[40] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[44] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2526,7 +2765,7 @@ func (x *ReleaseContainerResponse) String() string { func (*ReleaseContainerResponse) ProtoMessage() {} func (x *ReleaseContainerResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[40] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[44] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2539,7 +2778,7 @@ func (x *ReleaseContainerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseContainerResponse.ProtoReflect.Descriptor instead. func (*ReleaseContainerResponse) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{40} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{44} } type ExecMessage struct { @@ -2561,7 +2800,7 @@ type ExecMessage struct { func (x *ExecMessage) Reset() { *x = ExecMessage{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[41] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[45] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2573,7 +2812,7 @@ func (x *ExecMessage) String() string { func (*ExecMessage) ProtoMessage() {} func (x *ExecMessage) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[41] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[45] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2586,7 +2825,7 @@ func (x *ExecMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ExecMessage.ProtoReflect.Descriptor instead. func (*ExecMessage) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{41} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{45} } func (x *ExecMessage) GetProcessID() string { @@ -2738,7 +2977,7 @@ type InitMessage struct { func (x *InitMessage) Reset() { *x = InitMessage{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[42] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[46] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2750,7 +2989,7 @@ func (x *InitMessage) String() string { func (*InitMessage) ProtoMessage() {} func (x *InitMessage) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[42] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[46] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2763,7 +3002,7 @@ func (x *InitMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use InitMessage.ProtoReflect.Descriptor instead. func (*InitMessage) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{42} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{46} } func (x *InitMessage) GetContainerID() string { @@ -2818,7 +3057,7 @@ type ExitMessage struct { func (x *ExitMessage) Reset() { *x = ExitMessage{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[43] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[47] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2830,7 +3069,7 @@ func (x *ExitMessage) String() string { func (*ExitMessage) ProtoMessage() {} func (x *ExitMessage) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[43] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[47] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2843,7 +3082,7 @@ func (x *ExitMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ExitMessage.ProtoReflect.Descriptor instead. func (*ExitMessage) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{43} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{47} } func (x *ExitMessage) GetCode() uint32 { @@ -2868,7 +3107,7 @@ type StartedMessage struct { func (x *StartedMessage) Reset() { *x = StartedMessage{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[44] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[48] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2880,7 +3119,7 @@ func (x *StartedMessage) String() string { func (*StartedMessage) ProtoMessage() {} func (x *StartedMessage) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[44] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[48] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2893,7 +3132,7 @@ func (x *StartedMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use StartedMessage.ProtoReflect.Descriptor instead. func (*StartedMessage) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{44} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{48} } type DoneMessage struct { @@ -2904,7 +3143,7 @@ type DoneMessage struct { func (x *DoneMessage) Reset() { *x = DoneMessage{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[45] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[49] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2916,7 +3155,7 @@ func (x *DoneMessage) String() string { func (*DoneMessage) ProtoMessage() {} func (x *DoneMessage) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[45] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[49] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2929,7 +3168,7 @@ func (x *DoneMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use DoneMessage.ProtoReflect.Descriptor instead. func (*DoneMessage) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{45} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{49} } type FdMessage struct { @@ -2943,7 +3182,7 @@ type FdMessage struct { func (x *FdMessage) Reset() { *x = FdMessage{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[46] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[50] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2955,7 +3194,7 @@ func (x *FdMessage) String() string { func (*FdMessage) ProtoMessage() {} func (x *FdMessage) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[46] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[50] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2968,7 +3207,7 @@ func (x *FdMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use FdMessage.ProtoReflect.Descriptor instead. func (*FdMessage) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{46} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{50} } func (x *FdMessage) GetFd() uint32 { @@ -3002,7 +3241,7 @@ type ResizeMessage struct { func (x *ResizeMessage) Reset() { *x = ResizeMessage{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[47] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[51] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3014,7 +3253,7 @@ func (x *ResizeMessage) String() string { func (*ResizeMessage) ProtoMessage() {} func (x *ResizeMessage) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[47] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[51] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3027,7 +3266,7 @@ func (x *ResizeMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ResizeMessage.ProtoReflect.Descriptor instead. func (*ResizeMessage) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{47} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{51} } func (x *ResizeMessage) GetRows() uint32 { @@ -3055,7 +3294,7 @@ type SignalMessage struct { func (x *SignalMessage) Reset() { *x = SignalMessage{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[48] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[52] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3067,7 +3306,7 @@ func (x *SignalMessage) String() string { func (*SignalMessage) ProtoMessage() {} func (x *SignalMessage) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[48] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[52] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3080,7 +3319,7 @@ func (x *SignalMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use SignalMessage.ProtoReflect.Descriptor instead. func (*SignalMessage) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{48} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{52} } func (x *SignalMessage) GetName() string { @@ -3100,7 +3339,7 @@ type Blob struct { func (x *Blob) Reset() { *x = Blob{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[49] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[53] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3112,7 +3351,7 @@ func (x *Blob) String() string { func (*Blob) ProtoMessage() {} func (x *Blob) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[49] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[53] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3125,7 +3364,7 @@ func (x *Blob) ProtoReflect() protoreflect.Message { // Deprecated: Use Blob.ProtoReflect.Descriptor instead. func (*Blob) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{49} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{53} } func (x *Blob) GetDescriptor_() *Descriptor { @@ -3154,7 +3393,7 @@ type Descriptor struct { func (x *Descriptor) Reset() { *x = Descriptor{} - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[50] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[54] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3166,7 +3405,7 @@ func (x *Descriptor) String() string { func (*Descriptor) ProtoMessage() {} func (x *Descriptor) ProtoReflect() protoreflect.Message { - mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[50] + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[54] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3179,7 +3418,7 @@ func (x *Descriptor) ProtoReflect() protoreflect.Message { // Deprecated: Use Descriptor.ProtoReflect.Descriptor instead. func (*Descriptor) Descriptor() ([]byte, []int) { - return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{50} + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{54} } func (x *Descriptor) GetMediaType() string { @@ -3210,6 +3449,74 @@ func (x *Descriptor) GetAnnotations() map[string]string { return nil } +type Compression struct { + state protoimpl.MessageState `protogen:"open.v1"` + Type Compression_Type `protobuf:"varint,1,opt,name=type,proto3,enum=moby.buildkit.v1.frontend.Compression_Type" json:"type,omitempty"` + Force bool `protobuf:"varint,2,opt,name=force,proto3" json:"force,omitempty"` + HasLevel bool `protobuf:"varint,3,opt,name=hasLevel,proto3" json:"hasLevel,omitempty"` + Level int32 `protobuf:"varint,4,opt,name=level,proto3" json:"level,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Compression) Reset() { + *x = Compression{} + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[55] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Compression) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Compression) ProtoMessage() {} + +func (x *Compression) ProtoReflect() protoreflect.Message { + mi := &file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[55] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Compression.ProtoReflect.Descriptor instead. +func (*Compression) Descriptor() ([]byte, []int) { + return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP(), []int{55} +} + +func (x *Compression) GetType() Compression_Type { + if x != nil { + return x.Type + } + return Compression_UNKNOWN +} + +func (x *Compression) GetForce() bool { + if x != nil { + return x.Force + } + return false +} + +func (x *Compression) GetHasLevel() bool { + if x != nil { + return x.HasLevel + } + return false +} + +func (x *Compression) GetLevel() int32 { + if x != nil { + return x.Level + } + return 0 +} + var File_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto protoreflect.FileDescriptor const file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDesc = "" + @@ -3244,12 +3551,13 @@ const file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDesc = "\x03key\x18\x01 \x01(\tR\x03key\x124\n" + "\x05value\x18\x02 \x01(\v2\x1e.moby.buildkit.v1.frontend.RefR\x05value:\x028\x01\"X\n" + "\fAttestations\x12H\n" + - "\vattestation\x18\x01 \x03(\v2&.moby.buildkit.v1.frontend.AttestationR\vattestation\"\xa6\x03\n" + + "\vattestation\x18\x01 \x03(\v2&.moby.buildkit.v1.frontend.AttestationR\vattestation\"\xc0\x03\n" + "\vAttestation\x12>\n" + "\x04kind\x18\x01 \x01(\x0e2*.moby.buildkit.v1.frontend.AttestationKindR\x04kind\x12P\n" + "\bmetadata\x18\x02 \x03(\v24.moby.buildkit.v1.frontend.Attestation.MetadataEntryR\bmetadata\x120\n" + "\x03ref\x18\x03 \x01(\v2\x1e.moby.buildkit.v1.frontend.RefR\x03ref\x12\x12\n" + - "\x04path\x18\x04 \x01(\tR\x04path\x120\n" + + "\x04path\x18\x04 \x01(\tR\x04path\x12\x18\n" + + "\acontent\x18\a \x01(\fR\acontent\x120\n" + "\x13inTotoPredicateType\x18\x05 \x01(\tR\x13inTotoPredicateType\x12P\n" + "\x0einTotoSubjects\x18\x06 \x03(\v2(.moby.buildkit.v1.frontend.InTotoSubjectR\x0einTotoSubjects\x1a;\n" + "\rMetadataEntry\x12\x10\n" + @@ -3262,7 +3570,10 @@ const file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDesc = "\rReturnRequest\x129\n" + "\x06result\x18\x01 \x01(\v2!.moby.buildkit.v1.frontend.ResultR\x06result\x12(\n" + "\x05error\x18\x02 \x01(\v2\x12.google.rpc.StatusR\x05error\"\x10\n" + - "\x0eReturnResponse\"\x0f\n" + + "\x0eReturnResponse\"\x12\n" + + "\x10GetReturnRequest\"N\n" + + "\x11GetReturnResponse\x129\n" + + "\x06result\x18\x01 \x01(\v2!.moby.buildkit.v1.frontend.ResultR\x06result\"\x0f\n" + "\rInputsRequest\"\xbe\x01\n" + "\x0eInputsResponse\x12\\\n" + "\vDefinitions\x18\x01 \x03(\v2:.moby.buildkit.v1.frontend.InputsResponse.DefinitionsEntryR\vDefinitions\x1aN\n" + @@ -3377,7 +3688,12 @@ const file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDesc = "\x04stat\x18\x01 \x01(\v2\x12.fsutil.types.StatR\x04stat\"#\n" + "\x0fEvaluateRequest\x12\x10\n" + "\x03Ref\x18\x01 \x01(\tR\x03Ref\"\x12\n" + - "\x10EvaluateResponse\"\r\n" + + "\x10EvaluateResponse\"n\n" + + "\x10GetRemoteRequest\x12\x10\n" + + "\x03Ref\x18\x01 \x01(\tR\x03Ref\x12H\n" + + "\vcompression\x18\x02 \x01(\v2&.moby.buildkit.v1.frontend.CompressionR\vcompression\"\\\n" + + "\x11GetRemoteResponse\x12G\n" + + "\vdescriptors\x18\x01 \x03(\v2%.moby.buildkit.v1.frontend.DescriptorR\vdescriptors\"\r\n" + "\vPingRequest\"\xd6\x01\n" + "\fPongResponse\x12J\n" + "\x0fFrontendAPICaps\x18\x01 \x03(\v2 .moby.buildkit.v1.apicaps.APICapR\x0fFrontendAPICaps\x12:\n" + @@ -3452,7 +3768,18 @@ const file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDesc = "\vannotations\x18\x05 \x03(\v26.moby.buildkit.v1.frontend.Descriptor.AnnotationsEntryR\vannotations\x1a>\n" + "\x10AnnotationsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01*)\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xde\x01\n" + + "\vCompression\x12?\n" + + "\x04type\x18\x01 \x01(\x0e2+.moby.buildkit.v1.frontend.Compression.TypeR\x04type\x12\x14\n" + + "\x05force\x18\x02 \x01(\bR\x05force\x12\x1a\n" + + "\bhasLevel\x18\x03 \x01(\bR\bhasLevel\x12\x14\n" + + "\x05level\x18\x04 \x01(\x05R\x05level\"F\n" + + "\x04Type\x12\v\n" + + "\aUNKNOWN\x10\x00\x12\x10\n" + + "\fUNCOMPRESSED\x10\x01\x12\b\n" + + "\x04GZIP\x10\x02\x12\v\n" + + "\aESTARGZ\x10\x03\x12\b\n" + + "\x04ZSTD\x10\x04*)\n" + "\x0fAttestationKind\x12\n" + "\n" + "\x06InToto\x10\x00\x12\n" + @@ -3460,7 +3787,7 @@ const file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDesc = "\x06Bundle\x10\x01*&\n" + "\x11InTotoSubjectKind\x12\b\n" + "\x04Self\x10\x00\x12\a\n" + - "\x03Raw\x10\x012\xbd\v\n" + + "\x03Raw\x10\x012\x8d\r\n" + "\tLLBBridge\x12\x81\x01\n" + "\x12ResolveImageConfig\x124.moby.buildkit.v1.frontend.ResolveImageConfigRequest\x1a5.moby.buildkit.v1.frontend.ResolveImageConfigResponse\x12~\n" + "\x11ResolveSourceMeta\x123.moby.buildkit.v1.frontend.ResolveSourceMetaRequest\x1a4.moby.buildkit.v1.frontend.ResolveSourceMetaResponse\x12Z\n" + @@ -3468,9 +3795,11 @@ const file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDesc = "\bReadFile\x12*.moby.buildkit.v1.frontend.ReadFileRequest\x1a+.moby.buildkit.v1.frontend.ReadFileResponse\x12`\n" + "\aReadDir\x12).moby.buildkit.v1.frontend.ReadDirRequest\x1a*.moby.buildkit.v1.frontend.ReadDirResponse\x12c\n" + "\bStatFile\x12*.moby.buildkit.v1.frontend.StatFileRequest\x1a+.moby.buildkit.v1.frontend.StatFileResponse\x12c\n" + - "\bEvaluate\x12*.moby.buildkit.v1.frontend.EvaluateRequest\x1a+.moby.buildkit.v1.frontend.EvaluateResponse\x12W\n" + + "\bEvaluate\x12*.moby.buildkit.v1.frontend.EvaluateRequest\x1a+.moby.buildkit.v1.frontend.EvaluateResponse\x12f\n" + + "\tGetRemote\x12+.moby.buildkit.v1.frontend.GetRemoteRequest\x1a,.moby.buildkit.v1.frontend.GetRemoteResponse\x12W\n" + "\x04Ping\x12&.moby.buildkit.v1.frontend.PingRequest\x1a'.moby.buildkit.v1.frontend.PongResponse\x12]\n" + - "\x06Return\x12(.moby.buildkit.v1.frontend.ReturnRequest\x1a).moby.buildkit.v1.frontend.ReturnResponse\x12]\n" + + "\x06Return\x12(.moby.buildkit.v1.frontend.ReturnRequest\x1a).moby.buildkit.v1.frontend.ReturnResponse\x12f\n" + + "\tGetReturn\x12+.moby.buildkit.v1.frontend.GetReturnRequest\x1a,.moby.buildkit.v1.frontend.GetReturnResponse\x12]\n" + "\x06Inputs\x12(.moby.buildkit.v1.frontend.InputsRequest\x1a).moby.buildkit.v1.frontend.InputsResponse\x12o\n" + "\fNewContainer\x12..moby.buildkit.v1.frontend.NewContainerRequest\x1a/.moby.buildkit.v1.frontend.NewContainerResponse\x12{\n" + "\x10ReleaseContainer\x122.moby.buildkit.v1.frontend.ReleaseContainerRequest\x1a3.moby.buildkit.v1.frontend.ReleaseContainerResponse\x12a\n" + @@ -3489,195 +3818,209 @@ func file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescGZIP return file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDescData } -var file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 62) +var file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 67) var file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_goTypes = []any{ (AttestationKind)(0), // 0: moby.buildkit.v1.frontend.AttestationKind (InTotoSubjectKind)(0), // 1: moby.buildkit.v1.frontend.InTotoSubjectKind - (*Result)(nil), // 2: moby.buildkit.v1.frontend.Result - (*RefMapDeprecated)(nil), // 3: moby.buildkit.v1.frontend.RefMapDeprecated - (*Ref)(nil), // 4: moby.buildkit.v1.frontend.Ref - (*RefMap)(nil), // 5: moby.buildkit.v1.frontend.RefMap - (*Attestations)(nil), // 6: moby.buildkit.v1.frontend.Attestations - (*Attestation)(nil), // 7: moby.buildkit.v1.frontend.Attestation - (*InTotoSubject)(nil), // 8: moby.buildkit.v1.frontend.InTotoSubject - (*ReturnRequest)(nil), // 9: moby.buildkit.v1.frontend.ReturnRequest - (*ReturnResponse)(nil), // 10: moby.buildkit.v1.frontend.ReturnResponse - (*InputsRequest)(nil), // 11: moby.buildkit.v1.frontend.InputsRequest - (*InputsResponse)(nil), // 12: moby.buildkit.v1.frontend.InputsResponse - (*ResolveImageConfigRequest)(nil), // 13: moby.buildkit.v1.frontend.ResolveImageConfigRequest - (*ResolveImageConfigResponse)(nil), // 14: moby.buildkit.v1.frontend.ResolveImageConfigResponse - (*ResolveSourceMetaRequest)(nil), // 15: moby.buildkit.v1.frontend.ResolveSourceMetaRequest - (*ResolveSourceMetaResponse)(nil), // 16: moby.buildkit.v1.frontend.ResolveSourceMetaResponse - (*ResolveSourceImageRequest)(nil), // 17: moby.buildkit.v1.frontend.ResolveSourceImageRequest - (*AttestationChain)(nil), // 18: moby.buildkit.v1.frontend.AttestationChain - (*ResolveSourceImageResponse)(nil), // 19: moby.buildkit.v1.frontend.ResolveSourceImageResponse - (*ResolveSourceGitRequest)(nil), // 20: moby.buildkit.v1.frontend.ResolveSourceGitRequest - (*ResolveSourceGitResponse)(nil), // 21: moby.buildkit.v1.frontend.ResolveSourceGitResponse - (*ResolveSourceHTTPResponse)(nil), // 22: moby.buildkit.v1.frontend.ResolveSourceHTTPResponse - (*SolveRequest)(nil), // 23: moby.buildkit.v1.frontend.SolveRequest - (*CacheOptionsEntry)(nil), // 24: moby.buildkit.v1.frontend.CacheOptionsEntry - (*SolveResponse)(nil), // 25: moby.buildkit.v1.frontend.SolveResponse - (*ReadFileRequest)(nil), // 26: moby.buildkit.v1.frontend.ReadFileRequest - (*FileRange)(nil), // 27: moby.buildkit.v1.frontend.FileRange - (*ReadFileResponse)(nil), // 28: moby.buildkit.v1.frontend.ReadFileResponse - (*ReadDirRequest)(nil), // 29: moby.buildkit.v1.frontend.ReadDirRequest - (*ReadDirResponse)(nil), // 30: moby.buildkit.v1.frontend.ReadDirResponse - (*StatFileRequest)(nil), // 31: moby.buildkit.v1.frontend.StatFileRequest - (*StatFileResponse)(nil), // 32: moby.buildkit.v1.frontend.StatFileResponse - (*EvaluateRequest)(nil), // 33: moby.buildkit.v1.frontend.EvaluateRequest - (*EvaluateResponse)(nil), // 34: moby.buildkit.v1.frontend.EvaluateResponse - (*PingRequest)(nil), // 35: moby.buildkit.v1.frontend.PingRequest - (*PongResponse)(nil), // 36: moby.buildkit.v1.frontend.PongResponse - (*WarnRequest)(nil), // 37: moby.buildkit.v1.frontend.WarnRequest - (*WarnResponse)(nil), // 38: moby.buildkit.v1.frontend.WarnResponse - (*NewContainerRequest)(nil), // 39: moby.buildkit.v1.frontend.NewContainerRequest - (*NewContainerResponse)(nil), // 40: moby.buildkit.v1.frontend.NewContainerResponse - (*ReleaseContainerRequest)(nil), // 41: moby.buildkit.v1.frontend.ReleaseContainerRequest - (*ReleaseContainerResponse)(nil), // 42: moby.buildkit.v1.frontend.ReleaseContainerResponse - (*ExecMessage)(nil), // 43: moby.buildkit.v1.frontend.ExecMessage - (*InitMessage)(nil), // 44: moby.buildkit.v1.frontend.InitMessage - (*ExitMessage)(nil), // 45: moby.buildkit.v1.frontend.ExitMessage - (*StartedMessage)(nil), // 46: moby.buildkit.v1.frontend.StartedMessage - (*DoneMessage)(nil), // 47: moby.buildkit.v1.frontend.DoneMessage - (*FdMessage)(nil), // 48: moby.buildkit.v1.frontend.FdMessage - (*ResizeMessage)(nil), // 49: moby.buildkit.v1.frontend.ResizeMessage - (*SignalMessage)(nil), // 50: moby.buildkit.v1.frontend.SignalMessage - (*Blob)(nil), // 51: moby.buildkit.v1.frontend.Blob - (*Descriptor)(nil), // 52: moby.buildkit.v1.frontend.Descriptor - nil, // 53: moby.buildkit.v1.frontend.Result.MetadataEntry - nil, // 54: moby.buildkit.v1.frontend.Result.AttestationsEntry - nil, // 55: moby.buildkit.v1.frontend.RefMapDeprecated.RefsEntry - nil, // 56: moby.buildkit.v1.frontend.RefMap.RefsEntry - nil, // 57: moby.buildkit.v1.frontend.Attestation.MetadataEntry - nil, // 58: moby.buildkit.v1.frontend.InputsResponse.DefinitionsEntry - nil, // 59: moby.buildkit.v1.frontend.AttestationChain.BlobsEntry - nil, // 60: moby.buildkit.v1.frontend.SolveRequest.FrontendOptEntry - nil, // 61: moby.buildkit.v1.frontend.SolveRequest.FrontendInputsEntry - nil, // 62: moby.buildkit.v1.frontend.CacheOptionsEntry.AttrsEntry - nil, // 63: moby.buildkit.v1.frontend.Descriptor.AnnotationsEntry - (*pb.Definition)(nil), // 64: pb.Definition - (*status.Status)(nil), // 65: google.rpc.Status - (*pb.Platform)(nil), // 66: pb.Platform - (*pb1.Policy)(nil), // 67: moby.buildkit.v1.sourcepolicy.Policy - (*pb.SourceOp)(nil), // 68: pb.SourceOp - (*timestamp.Timestamp)(nil), // 69: google.protobuf.Timestamp - (*types.Stat)(nil), // 70: fsutil.types.Stat - (*pb2.APICap)(nil), // 71: moby.buildkit.v1.apicaps.APICap - (*types1.WorkerRecord)(nil), // 72: moby.buildkit.v1.types.WorkerRecord - (*pb.SourceInfo)(nil), // 73: pb.SourceInfo - (*pb.Range)(nil), // 74: pb.Range - (*pb.Mount)(nil), // 75: pb.Mount - (pb.NetMode)(0), // 76: pb.NetMode - (*pb.WorkerConstraints)(nil), // 77: pb.WorkerConstraints - (*pb.HostIP)(nil), // 78: pb.HostIP - (*pb.Meta)(nil), // 79: pb.Meta - (pb.SecurityMode)(0), // 80: pb.SecurityMode - (*pb.SecretEnv)(nil), // 81: pb.SecretEnv + (Compression_Type)(0), // 2: moby.buildkit.v1.frontend.Compression.Type + (*Result)(nil), // 3: moby.buildkit.v1.frontend.Result + (*RefMapDeprecated)(nil), // 4: moby.buildkit.v1.frontend.RefMapDeprecated + (*Ref)(nil), // 5: moby.buildkit.v1.frontend.Ref + (*RefMap)(nil), // 6: moby.buildkit.v1.frontend.RefMap + (*Attestations)(nil), // 7: moby.buildkit.v1.frontend.Attestations + (*Attestation)(nil), // 8: moby.buildkit.v1.frontend.Attestation + (*InTotoSubject)(nil), // 9: moby.buildkit.v1.frontend.InTotoSubject + (*ReturnRequest)(nil), // 10: moby.buildkit.v1.frontend.ReturnRequest + (*ReturnResponse)(nil), // 11: moby.buildkit.v1.frontend.ReturnResponse + (*GetReturnRequest)(nil), // 12: moby.buildkit.v1.frontend.GetReturnRequest + (*GetReturnResponse)(nil), // 13: moby.buildkit.v1.frontend.GetReturnResponse + (*InputsRequest)(nil), // 14: moby.buildkit.v1.frontend.InputsRequest + (*InputsResponse)(nil), // 15: moby.buildkit.v1.frontend.InputsResponse + (*ResolveImageConfigRequest)(nil), // 16: moby.buildkit.v1.frontend.ResolveImageConfigRequest + (*ResolveImageConfigResponse)(nil), // 17: moby.buildkit.v1.frontend.ResolveImageConfigResponse + (*ResolveSourceMetaRequest)(nil), // 18: moby.buildkit.v1.frontend.ResolveSourceMetaRequest + (*ResolveSourceMetaResponse)(nil), // 19: moby.buildkit.v1.frontend.ResolveSourceMetaResponse + (*ResolveSourceImageRequest)(nil), // 20: moby.buildkit.v1.frontend.ResolveSourceImageRequest + (*AttestationChain)(nil), // 21: moby.buildkit.v1.frontend.AttestationChain + (*ResolveSourceImageResponse)(nil), // 22: moby.buildkit.v1.frontend.ResolveSourceImageResponse + (*ResolveSourceGitRequest)(nil), // 23: moby.buildkit.v1.frontend.ResolveSourceGitRequest + (*ResolveSourceGitResponse)(nil), // 24: moby.buildkit.v1.frontend.ResolveSourceGitResponse + (*ResolveSourceHTTPResponse)(nil), // 25: moby.buildkit.v1.frontend.ResolveSourceHTTPResponse + (*SolveRequest)(nil), // 26: moby.buildkit.v1.frontend.SolveRequest + (*CacheOptionsEntry)(nil), // 27: moby.buildkit.v1.frontend.CacheOptionsEntry + (*SolveResponse)(nil), // 28: moby.buildkit.v1.frontend.SolveResponse + (*ReadFileRequest)(nil), // 29: moby.buildkit.v1.frontend.ReadFileRequest + (*FileRange)(nil), // 30: moby.buildkit.v1.frontend.FileRange + (*ReadFileResponse)(nil), // 31: moby.buildkit.v1.frontend.ReadFileResponse + (*ReadDirRequest)(nil), // 32: moby.buildkit.v1.frontend.ReadDirRequest + (*ReadDirResponse)(nil), // 33: moby.buildkit.v1.frontend.ReadDirResponse + (*StatFileRequest)(nil), // 34: moby.buildkit.v1.frontend.StatFileRequest + (*StatFileResponse)(nil), // 35: moby.buildkit.v1.frontend.StatFileResponse + (*EvaluateRequest)(nil), // 36: moby.buildkit.v1.frontend.EvaluateRequest + (*EvaluateResponse)(nil), // 37: moby.buildkit.v1.frontend.EvaluateResponse + (*GetRemoteRequest)(nil), // 38: moby.buildkit.v1.frontend.GetRemoteRequest + (*GetRemoteResponse)(nil), // 39: moby.buildkit.v1.frontend.GetRemoteResponse + (*PingRequest)(nil), // 40: moby.buildkit.v1.frontend.PingRequest + (*PongResponse)(nil), // 41: moby.buildkit.v1.frontend.PongResponse + (*WarnRequest)(nil), // 42: moby.buildkit.v1.frontend.WarnRequest + (*WarnResponse)(nil), // 43: moby.buildkit.v1.frontend.WarnResponse + (*NewContainerRequest)(nil), // 44: moby.buildkit.v1.frontend.NewContainerRequest + (*NewContainerResponse)(nil), // 45: moby.buildkit.v1.frontend.NewContainerResponse + (*ReleaseContainerRequest)(nil), // 46: moby.buildkit.v1.frontend.ReleaseContainerRequest + (*ReleaseContainerResponse)(nil), // 47: moby.buildkit.v1.frontend.ReleaseContainerResponse + (*ExecMessage)(nil), // 48: moby.buildkit.v1.frontend.ExecMessage + (*InitMessage)(nil), // 49: moby.buildkit.v1.frontend.InitMessage + (*ExitMessage)(nil), // 50: moby.buildkit.v1.frontend.ExitMessage + (*StartedMessage)(nil), // 51: moby.buildkit.v1.frontend.StartedMessage + (*DoneMessage)(nil), // 52: moby.buildkit.v1.frontend.DoneMessage + (*FdMessage)(nil), // 53: moby.buildkit.v1.frontend.FdMessage + (*ResizeMessage)(nil), // 54: moby.buildkit.v1.frontend.ResizeMessage + (*SignalMessage)(nil), // 55: moby.buildkit.v1.frontend.SignalMessage + (*Blob)(nil), // 56: moby.buildkit.v1.frontend.Blob + (*Descriptor)(nil), // 57: moby.buildkit.v1.frontend.Descriptor + (*Compression)(nil), // 58: moby.buildkit.v1.frontend.Compression + nil, // 59: moby.buildkit.v1.frontend.Result.MetadataEntry + nil, // 60: moby.buildkit.v1.frontend.Result.AttestationsEntry + nil, // 61: moby.buildkit.v1.frontend.RefMapDeprecated.RefsEntry + nil, // 62: moby.buildkit.v1.frontend.RefMap.RefsEntry + nil, // 63: moby.buildkit.v1.frontend.Attestation.MetadataEntry + nil, // 64: moby.buildkit.v1.frontend.InputsResponse.DefinitionsEntry + nil, // 65: moby.buildkit.v1.frontend.AttestationChain.BlobsEntry + nil, // 66: moby.buildkit.v1.frontend.SolveRequest.FrontendOptEntry + nil, // 67: moby.buildkit.v1.frontend.SolveRequest.FrontendInputsEntry + nil, // 68: moby.buildkit.v1.frontend.CacheOptionsEntry.AttrsEntry + nil, // 69: moby.buildkit.v1.frontend.Descriptor.AnnotationsEntry + (*pb.Definition)(nil), // 70: pb.Definition + (*status.Status)(nil), // 71: google.rpc.Status + (*pb.Platform)(nil), // 72: pb.Platform + (*pb1.Policy)(nil), // 73: moby.buildkit.v1.sourcepolicy.Policy + (*pb.SourceOp)(nil), // 74: pb.SourceOp + (*timestamp.Timestamp)(nil), // 75: google.protobuf.Timestamp + (*types.Stat)(nil), // 76: fsutil.types.Stat + (*pb2.APICap)(nil), // 77: moby.buildkit.v1.apicaps.APICap + (*types1.WorkerRecord)(nil), // 78: moby.buildkit.v1.types.WorkerRecord + (*pb.SourceInfo)(nil), // 79: pb.SourceInfo + (*pb.Range)(nil), // 80: pb.Range + (*pb.Mount)(nil), // 81: pb.Mount + (pb.NetMode)(0), // 82: pb.NetMode + (*pb.WorkerConstraints)(nil), // 83: pb.WorkerConstraints + (*pb.HostIP)(nil), // 84: pb.HostIP + (*pb.Meta)(nil), // 85: pb.Meta + (pb.SecurityMode)(0), // 86: pb.SecurityMode + (*pb.SecretEnv)(nil), // 87: pb.SecretEnv } var file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_depIdxs = []int32{ - 3, // 0: moby.buildkit.v1.frontend.Result.refsDeprecated:type_name -> moby.buildkit.v1.frontend.RefMapDeprecated - 4, // 1: moby.buildkit.v1.frontend.Result.ref:type_name -> moby.buildkit.v1.frontend.Ref - 5, // 2: moby.buildkit.v1.frontend.Result.refs:type_name -> moby.buildkit.v1.frontend.RefMap - 53, // 3: moby.buildkit.v1.frontend.Result.metadata:type_name -> moby.buildkit.v1.frontend.Result.MetadataEntry - 54, // 4: moby.buildkit.v1.frontend.Result.attestations:type_name -> moby.buildkit.v1.frontend.Result.AttestationsEntry - 55, // 5: moby.buildkit.v1.frontend.RefMapDeprecated.refs:type_name -> moby.buildkit.v1.frontend.RefMapDeprecated.RefsEntry - 64, // 6: moby.buildkit.v1.frontend.Ref.def:type_name -> pb.Definition - 56, // 7: moby.buildkit.v1.frontend.RefMap.refs:type_name -> moby.buildkit.v1.frontend.RefMap.RefsEntry - 7, // 8: moby.buildkit.v1.frontend.Attestations.attestation:type_name -> moby.buildkit.v1.frontend.Attestation + 4, // 0: moby.buildkit.v1.frontend.Result.refsDeprecated:type_name -> moby.buildkit.v1.frontend.RefMapDeprecated + 5, // 1: moby.buildkit.v1.frontend.Result.ref:type_name -> moby.buildkit.v1.frontend.Ref + 6, // 2: moby.buildkit.v1.frontend.Result.refs:type_name -> moby.buildkit.v1.frontend.RefMap + 59, // 3: moby.buildkit.v1.frontend.Result.metadata:type_name -> moby.buildkit.v1.frontend.Result.MetadataEntry + 60, // 4: moby.buildkit.v1.frontend.Result.attestations:type_name -> moby.buildkit.v1.frontend.Result.AttestationsEntry + 61, // 5: moby.buildkit.v1.frontend.RefMapDeprecated.refs:type_name -> moby.buildkit.v1.frontend.RefMapDeprecated.RefsEntry + 70, // 6: moby.buildkit.v1.frontend.Ref.def:type_name -> pb.Definition + 62, // 7: moby.buildkit.v1.frontend.RefMap.refs:type_name -> moby.buildkit.v1.frontend.RefMap.RefsEntry + 8, // 8: moby.buildkit.v1.frontend.Attestations.attestation:type_name -> moby.buildkit.v1.frontend.Attestation 0, // 9: moby.buildkit.v1.frontend.Attestation.kind:type_name -> moby.buildkit.v1.frontend.AttestationKind - 57, // 10: moby.buildkit.v1.frontend.Attestation.metadata:type_name -> moby.buildkit.v1.frontend.Attestation.MetadataEntry - 4, // 11: moby.buildkit.v1.frontend.Attestation.ref:type_name -> moby.buildkit.v1.frontend.Ref - 8, // 12: moby.buildkit.v1.frontend.Attestation.inTotoSubjects:type_name -> moby.buildkit.v1.frontend.InTotoSubject + 63, // 10: moby.buildkit.v1.frontend.Attestation.metadata:type_name -> moby.buildkit.v1.frontend.Attestation.MetadataEntry + 5, // 11: moby.buildkit.v1.frontend.Attestation.ref:type_name -> moby.buildkit.v1.frontend.Ref + 9, // 12: moby.buildkit.v1.frontend.Attestation.inTotoSubjects:type_name -> moby.buildkit.v1.frontend.InTotoSubject 1, // 13: moby.buildkit.v1.frontend.InTotoSubject.kind:type_name -> moby.buildkit.v1.frontend.InTotoSubjectKind - 2, // 14: moby.buildkit.v1.frontend.ReturnRequest.result:type_name -> moby.buildkit.v1.frontend.Result - 65, // 15: moby.buildkit.v1.frontend.ReturnRequest.error:type_name -> google.rpc.Status - 58, // 16: moby.buildkit.v1.frontend.InputsResponse.Definitions:type_name -> moby.buildkit.v1.frontend.InputsResponse.DefinitionsEntry - 66, // 17: moby.buildkit.v1.frontend.ResolveImageConfigRequest.Platform:type_name -> pb.Platform - 67, // 18: moby.buildkit.v1.frontend.ResolveImageConfigRequest.SourcePolicies:type_name -> moby.buildkit.v1.sourcepolicy.Policy - 68, // 19: moby.buildkit.v1.frontend.ResolveSourceMetaRequest.Source:type_name -> pb.SourceOp - 66, // 20: moby.buildkit.v1.frontend.ResolveSourceMetaRequest.Platform:type_name -> pb.Platform - 20, // 21: moby.buildkit.v1.frontend.ResolveSourceMetaRequest.Git:type_name -> moby.buildkit.v1.frontend.ResolveSourceGitRequest - 17, // 22: moby.buildkit.v1.frontend.ResolveSourceMetaRequest.Image:type_name -> moby.buildkit.v1.frontend.ResolveSourceImageRequest - 67, // 23: moby.buildkit.v1.frontend.ResolveSourceMetaRequest.SourcePolicies:type_name -> moby.buildkit.v1.sourcepolicy.Policy - 68, // 24: moby.buildkit.v1.frontend.ResolveSourceMetaResponse.Source:type_name -> pb.SourceOp - 19, // 25: moby.buildkit.v1.frontend.ResolveSourceMetaResponse.Image:type_name -> moby.buildkit.v1.frontend.ResolveSourceImageResponse - 21, // 26: moby.buildkit.v1.frontend.ResolveSourceMetaResponse.Git:type_name -> moby.buildkit.v1.frontend.ResolveSourceGitResponse - 22, // 27: moby.buildkit.v1.frontend.ResolveSourceMetaResponse.HTTP:type_name -> moby.buildkit.v1.frontend.ResolveSourceHTTPResponse - 59, // 28: moby.buildkit.v1.frontend.AttestationChain.Blobs:type_name -> moby.buildkit.v1.frontend.AttestationChain.BlobsEntry - 18, // 29: moby.buildkit.v1.frontend.ResolveSourceImageResponse.AttestationChain:type_name -> moby.buildkit.v1.frontend.AttestationChain - 69, // 30: moby.buildkit.v1.frontend.ResolveSourceHTTPResponse.LastModified:type_name -> google.protobuf.Timestamp - 64, // 31: moby.buildkit.v1.frontend.SolveRequest.Definition:type_name -> pb.Definition - 60, // 32: moby.buildkit.v1.frontend.SolveRequest.FrontendOpt:type_name -> moby.buildkit.v1.frontend.SolveRequest.FrontendOptEntry - 24, // 33: moby.buildkit.v1.frontend.SolveRequest.CacheImports:type_name -> moby.buildkit.v1.frontend.CacheOptionsEntry - 61, // 34: moby.buildkit.v1.frontend.SolveRequest.FrontendInputs:type_name -> moby.buildkit.v1.frontend.SolveRequest.FrontendInputsEntry - 67, // 35: moby.buildkit.v1.frontend.SolveRequest.SourcePolicies:type_name -> moby.buildkit.v1.sourcepolicy.Policy - 62, // 36: moby.buildkit.v1.frontend.CacheOptionsEntry.Attrs:type_name -> moby.buildkit.v1.frontend.CacheOptionsEntry.AttrsEntry - 2, // 37: moby.buildkit.v1.frontend.SolveResponse.result:type_name -> moby.buildkit.v1.frontend.Result - 27, // 38: moby.buildkit.v1.frontend.ReadFileRequest.Range:type_name -> moby.buildkit.v1.frontend.FileRange - 70, // 39: moby.buildkit.v1.frontend.ReadDirResponse.entries:type_name -> fsutil.types.Stat - 70, // 40: moby.buildkit.v1.frontend.StatFileResponse.stat:type_name -> fsutil.types.Stat - 71, // 41: moby.buildkit.v1.frontend.PongResponse.FrontendAPICaps:type_name -> moby.buildkit.v1.apicaps.APICap - 71, // 42: moby.buildkit.v1.frontend.PongResponse.LLBCaps:type_name -> moby.buildkit.v1.apicaps.APICap - 72, // 43: moby.buildkit.v1.frontend.PongResponse.Workers:type_name -> moby.buildkit.v1.types.WorkerRecord - 73, // 44: moby.buildkit.v1.frontend.WarnRequest.info:type_name -> pb.SourceInfo - 74, // 45: moby.buildkit.v1.frontend.WarnRequest.ranges:type_name -> pb.Range - 75, // 46: moby.buildkit.v1.frontend.NewContainerRequest.Mounts:type_name -> pb.Mount - 76, // 47: moby.buildkit.v1.frontend.NewContainerRequest.Network:type_name -> pb.NetMode - 66, // 48: moby.buildkit.v1.frontend.NewContainerRequest.platform:type_name -> pb.Platform - 77, // 49: moby.buildkit.v1.frontend.NewContainerRequest.constraints:type_name -> pb.WorkerConstraints - 78, // 50: moby.buildkit.v1.frontend.NewContainerRequest.extraHosts:type_name -> pb.HostIP - 44, // 51: moby.buildkit.v1.frontend.ExecMessage.Init:type_name -> moby.buildkit.v1.frontend.InitMessage - 48, // 52: moby.buildkit.v1.frontend.ExecMessage.File:type_name -> moby.buildkit.v1.frontend.FdMessage - 49, // 53: moby.buildkit.v1.frontend.ExecMessage.Resize:type_name -> moby.buildkit.v1.frontend.ResizeMessage - 46, // 54: moby.buildkit.v1.frontend.ExecMessage.Started:type_name -> moby.buildkit.v1.frontend.StartedMessage - 45, // 55: moby.buildkit.v1.frontend.ExecMessage.Exit:type_name -> moby.buildkit.v1.frontend.ExitMessage - 47, // 56: moby.buildkit.v1.frontend.ExecMessage.Done:type_name -> moby.buildkit.v1.frontend.DoneMessage - 50, // 57: moby.buildkit.v1.frontend.ExecMessage.Signal:type_name -> moby.buildkit.v1.frontend.SignalMessage - 79, // 58: moby.buildkit.v1.frontend.InitMessage.Meta:type_name -> pb.Meta - 80, // 59: moby.buildkit.v1.frontend.InitMessage.Security:type_name -> pb.SecurityMode - 81, // 60: moby.buildkit.v1.frontend.InitMessage.secretenv:type_name -> pb.SecretEnv - 65, // 61: moby.buildkit.v1.frontend.ExitMessage.Error:type_name -> google.rpc.Status - 52, // 62: moby.buildkit.v1.frontend.Blob.descriptor:type_name -> moby.buildkit.v1.frontend.Descriptor - 63, // 63: moby.buildkit.v1.frontend.Descriptor.annotations:type_name -> moby.buildkit.v1.frontend.Descriptor.AnnotationsEntry - 6, // 64: moby.buildkit.v1.frontend.Result.AttestationsEntry.value:type_name -> moby.buildkit.v1.frontend.Attestations - 4, // 65: moby.buildkit.v1.frontend.RefMap.RefsEntry.value:type_name -> moby.buildkit.v1.frontend.Ref - 64, // 66: moby.buildkit.v1.frontend.InputsResponse.DefinitionsEntry.value:type_name -> pb.Definition - 51, // 67: moby.buildkit.v1.frontend.AttestationChain.BlobsEntry.value:type_name -> moby.buildkit.v1.frontend.Blob - 64, // 68: moby.buildkit.v1.frontend.SolveRequest.FrontendInputsEntry.value:type_name -> pb.Definition - 13, // 69: moby.buildkit.v1.frontend.LLBBridge.ResolveImageConfig:input_type -> moby.buildkit.v1.frontend.ResolveImageConfigRequest - 15, // 70: moby.buildkit.v1.frontend.LLBBridge.ResolveSourceMeta:input_type -> moby.buildkit.v1.frontend.ResolveSourceMetaRequest - 23, // 71: moby.buildkit.v1.frontend.LLBBridge.Solve:input_type -> moby.buildkit.v1.frontend.SolveRequest - 26, // 72: moby.buildkit.v1.frontend.LLBBridge.ReadFile:input_type -> moby.buildkit.v1.frontend.ReadFileRequest - 29, // 73: moby.buildkit.v1.frontend.LLBBridge.ReadDir:input_type -> moby.buildkit.v1.frontend.ReadDirRequest - 31, // 74: moby.buildkit.v1.frontend.LLBBridge.StatFile:input_type -> moby.buildkit.v1.frontend.StatFileRequest - 33, // 75: moby.buildkit.v1.frontend.LLBBridge.Evaluate:input_type -> moby.buildkit.v1.frontend.EvaluateRequest - 35, // 76: moby.buildkit.v1.frontend.LLBBridge.Ping:input_type -> moby.buildkit.v1.frontend.PingRequest - 9, // 77: moby.buildkit.v1.frontend.LLBBridge.Return:input_type -> moby.buildkit.v1.frontend.ReturnRequest - 11, // 78: moby.buildkit.v1.frontend.LLBBridge.Inputs:input_type -> moby.buildkit.v1.frontend.InputsRequest - 39, // 79: moby.buildkit.v1.frontend.LLBBridge.NewContainer:input_type -> moby.buildkit.v1.frontend.NewContainerRequest - 41, // 80: moby.buildkit.v1.frontend.LLBBridge.ReleaseContainer:input_type -> moby.buildkit.v1.frontend.ReleaseContainerRequest - 43, // 81: moby.buildkit.v1.frontend.LLBBridge.ExecProcess:input_type -> moby.buildkit.v1.frontend.ExecMessage - 37, // 82: moby.buildkit.v1.frontend.LLBBridge.Warn:input_type -> moby.buildkit.v1.frontend.WarnRequest - 14, // 83: moby.buildkit.v1.frontend.LLBBridge.ResolveImageConfig:output_type -> moby.buildkit.v1.frontend.ResolveImageConfigResponse - 16, // 84: moby.buildkit.v1.frontend.LLBBridge.ResolveSourceMeta:output_type -> moby.buildkit.v1.frontend.ResolveSourceMetaResponse - 25, // 85: moby.buildkit.v1.frontend.LLBBridge.Solve:output_type -> moby.buildkit.v1.frontend.SolveResponse - 28, // 86: moby.buildkit.v1.frontend.LLBBridge.ReadFile:output_type -> moby.buildkit.v1.frontend.ReadFileResponse - 30, // 87: moby.buildkit.v1.frontend.LLBBridge.ReadDir:output_type -> moby.buildkit.v1.frontend.ReadDirResponse - 32, // 88: moby.buildkit.v1.frontend.LLBBridge.StatFile:output_type -> moby.buildkit.v1.frontend.StatFileResponse - 34, // 89: moby.buildkit.v1.frontend.LLBBridge.Evaluate:output_type -> moby.buildkit.v1.frontend.EvaluateResponse - 36, // 90: moby.buildkit.v1.frontend.LLBBridge.Ping:output_type -> moby.buildkit.v1.frontend.PongResponse - 10, // 91: moby.buildkit.v1.frontend.LLBBridge.Return:output_type -> moby.buildkit.v1.frontend.ReturnResponse - 12, // 92: moby.buildkit.v1.frontend.LLBBridge.Inputs:output_type -> moby.buildkit.v1.frontend.InputsResponse - 40, // 93: moby.buildkit.v1.frontend.LLBBridge.NewContainer:output_type -> moby.buildkit.v1.frontend.NewContainerResponse - 42, // 94: moby.buildkit.v1.frontend.LLBBridge.ReleaseContainer:output_type -> moby.buildkit.v1.frontend.ReleaseContainerResponse - 43, // 95: moby.buildkit.v1.frontend.LLBBridge.ExecProcess:output_type -> moby.buildkit.v1.frontend.ExecMessage - 38, // 96: moby.buildkit.v1.frontend.LLBBridge.Warn:output_type -> moby.buildkit.v1.frontend.WarnResponse - 83, // [83:97] is the sub-list for method output_type - 69, // [69:83] is the sub-list for method input_type - 69, // [69:69] is the sub-list for extension type_name - 69, // [69:69] is the sub-list for extension extendee - 0, // [0:69] is the sub-list for field type_name + 3, // 14: moby.buildkit.v1.frontend.ReturnRequest.result:type_name -> moby.buildkit.v1.frontend.Result + 71, // 15: moby.buildkit.v1.frontend.ReturnRequest.error:type_name -> google.rpc.Status + 3, // 16: moby.buildkit.v1.frontend.GetReturnResponse.result:type_name -> moby.buildkit.v1.frontend.Result + 64, // 17: moby.buildkit.v1.frontend.InputsResponse.Definitions:type_name -> moby.buildkit.v1.frontend.InputsResponse.DefinitionsEntry + 72, // 18: moby.buildkit.v1.frontend.ResolveImageConfigRequest.Platform:type_name -> pb.Platform + 73, // 19: moby.buildkit.v1.frontend.ResolveImageConfigRequest.SourcePolicies:type_name -> moby.buildkit.v1.sourcepolicy.Policy + 74, // 20: moby.buildkit.v1.frontend.ResolveSourceMetaRequest.Source:type_name -> pb.SourceOp + 72, // 21: moby.buildkit.v1.frontend.ResolveSourceMetaRequest.Platform:type_name -> pb.Platform + 23, // 22: moby.buildkit.v1.frontend.ResolveSourceMetaRequest.Git:type_name -> moby.buildkit.v1.frontend.ResolveSourceGitRequest + 20, // 23: moby.buildkit.v1.frontend.ResolveSourceMetaRequest.Image:type_name -> moby.buildkit.v1.frontend.ResolveSourceImageRequest + 73, // 24: moby.buildkit.v1.frontend.ResolveSourceMetaRequest.SourcePolicies:type_name -> moby.buildkit.v1.sourcepolicy.Policy + 74, // 25: moby.buildkit.v1.frontend.ResolveSourceMetaResponse.Source:type_name -> pb.SourceOp + 22, // 26: moby.buildkit.v1.frontend.ResolveSourceMetaResponse.Image:type_name -> moby.buildkit.v1.frontend.ResolveSourceImageResponse + 24, // 27: moby.buildkit.v1.frontend.ResolveSourceMetaResponse.Git:type_name -> moby.buildkit.v1.frontend.ResolveSourceGitResponse + 25, // 28: moby.buildkit.v1.frontend.ResolveSourceMetaResponse.HTTP:type_name -> moby.buildkit.v1.frontend.ResolveSourceHTTPResponse + 65, // 29: moby.buildkit.v1.frontend.AttestationChain.Blobs:type_name -> moby.buildkit.v1.frontend.AttestationChain.BlobsEntry + 21, // 30: moby.buildkit.v1.frontend.ResolveSourceImageResponse.AttestationChain:type_name -> moby.buildkit.v1.frontend.AttestationChain + 75, // 31: moby.buildkit.v1.frontend.ResolveSourceHTTPResponse.LastModified:type_name -> google.protobuf.Timestamp + 70, // 32: moby.buildkit.v1.frontend.SolveRequest.Definition:type_name -> pb.Definition + 66, // 33: moby.buildkit.v1.frontend.SolveRequest.FrontendOpt:type_name -> moby.buildkit.v1.frontend.SolveRequest.FrontendOptEntry + 27, // 34: moby.buildkit.v1.frontend.SolveRequest.CacheImports:type_name -> moby.buildkit.v1.frontend.CacheOptionsEntry + 67, // 35: moby.buildkit.v1.frontend.SolveRequest.FrontendInputs:type_name -> moby.buildkit.v1.frontend.SolveRequest.FrontendInputsEntry + 73, // 36: moby.buildkit.v1.frontend.SolveRequest.SourcePolicies:type_name -> moby.buildkit.v1.sourcepolicy.Policy + 68, // 37: moby.buildkit.v1.frontend.CacheOptionsEntry.Attrs:type_name -> moby.buildkit.v1.frontend.CacheOptionsEntry.AttrsEntry + 3, // 38: moby.buildkit.v1.frontend.SolveResponse.result:type_name -> moby.buildkit.v1.frontend.Result + 30, // 39: moby.buildkit.v1.frontend.ReadFileRequest.Range:type_name -> moby.buildkit.v1.frontend.FileRange + 76, // 40: moby.buildkit.v1.frontend.ReadDirResponse.entries:type_name -> fsutil.types.Stat + 76, // 41: moby.buildkit.v1.frontend.StatFileResponse.stat:type_name -> fsutil.types.Stat + 58, // 42: moby.buildkit.v1.frontend.GetRemoteRequest.compression:type_name -> moby.buildkit.v1.frontend.Compression + 57, // 43: moby.buildkit.v1.frontend.GetRemoteResponse.descriptors:type_name -> moby.buildkit.v1.frontend.Descriptor + 77, // 44: moby.buildkit.v1.frontend.PongResponse.FrontendAPICaps:type_name -> moby.buildkit.v1.apicaps.APICap + 77, // 45: moby.buildkit.v1.frontend.PongResponse.LLBCaps:type_name -> moby.buildkit.v1.apicaps.APICap + 78, // 46: moby.buildkit.v1.frontend.PongResponse.Workers:type_name -> moby.buildkit.v1.types.WorkerRecord + 79, // 47: moby.buildkit.v1.frontend.WarnRequest.info:type_name -> pb.SourceInfo + 80, // 48: moby.buildkit.v1.frontend.WarnRequest.ranges:type_name -> pb.Range + 81, // 49: moby.buildkit.v1.frontend.NewContainerRequest.Mounts:type_name -> pb.Mount + 82, // 50: moby.buildkit.v1.frontend.NewContainerRequest.Network:type_name -> pb.NetMode + 72, // 51: moby.buildkit.v1.frontend.NewContainerRequest.platform:type_name -> pb.Platform + 83, // 52: moby.buildkit.v1.frontend.NewContainerRequest.constraints:type_name -> pb.WorkerConstraints + 84, // 53: moby.buildkit.v1.frontend.NewContainerRequest.extraHosts:type_name -> pb.HostIP + 49, // 54: moby.buildkit.v1.frontend.ExecMessage.Init:type_name -> moby.buildkit.v1.frontend.InitMessage + 53, // 55: moby.buildkit.v1.frontend.ExecMessage.File:type_name -> moby.buildkit.v1.frontend.FdMessage + 54, // 56: moby.buildkit.v1.frontend.ExecMessage.Resize:type_name -> moby.buildkit.v1.frontend.ResizeMessage + 51, // 57: moby.buildkit.v1.frontend.ExecMessage.Started:type_name -> moby.buildkit.v1.frontend.StartedMessage + 50, // 58: moby.buildkit.v1.frontend.ExecMessage.Exit:type_name -> moby.buildkit.v1.frontend.ExitMessage + 52, // 59: moby.buildkit.v1.frontend.ExecMessage.Done:type_name -> moby.buildkit.v1.frontend.DoneMessage + 55, // 60: moby.buildkit.v1.frontend.ExecMessage.Signal:type_name -> moby.buildkit.v1.frontend.SignalMessage + 85, // 61: moby.buildkit.v1.frontend.InitMessage.Meta:type_name -> pb.Meta + 86, // 62: moby.buildkit.v1.frontend.InitMessage.Security:type_name -> pb.SecurityMode + 87, // 63: moby.buildkit.v1.frontend.InitMessage.secretenv:type_name -> pb.SecretEnv + 71, // 64: moby.buildkit.v1.frontend.ExitMessage.Error:type_name -> google.rpc.Status + 57, // 65: moby.buildkit.v1.frontend.Blob.descriptor:type_name -> moby.buildkit.v1.frontend.Descriptor + 69, // 66: moby.buildkit.v1.frontend.Descriptor.annotations:type_name -> moby.buildkit.v1.frontend.Descriptor.AnnotationsEntry + 2, // 67: moby.buildkit.v1.frontend.Compression.type:type_name -> moby.buildkit.v1.frontend.Compression.Type + 7, // 68: moby.buildkit.v1.frontend.Result.AttestationsEntry.value:type_name -> moby.buildkit.v1.frontend.Attestations + 5, // 69: moby.buildkit.v1.frontend.RefMap.RefsEntry.value:type_name -> moby.buildkit.v1.frontend.Ref + 70, // 70: moby.buildkit.v1.frontend.InputsResponse.DefinitionsEntry.value:type_name -> pb.Definition + 56, // 71: moby.buildkit.v1.frontend.AttestationChain.BlobsEntry.value:type_name -> moby.buildkit.v1.frontend.Blob + 70, // 72: moby.buildkit.v1.frontend.SolveRequest.FrontendInputsEntry.value:type_name -> pb.Definition + 16, // 73: moby.buildkit.v1.frontend.LLBBridge.ResolveImageConfig:input_type -> moby.buildkit.v1.frontend.ResolveImageConfigRequest + 18, // 74: moby.buildkit.v1.frontend.LLBBridge.ResolveSourceMeta:input_type -> moby.buildkit.v1.frontend.ResolveSourceMetaRequest + 26, // 75: moby.buildkit.v1.frontend.LLBBridge.Solve:input_type -> moby.buildkit.v1.frontend.SolveRequest + 29, // 76: moby.buildkit.v1.frontend.LLBBridge.ReadFile:input_type -> moby.buildkit.v1.frontend.ReadFileRequest + 32, // 77: moby.buildkit.v1.frontend.LLBBridge.ReadDir:input_type -> moby.buildkit.v1.frontend.ReadDirRequest + 34, // 78: moby.buildkit.v1.frontend.LLBBridge.StatFile:input_type -> moby.buildkit.v1.frontend.StatFileRequest + 36, // 79: moby.buildkit.v1.frontend.LLBBridge.Evaluate:input_type -> moby.buildkit.v1.frontend.EvaluateRequest + 38, // 80: moby.buildkit.v1.frontend.LLBBridge.GetRemote:input_type -> moby.buildkit.v1.frontend.GetRemoteRequest + 40, // 81: moby.buildkit.v1.frontend.LLBBridge.Ping:input_type -> moby.buildkit.v1.frontend.PingRequest + 10, // 82: moby.buildkit.v1.frontend.LLBBridge.Return:input_type -> moby.buildkit.v1.frontend.ReturnRequest + 12, // 83: moby.buildkit.v1.frontend.LLBBridge.GetReturn:input_type -> moby.buildkit.v1.frontend.GetReturnRequest + 14, // 84: moby.buildkit.v1.frontend.LLBBridge.Inputs:input_type -> moby.buildkit.v1.frontend.InputsRequest + 44, // 85: moby.buildkit.v1.frontend.LLBBridge.NewContainer:input_type -> moby.buildkit.v1.frontend.NewContainerRequest + 46, // 86: moby.buildkit.v1.frontend.LLBBridge.ReleaseContainer:input_type -> moby.buildkit.v1.frontend.ReleaseContainerRequest + 48, // 87: moby.buildkit.v1.frontend.LLBBridge.ExecProcess:input_type -> moby.buildkit.v1.frontend.ExecMessage + 42, // 88: moby.buildkit.v1.frontend.LLBBridge.Warn:input_type -> moby.buildkit.v1.frontend.WarnRequest + 17, // 89: moby.buildkit.v1.frontend.LLBBridge.ResolveImageConfig:output_type -> moby.buildkit.v1.frontend.ResolveImageConfigResponse + 19, // 90: moby.buildkit.v1.frontend.LLBBridge.ResolveSourceMeta:output_type -> moby.buildkit.v1.frontend.ResolveSourceMetaResponse + 28, // 91: moby.buildkit.v1.frontend.LLBBridge.Solve:output_type -> moby.buildkit.v1.frontend.SolveResponse + 31, // 92: moby.buildkit.v1.frontend.LLBBridge.ReadFile:output_type -> moby.buildkit.v1.frontend.ReadFileResponse + 33, // 93: moby.buildkit.v1.frontend.LLBBridge.ReadDir:output_type -> moby.buildkit.v1.frontend.ReadDirResponse + 35, // 94: moby.buildkit.v1.frontend.LLBBridge.StatFile:output_type -> moby.buildkit.v1.frontend.StatFileResponse + 37, // 95: moby.buildkit.v1.frontend.LLBBridge.Evaluate:output_type -> moby.buildkit.v1.frontend.EvaluateResponse + 39, // 96: moby.buildkit.v1.frontend.LLBBridge.GetRemote:output_type -> moby.buildkit.v1.frontend.GetRemoteResponse + 41, // 97: moby.buildkit.v1.frontend.LLBBridge.Ping:output_type -> moby.buildkit.v1.frontend.PongResponse + 11, // 98: moby.buildkit.v1.frontend.LLBBridge.Return:output_type -> moby.buildkit.v1.frontend.ReturnResponse + 13, // 99: moby.buildkit.v1.frontend.LLBBridge.GetReturn:output_type -> moby.buildkit.v1.frontend.GetReturnResponse + 15, // 100: moby.buildkit.v1.frontend.LLBBridge.Inputs:output_type -> moby.buildkit.v1.frontend.InputsResponse + 45, // 101: moby.buildkit.v1.frontend.LLBBridge.NewContainer:output_type -> moby.buildkit.v1.frontend.NewContainerResponse + 47, // 102: moby.buildkit.v1.frontend.LLBBridge.ReleaseContainer:output_type -> moby.buildkit.v1.frontend.ReleaseContainerResponse + 48, // 103: moby.buildkit.v1.frontend.LLBBridge.ExecProcess:output_type -> moby.buildkit.v1.frontend.ExecMessage + 43, // 104: moby.buildkit.v1.frontend.LLBBridge.Warn:output_type -> moby.buildkit.v1.frontend.WarnResponse + 89, // [89:105] is the sub-list for method output_type + 73, // [73:89] is the sub-list for method input_type + 73, // [73:73] is the sub-list for extension type_name + 73, // [73:73] is the sub-list for extension extendee + 0, // [0:73] is the sub-list for field type_name } func init() { file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_init() } @@ -3691,7 +4034,7 @@ func file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_init() { (*Result_Ref)(nil), (*Result_Refs)(nil), } - file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[41].OneofWrappers = []any{ + file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_msgTypes[45].OneofWrappers = []any{ (*ExecMessage_Init)(nil), (*ExecMessage_File)(nil), (*ExecMessage_Resize)(nil), @@ -3705,8 +4048,8 @@ func file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDesc), len(file_github_com_moby_buildkit_frontend_gateway_pb_gateway_proto_rawDesc)), - NumEnums: 2, - NumMessages: 62, + NumEnums: 3, + NumMessages: 67, NumExtensions: 0, NumServices: 1, }, diff --git a/frontend/gateway/pb/gateway.proto b/frontend/gateway/pb/gateway.proto index 3add95c654ad..abaf11cdc129 100644 --- a/frontend/gateway/pb/gateway.proto +++ b/frontend/gateway/pb/gateway.proto @@ -27,8 +27,12 @@ service LLBBridge { rpc StatFile(StatFileRequest) returns (StatFileResponse); // apicaps:CapGatewayEvaluate rpc Evaluate(EvaluateRequest) returns (EvaluateResponse); + // apicaps:CapGatewayGetRemote + rpc GetRemote(GetRemoteRequest) returns (GetRemoteResponse); rpc Ping(PingRequest) returns (PongResponse); rpc Return(ReturnRequest) returns (ReturnResponse); + // apicaps:CapGatewayGetReturn + rpc GetReturn(GetReturnRequest) returns (GetReturnResponse); // apicaps:CapFrontendInputs rpc Inputs(InputsRequest) returns (InputsResponse); @@ -77,6 +81,8 @@ message Attestation { Ref ref = 3; string path = 4; + bytes content = 7; + string inTotoPredicateType = 5; repeated InTotoSubject inTotoSubjects = 6; } @@ -106,6 +112,13 @@ message ReturnRequest { message ReturnResponse { } +message GetReturnRequest { +} + +message GetReturnResponse { + Result result = 1; +} + message InputsRequest { } @@ -265,6 +278,15 @@ message EvaluateRequest { message EvaluateResponse { } +message GetRemoteRequest { + string Ref = 1; + Compression compression = 2; +} + +message GetRemoteResponse { + repeated Descriptor descriptors = 1; +} + message PingRequest{ } message PongResponse{ @@ -374,4 +396,19 @@ message Descriptor { string digest = 2; int64 size = 3; map annotations = 5; -} \ No newline at end of file +} + +message Compression { + enum Type { + UNKNOWN = 0; + UNCOMPRESSED = 1; + GZIP = 2; + ESTARGZ = 3; + ZSTD = 4; + } + + Type type = 1; + bool force = 2; + bool hasLevel = 3; + int32 level = 4; +} diff --git a/frontend/gateway/pb/gateway_grpc.pb.go b/frontend/gateway/pb/gateway_grpc.pb.go index 62e213dd2f79..87941f3b0493 100644 --- a/frontend/gateway/pb/gateway_grpc.pb.go +++ b/frontend/gateway/pb/gateway_grpc.pb.go @@ -26,8 +26,10 @@ const ( 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_GetRemote_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/GetRemote" LLBBridge_Ping_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/Ping" LLBBridge_Return_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/Return" + LLBBridge_GetReturn_FullMethodName = "/moby.buildkit.v1.frontend.LLBBridge/GetReturn" 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" @@ -53,8 +55,12 @@ type LLBBridgeClient interface { StatFile(ctx context.Context, in *StatFileRequest, opts ...grpc.CallOption) (*StatFileResponse, error) // apicaps:CapGatewayEvaluate Evaluate(ctx context.Context, in *EvaluateRequest, opts ...grpc.CallOption) (*EvaluateResponse, error) + // apicaps:CapGatewayGetRemote + GetRemote(ctx context.Context, in *GetRemoteRequest, opts ...grpc.CallOption) (*GetRemoteResponse, error) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error) Return(ctx context.Context, in *ReturnRequest, opts ...grpc.CallOption) (*ReturnResponse, error) + // apicaps:CapGatewayGetReturn + GetReturn(ctx context.Context, in *GetReturnRequest, opts ...grpc.CallOption) (*GetReturnResponse, 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) @@ -142,6 +148,16 @@ func (c *lLBBridgeClient) Evaluate(ctx context.Context, in *EvaluateRequest, opt return out, nil } +func (c *lLBBridgeClient) GetRemote(ctx context.Context, in *GetRemoteRequest, opts ...grpc.CallOption) (*GetRemoteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetRemoteResponse) + err := c.cc.Invoke(ctx, LLBBridge_GetRemote_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) @@ -162,6 +178,16 @@ func (c *lLBBridgeClient) Return(ctx context.Context, in *ReturnRequest, opts .. return out, nil } +func (c *lLBBridgeClient) GetReturn(ctx context.Context, in *GetReturnRequest, opts ...grpc.CallOption) (*GetReturnResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetReturnResponse) + err := c.cc.Invoke(ctx, LLBBridge_GetReturn_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) @@ -233,8 +259,12 @@ type LLBBridgeServer interface { StatFile(context.Context, *StatFileRequest) (*StatFileResponse, error) // apicaps:CapGatewayEvaluate Evaluate(context.Context, *EvaluateRequest) (*EvaluateResponse, error) + // apicaps:CapGatewayGetRemote + GetRemote(context.Context, *GetRemoteRequest) (*GetRemoteResponse, error) Ping(context.Context, *PingRequest) (*PongResponse, error) Return(context.Context, *ReturnRequest) (*ReturnResponse, error) + // apicaps:CapGatewayGetReturn + GetReturn(context.Context, *GetReturnRequest) (*GetReturnResponse, error) // apicaps:CapFrontendInputs Inputs(context.Context, *InputsRequest) (*InputsResponse, error) NewContainer(context.Context, *NewContainerRequest) (*NewContainerResponse, error) @@ -272,12 +302,18 @@ func (UnimplementedLLBBridgeServer) StatFile(context.Context, *StatFileRequest) func (UnimplementedLLBBridgeServer) Evaluate(context.Context, *EvaluateRequest) (*EvaluateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Evaluate not implemented") } +func (UnimplementedLLBBridgeServer) GetRemote(context.Context, *GetRemoteRequest) (*GetRemoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRemote 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) GetReturn(context.Context, *GetReturnRequest) (*GetReturnResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetReturn not implemented") +} func (UnimplementedLLBBridgeServer) Inputs(context.Context, *InputsRequest) (*InputsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Inputs not implemented") } @@ -439,6 +475,24 @@ func _LLBBridge_Evaluate_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _LLBBridge_GetRemote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRemoteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LLBBridgeServer).GetRemote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LLBBridge_GetRemote_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LLBBridgeServer).GetRemote(ctx, req.(*GetRemoteRequest)) + } + 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 { @@ -475,6 +529,24 @@ func _LLBBridge_Return_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _LLBBridge_GetReturn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetReturnRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LLBBridgeServer).GetReturn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LLBBridge_GetReturn_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LLBBridgeServer).GetReturn(ctx, req.(*GetReturnRequest)) + } + 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 { @@ -589,6 +661,10 @@ var LLBBridge_ServiceDesc = grpc.ServiceDesc{ MethodName: "Evaluate", Handler: _LLBBridge_Evaluate_Handler, }, + { + MethodName: "GetRemote", + Handler: _LLBBridge_GetRemote_Handler, + }, { MethodName: "Ping", Handler: _LLBBridge_Ping_Handler, @@ -597,6 +673,10 @@ var LLBBridge_ServiceDesc = grpc.ServiceDesc{ MethodName: "Return", Handler: _LLBBridge_Return_Handler, }, + { + MethodName: "GetReturn", + Handler: _LLBBridge_GetReturn_Handler, + }, { MethodName: "Inputs", Handler: _LLBBridge_Inputs_Handler, diff --git a/frontend/gateway/pb/gateway_vtproto.pb.go b/frontend/gateway/pb/gateway_vtproto.pb.go index 585416809c90..a00af406dd16 100644 --- a/frontend/gateway/pb/gateway_vtproto.pb.go +++ b/frontend/gateway/pb/gateway_vtproto.pb.go @@ -203,6 +203,11 @@ func (m *Attestation) CloneVT() *Attestation { } r.Metadata = tmpContainer } + if rhs := m.Content; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.Content = tmpBytes + } if rhs := m.InTotoSubjects; rhs != nil { tmpContainer := make([]*InTotoSubject, len(rhs)) for k, v := range rhs { @@ -284,6 +289,39 @@ func (m *ReturnResponse) CloneMessageVT() proto.Message { return m.CloneVT() } +func (m *GetReturnRequest) CloneVT() *GetReturnRequest { + if m == nil { + return (*GetReturnRequest)(nil) + } + r := new(GetReturnRequest) + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *GetReturnRequest) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *GetReturnResponse) CloneVT() *GetReturnResponse { + if m == nil { + return (*GetReturnResponse)(nil) + } + r := new(GetReturnResponse) + r.Result = m.Result.CloneVT() + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *GetReturnResponse) CloneMessageVT() proto.Message { + return m.CloneVT() +} + func (m *InputsRequest) CloneVT() *InputsRequest { if m == nil { return (*InputsRequest)(nil) @@ -837,6 +875,47 @@ func (m *EvaluateResponse) CloneMessageVT() proto.Message { return m.CloneVT() } +func (m *GetRemoteRequest) CloneVT() *GetRemoteRequest { + if m == nil { + return (*GetRemoteRequest)(nil) + } + r := new(GetRemoteRequest) + r.Ref = m.Ref + r.Compression = m.Compression.CloneVT() + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *GetRemoteRequest) CloneMessageVT() proto.Message { + return m.CloneVT() +} + +func (m *GetRemoteResponse) CloneVT() *GetRemoteResponse { + if m == nil { + return (*GetRemoteResponse)(nil) + } + r := new(GetRemoteResponse) + if rhs := m.Descriptors; rhs != nil { + tmpContainer := make([]*Descriptor, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Descriptors = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *GetRemoteResponse) CloneMessageVT() proto.Message { + return m.CloneVT() +} + func (m *PingRequest) CloneVT() *PingRequest { if m == nil { return (*PingRequest)(nil) @@ -1308,6 +1387,26 @@ func (m *Descriptor) CloneMessageVT() proto.Message { return m.CloneVT() } +func (m *Compression) CloneVT() *Compression { + if m == nil { + return (*Compression)(nil) + } + r := new(Compression) + r.Type = m.Type + r.Force = m.Force + r.HasLevel = m.HasLevel + r.Level = m.Level + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Compression) CloneMessageVT() proto.Message { + return m.CloneVT() +} + func (this *Result) EqualVT(that *Result) bool { if this == that { return true @@ -1624,6 +1723,9 @@ func (this *Attestation) EqualVT(that *Attestation) bool { } } } + if string(this.Content) != string(that.Content) { + return false + } return string(this.unknownFields) == string(that.unknownFields) } @@ -1707,6 +1809,41 @@ func (this *ReturnResponse) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } +func (this *GetReturnRequest) EqualVT(that *GetReturnRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *GetReturnRequest) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*GetReturnRequest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *GetReturnResponse) EqualVT(that *GetReturnResponse) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.Result.EqualVT(that.Result) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *GetReturnResponse) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*GetReturnResponse) + if !ok { + return false + } + return this.EqualVT(that) +} func (this *InputsRequest) EqualVT(that *InputsRequest) bool { if this == that { return true @@ -2457,6 +2594,61 @@ func (this *EvaluateResponse) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } +func (this *GetRemoteRequest) EqualVT(that *GetRemoteRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Ref != that.Ref { + return false + } + if !this.Compression.EqualVT(that.Compression) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *GetRemoteRequest) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*GetRemoteRequest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *GetRemoteResponse) EqualVT(that *GetRemoteResponse) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if len(this.Descriptors) != len(that.Descriptors) { + return false + } + for i, vx := range this.Descriptors { + vy := that.Descriptors[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &Descriptor{} + } + if q == nil { + q = &Descriptor{} + } + if !p.EqualVT(q) { + return false + } + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *GetRemoteResponse) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*GetRemoteResponse) + if !ok { + return false + } + return this.EqualVT(that) +} func (this *PingRequest) EqualVT(that *PingRequest) bool { if this == that { return true @@ -3172,6 +3364,34 @@ func (this *Descriptor) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } +func (this *Compression) EqualVT(that *Compression) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Type != that.Type { + return false + } + if this.Force != that.Force { + return false + } + if this.HasLevel != that.HasLevel { + return false + } + if this.Level != that.Level { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Compression) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*Compression) + if !ok { + return false + } + return this.EqualVT(that) +} func (m *Result) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -3570,6 +3790,13 @@ func (m *Attestation) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if len(m.Content) > 0 { + i -= len(m.Content) + copy(dAtA[i:], m.Content) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Content))) + i-- + dAtA[i] = 0x3a + } if len(m.InTotoSubjects) > 0 { for iNdEx := len(m.InTotoSubjects) - 1; iNdEx >= 0; iNdEx-- { size, err := m.InTotoSubjects[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) @@ -3785,6 +4012,82 @@ func (m *ReturnResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *GetReturnRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetReturnRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetReturnRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + return len(dAtA) - i, nil +} + +func (m *GetReturnResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetReturnResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetReturnResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Result != nil { + size, err := m.Result.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *InputsRequest) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -5254,7 +5557,7 @@ func (m *EvaluateResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PingRequest) MarshalVT() (dAtA []byte, err error) { +func (m *GetRemoteRequest) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil } @@ -5267,12 +5570,12 @@ func (m *PingRequest) MarshalVT() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PingRequest) MarshalToVT(dAtA []byte) (int, error) { +func (m *GetRemoteRequest) MarshalToVT(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVT(dAtA[:size]) } -func (m *PingRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { +func (m *GetRemoteRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -5284,18 +5587,113 @@ func (m *PingRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - return len(dAtA) - i, nil -} - -func (m *PongResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err + if m.Compression != nil { + size, err := m.Compression.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if len(m.Ref) > 0 { + i -= len(m.Ref) + copy(dAtA[i:], m.Ref) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Ref))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetRemoteResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetRemoteResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetRemoteResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Descriptors) > 0 { + for iNdEx := len(m.Descriptors) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Descriptors[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *PingRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PingRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *PingRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + return len(dAtA) - i, nil +} + +func (m *PongResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err } return dAtA[:n], nil } @@ -6373,6 +6771,69 @@ func (m *Descriptor) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Compression) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Compression) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Compression) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Level != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Level)) + i-- + dAtA[i] = 0x20 + } + if m.HasLevel { + i-- + if m.HasLevel { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.Force { + i-- + if m.Force { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if m.Type != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *Result) SizeVT() (n int) { if m == nil { return 0 @@ -6571,6 +7032,10 @@ func (m *Attestation) SizeVT() (n int) { n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) } } + l = len(m.Content) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } n += len(m.unknownFields) return n } @@ -6632,6 +7097,30 @@ func (m *ReturnResponse) SizeVT() (n int) { return n } +func (m *GetReturnRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += len(m.unknownFields) + return n +} + +func (m *GetReturnResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Result != nil { + l = m.Result.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + func (m *InputsRequest) SizeVT() (n int) { if m == nil { return 0 @@ -7205,6 +7694,40 @@ func (m *EvaluateResponse) SizeVT() (n int) { return n } +func (m *GetRemoteRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Ref) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + if m.Compression != nil { + l = m.Compression.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *GetRemoteResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Descriptors) > 0 { + for _, e := range m.Descriptors { + l = e.SizeVT() + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + func (m *PingRequest) SizeVT() (n int) { if m == nil { return 0 @@ -7661,6 +8184,28 @@ func (m *Descriptor) SizeVT() (n int) { return n } +func (m *Compression) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Type)) + } + if m.Force { + n += 2 + } + if m.HasLevel { + n += 2 + } + if m.Level != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Level)) + } + n += len(m.unknownFields) + return n +} + func (m *Result) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -8996,6 +9541,40 @@ func (m *Attestation) UnmarshalVT(dAtA []byte) error { return err } iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Content = append(m.Content[:0], dAtA[iNdEx:postIndex]...) + if m.Content == nil { + m.Content = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) @@ -9334,7 +9913,7 @@ func (m *ReturnResponse) UnmarshalVT(dAtA []byte) error { } return nil } -func (m *InputsRequest) UnmarshalVT(dAtA []byte) error { +func (m *GetReturnRequest) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9357,10 +9936,148 @@ func (m *InputsRequest) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: InputsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetReturnRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: InputsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetReturnRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetReturnResponse) UnmarshalVT(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 protohelpers.ErrIntOverflow + } + 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: GetReturnResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetReturnResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Result == nil { + m.Result = &Result{} + } + if err := m.Result.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *InputsRequest) UnmarshalVT(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 protohelpers.ErrIntOverflow + } + 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: InputsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: InputsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -13286,6 +14003,210 @@ func (m *EvaluateResponse) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *GetRemoteRequest) UnmarshalVT(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 protohelpers.ErrIntOverflow + } + 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: GetRemoteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRemoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ref", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + 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 protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ref = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Compression", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Compression == nil { + m.Compression = &Compression{} + } + if err := m.Compression.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetRemoteResponse) UnmarshalVT(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 protohelpers.ErrIntOverflow + } + 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: GetRemoteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetRemoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Descriptors", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Descriptors = append(m.Descriptors, &Descriptor{}) + if err := m.Descriptors[len(m.Descriptors)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *PingRequest) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -15802,3 +16723,132 @@ func (m *Descriptor) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *Compression) UnmarshalVT(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 protohelpers.ErrIntOverflow + } + 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: Compression: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Compression: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= Compression_Type(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Force", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Force = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HasLevel", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.HasLevel = bool(v != 0) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Level", wireType) + } + m.Level = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Level |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/hack/test b/hack/test index ce3de0e1fe7c..081432055e17 100755 --- a/hack/test +++ b/hack/test @@ -71,6 +71,7 @@ done testReportsDir="$(pwd)/bin/testreports" mkdir -p "$testReportsDir" testReportsVol="-v $testReportsDir:/testreports" +sourceVol="-v $(pwd):/mnt/buildkit:ro" gotestsumArgs="--format=standard-verbose --jsonfile=/testreports/go-test-report$TEST_REPORT_SUFFIX.json --junitfile=/testreports/junit-report$TEST_REPORT_SUFFIX.xml" gotestArgs="-mod=vendor" @@ -120,7 +121,7 @@ if [ "$GITHUB_ACTIONS" = "true" ] || [ -n "$MOUNT_BUILDKIT_DOCKER_CONFIG_PATH" ] fi baseCreateFlags="--rm --privileged $dockerConfigMount \ --v /tmp $testReportsVol \ +-v /tmp $sourceVol $testReportsVol \ --volumes-from=$cacheVolume \ -e CGO_ENABLED \ -e GITHUB_REF \ diff --git a/session/exporter/exporter.pb.go b/session/exporter/exporter.pb.go index b93f9ec59099..bf5259f8fff0 100644 --- a/session/exporter/exporter.pb.go +++ b/session/exporter/exporter.pb.go @@ -7,6 +7,7 @@ package exporter import ( + control "github.com/moby/buildkit/api/services/control" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -121,6 +122,7 @@ type ExporterRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` Attrs map[string]string `protobuf:"bytes,2,rep,name=Attrs,proto3" json:"Attrs,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Target control.ExporterTarget `protobuf:"varint,3,opt,name=Target,proto3,enum=moby.buildkit.v1.ExporterTarget" json:"Target,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -169,11 +171,18 @@ func (x *ExporterRequest) GetAttrs() map[string]string { return nil } +func (x *ExporterRequest) GetTarget() control.ExporterTarget { + if x != nil { + return x.Target + } + return control.ExporterTarget(0) +} + var File_github_com_moby_buildkit_session_exporter_exporter_proto protoreflect.FileDescriptor const file_github_com_moby_buildkit_session_exporter_exporter_proto_rawDesc = "" + "\n" + - "8github.com/moby/buildkit/session/exporter/exporter.proto\x12\x10moby.exporter.v1\"\xb9\x01\n" + + "8github.com/moby/buildkit/session/exporter/exporter.proto\x12\x10moby.exporter.v1\x1a;github.com/moby/buildkit/api/services/control/control.proto\"\xb9\x01\n" + "\x14FindExportersRequest\x12P\n" + "\bmetadata\x18\x01 \x03(\v24.moby.exporter.v1.FindExportersRequest.MetadataEntryR\bmetadata\x12\x12\n" + "\x04refs\x18\x02 \x03(\tR\x04refs\x1a;\n" + @@ -181,10 +190,11 @@ const file_github_com_moby_buildkit_session_exporter_exporter_proto_rawDesc = "" "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\fR\x05value:\x028\x01\"X\n" + "\x15FindExportersResponse\x12?\n" + - "\texporters\x18\x01 \x03(\v2!.moby.exporter.v1.ExporterRequestR\texporters\"\xa3\x01\n" + + "\texporters\x18\x01 \x03(\v2!.moby.exporter.v1.ExporterRequestR\texporters\"\xdd\x01\n" + "\x0fExporterRequest\x12\x12\n" + "\x04Type\x18\x01 \x01(\tR\x04Type\x12B\n" + - "\x05Attrs\x18\x02 \x03(\v2,.moby.exporter.v1.ExporterRequest.AttrsEntryR\x05Attrs\x1a8\n" + + "\x05Attrs\x18\x02 \x03(\v2,.moby.exporter.v1.ExporterRequest.AttrsEntryR\x05Attrs\x128\n" + + "\x06Target\x18\x03 \x01(\x0e2 .moby.buildkit.v1.ExporterTargetR\x06Target\x1a8\n" + "\n" + "AttrsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + @@ -211,18 +221,20 @@ var file_github_com_moby_buildkit_session_exporter_exporter_proto_goTypes = []an (*ExporterRequest)(nil), // 2: moby.exporter.v1.ExporterRequest nil, // 3: moby.exporter.v1.FindExportersRequest.MetadataEntry nil, // 4: moby.exporter.v1.ExporterRequest.AttrsEntry + (control.ExporterTarget)(0), // 5: moby.buildkit.v1.ExporterTarget } var file_github_com_moby_buildkit_session_exporter_exporter_proto_depIdxs = []int32{ 3, // 0: moby.exporter.v1.FindExportersRequest.metadata:type_name -> moby.exporter.v1.FindExportersRequest.MetadataEntry 2, // 1: moby.exporter.v1.FindExportersResponse.exporters:type_name -> moby.exporter.v1.ExporterRequest 4, // 2: moby.exporter.v1.ExporterRequest.Attrs:type_name -> moby.exporter.v1.ExporterRequest.AttrsEntry - 0, // 3: moby.exporter.v1.Exporter.FindExporters:input_type -> moby.exporter.v1.FindExportersRequest - 1, // 4: moby.exporter.v1.Exporter.FindExporters:output_type -> moby.exporter.v1.FindExportersResponse - 4, // [4:5] is the sub-list for method output_type - 3, // [3:4] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 5, // 3: moby.exporter.v1.ExporterRequest.Target:type_name -> moby.buildkit.v1.ExporterTarget + 0, // 4: moby.exporter.v1.Exporter.FindExporters:input_type -> moby.exporter.v1.FindExportersRequest + 1, // 5: moby.exporter.v1.Exporter.FindExporters:output_type -> moby.exporter.v1.FindExportersResponse + 5, // [5:6] is the sub-list for method output_type + 4, // [4:5] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_github_com_moby_buildkit_session_exporter_exporter_proto_init() } diff --git a/session/exporter/exporter.proto b/session/exporter/exporter.proto index 0a0423372696..c9364cfa99bf 100644 --- a/session/exporter/exporter.proto +++ b/session/exporter/exporter.proto @@ -4,6 +4,8 @@ package moby.exporter.v1; option go_package = "github.com/moby/buildkit/session/exporter"; +import "github.com/moby/buildkit/api/services/control/control.proto"; + service Exporter { rpc FindExporters(FindExportersRequest) returns (FindExportersResponse); } @@ -20,4 +22,5 @@ message FindExportersResponse { message ExporterRequest { string Type = 1; map Attrs = 2; + moby.buildkit.v1.ExporterTarget Target = 3; } diff --git a/session/exporter/exporter_vtproto.pb.go b/session/exporter/exporter_vtproto.pb.go index 469754619d40..c245cfc3f203 100644 --- a/session/exporter/exporter_vtproto.pb.go +++ b/session/exporter/exporter_vtproto.pb.go @@ -6,6 +6,7 @@ package exporter import ( fmt "fmt" + control "github.com/moby/buildkit/api/services/control" protohelpers "github.com/planetscale/vtprotobuf/protohelpers" proto "google.golang.org/protobuf/proto" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -78,6 +79,7 @@ func (m *ExporterRequest) CloneVT() *ExporterRequest { } r := new(ExporterRequest) r.Type = m.Type + r.Target = m.Target if rhs := m.Attrs; rhs != nil { tmpContainer := make(map[string]string, len(rhs)) for k, v := range rhs { @@ -187,6 +189,9 @@ func (this *ExporterRequest) EqualVT(that *ExporterRequest) bool { return false } } + if this.Target != that.Target { + return false + } return string(this.unknownFields) == string(that.unknownFields) } @@ -333,6 +338,11 @@ func (m *ExporterRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.Target != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Target)) + i-- + dAtA[i] = 0x18 + } if len(m.Attrs) > 0 { for k := range m.Attrs { v := m.Attrs[k] @@ -421,6 +431,9 @@ func (m *ExporterRequest) SizeVT() (n int) { n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) } } + if m.Target != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.Target)) + } n += len(m.unknownFields) return n } @@ -909,6 +922,25 @@ func (m *ExporterRequest) UnmarshalVT(dAtA []byte) error { } m.Attrs[mapkey] = mapvalue iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) + } + m.Target = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Target |= control.ExporterTarget(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := protohelpers.Skip(dAtA[iNdEx:]) diff --git a/session/filesync/diffcopy.go b/session/filesync/diffcopy.go index 5e8b40b93d94..151f6f6e91fa 100644 --- a/session/filesync/diffcopy.go +++ b/session/filesync/diffcopy.go @@ -21,7 +21,7 @@ type Stream interface { RecvMsg(m any) error } -func newStreamWriter(stream grpc.ClientStream) io.WriteCloser { +func NewStreamWriter(stream grpc.ClientStream) io.WriteCloser { wc := &streamWriterCloser{ClientStream: stream} return &bufferedWriteCloser{Writer: bufio.NewWriter(wc), Closer: wc} } diff --git a/session/filesync/filesync.go b/session/filesync/filesync.go index 230493f1690f..d41fd7ff6262 100644 --- a/session/filesync/filesync.go +++ b/session/filesync/filesync.go @@ -412,7 +412,7 @@ func CopyFileWriter(ctx context.Context, md map[string]string, id int, c session return nil, errors.WithStack(err) } - return newStreamWriter(cc), nil + return NewStreamWriter(cc), nil } type InvalidSessionError struct { diff --git a/session/filesync/proxy.go b/session/filesync/proxy.go new file mode 100644 index 000000000000..388b6aabaf84 --- /dev/null +++ b/session/filesync/proxy.go @@ -0,0 +1,98 @@ +package filesync + +import ( + "context" + "fmt" + "io" + + "github.com/moby/buildkit/session" + "github.com/moby/buildkit/util/bklog" + "github.com/pkg/errors" + fstypes "github.com/tonistiigi/fsutil/types" + "golang.org/x/sync/errgroup" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +type ( + ProxyDiffCopy = proxySyncTarget[fstypes.Packet] + ProxyStreamWriter = proxySyncTarget[BytesMessage] +) + +// proxySyncTarget proxies messages send through the FileSend service to another +// session that exposes it. +type proxySyncTarget[Req any] struct { + Caller session.Caller + ExporterID int +} + +func (sp *proxySyncTarget[Req]) Register(server *grpc.Server) { + RegisterFileSendServer(server, sp) +} + +func (sp *proxySyncTarget[Req]) exportCtx(ctx context.Context) context.Context { + opts, ok := metadata.FromOutgoingContext(ctx) + if !ok { + opts = make(map[string][]string) + } + if existingVal, ok := opts[keyExporterID]; ok { + bklog.G(ctx).Warnf("overwriting grpc metadata key %q from value %+v to %+v", keyExporterID, existingVal, sp.ExporterID) + } + opts[keyExporterID] = []string{fmt.Sprint(sp.ExporterID)} + ctx = metadata.NewOutgoingContext(ctx, opts) + + return ctx +} + +func (sp *proxySyncTarget[Req]) DiffCopy(stream FileSend_DiffCopyServer) error { + method := session.MethodURL(FileSend_ServiceDesc.ServiceName, "diffcopy") + if !sp.Caller.Supports(method) { + return errors.Errorf("method %s not supported by the client", method) + } + + client := NewFileSendClient(sp.Caller.Conn()) + ctx := sp.exportCtx(stream.Context()) + + eg, ctx := errgroup.WithContext(ctx) + + cc, err := client.DiffCopy(ctx) + if err != nil { + return err + } + + eg.Go(func() error { + for { + var msg Req + err := stream.RecvMsg(&msg) + if errors.Is(err, io.EOF) { + return cc.CloseSend() + } + if err != nil { + return err + } + if err := cc.SendMsg(&msg); err != nil { + return err + } + } + }) + eg.Go(func() error { + for { + var msg Req + err := cc.RecvMsg(&msg) + if errors.Is(err, io.EOF) { + return nil + } + if err != nil { + return err + } + if err := stream.SendMsg(&msg); err != nil { + return err + } + } + }) + err = eg.Wait() + if err != nil { + cc.CloseSend() + } + return err +} diff --git a/solver/llbsolver/solver.go b/solver/llbsolver/solver.go index f5d6dc43c206..14170af81e32 100644 --- a/solver/llbsolver/solver.go +++ b/solver/llbsolver/solver.go @@ -19,6 +19,7 @@ import ( "github.com/moby/buildkit/client" controlgateway "github.com/moby/buildkit/control/gateway" "github.com/moby/buildkit/errdefs" + "github.com/moby/buildkit/executor" "github.com/moby/buildkit/executor/resources" resourcestypes "github.com/moby/buildkit/executor/resources/types" "github.com/moby/buildkit/exporter" @@ -193,8 +194,9 @@ func (s *Solver) recordBuildHistory(ctx context.Context, id string, req frontend for _, e := range exp.Exporters { rec.Exporters = append(rec.Exporters, &controlapi.Exporter{ - Type: e.Type(), - Attrs: e.Attrs(), + Type: e.Type(), + Attrs: e.Opts().Attrs, + Target: controlapi.ExporterTargetToPB(e.Opts().Target), }) } @@ -572,7 +574,7 @@ func (s *Solver) Solve(ctx context.Context, id string, sessionID string, req fro var err error select { case <-fwd.Done(): - res, err = fwd.Result() + res, err = fwd.Result(ctx) case <-ctx.Done(): err = context.Cause(ctx) } @@ -644,6 +646,17 @@ func (s *Solver) Solve(ctx context.Context, id string, sessionID string, req fro return nil, err } + expRes, err := result.ConvertResult(res, func(res solver.ResultProxy) (solver.ResultProxy, error) { + return solver.NopReleaseResultProxy(res), nil + }) + if err != nil { + return nil, err + } + src := &exporter.Source{ + Result: inp, + FrontendResult: expRes, + } + // Functions that create new objects in containerd (eg. content blobs) need to have a lease to ensure // that the object is not garbage collected immediately. This is protected by the indivual components, // but because creating a lease is not cheap and requires a disk write, we create a single lease here @@ -663,7 +676,7 @@ func (s *Solver) Solve(ctx context.Context, id string, sessionID string, req fro cacheExporters, inlineCacheExporter := splitCacheExporters(exp.CacheExporters) if exp.EnableSessionExporter { - exporters, err := s.getSessionExporters(ctx, j.SessionID, len(exp.Exporters), inp) + exporters, err := s.getSessionExporters(ctx, j.SessionID, len(exp.Exporters), src, req) if err != nil { return nil, err } @@ -671,7 +684,7 @@ func (s *Solver) Solve(ctx context.Context, id string, sessionID string, req fro } var exporterResponse map[string]string - exporterResponse, descrefs, err = s.runExporters(ctx, exp.Exporters, inlineCacheExporter, j, cached, inp) + exporterResponse, descrefs, err = s.runExporters(ctx, exp.Exporters, inlineCacheExporter, j, br, br, cached, src) if err != nil { return nil, err } @@ -701,7 +714,7 @@ func (s *Solver) Solve(ctx context.Context, id string, sessionID string, req fro }, nil } -func (s *Solver) getSessionExporters(ctx context.Context, sessionID string, id int, inp *exporter.Source) ([]exporter.ExporterInstance, error) { +func (s *Solver) getSessionExporters(ctx context.Context, sessionID string, id int, inp *exporter.Source, req frontend.SolveRequest) ([]exporter.ExporterInstance, error) { timeoutCtx, cancel := context.WithCancelCause(ctx) timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, 5*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet defer func() { cancel(errors.WithStack(context.Canceled)) }() @@ -740,12 +753,16 @@ func (s *Solver) getSessionExporters(ctx context.Context, sessionID string, id i } var out []exporter.ExporterInstance - for i, req := range res.Exporters { - exp, err := w.Exporter(req.Type, s.sm) + for i, expReq := range res.Exporters { + exp, err := w.Exporter(expReq.Type, s.sm) if err != nil { return nil, err } - expi, err := exp.Resolve(ctx, id+i, req.Attrs) + expi, err := exp.Resolve(ctx, id+i, exporter.ResolveOpts{ + Target: controlapi.ExporterTargetFromPB(expReq.Target), + Attrs: expReq.Attrs, + FrontendAttrs: req.FrontendOpt, + }) if err != nil { return nil, err } @@ -842,8 +859,8 @@ func runInlineCacheExporter(ctx context.Context, e exporter.ExporterInstance, in return res, done(err) } -func (s *Solver) runExporters(ctx context.Context, exporters []exporter.ExporterInstance, inlineCacheExporter inlineCacheExporter, job *solver.Job, cached *result.Result[solver.CachedResult], inp *exporter.Source) (exporterResponse map[string]string, descrefs []exporter.DescriptorReference, err error) { - warnings, err := verifier.CheckInvalidPlatforms(ctx, inp) +func (s *Solver) runExporters(ctx context.Context, exporters []exporter.ExporterInstance, inlineCacheExporter inlineCacheExporter, job *solver.Job, llbBridge frontend.FrontendLLBBridge, exec executor.Executor, cached *result.Result[solver.CachedResult], inp *exporter.Source) (exporterResponse map[string]string, descrefs []exporter.DescriptorReference, err error) { + warnings, err := verifier.CheckInvalidPlatforms(ctx, inp.Result) if err != nil { return nil, nil, err } @@ -875,7 +892,7 @@ func (s *Solver) runExporters(ctx context.Context, exporters []exporter.Exporter return runInlineCacheExporter(ctx, exp, inlineCacheExporter, job, cached) }) - resps[i], descs[i], err = exp.Export(ctx, inp, inlineCache, job.SessionID) + resps[i], descs[i], err = exp.Export(ctx, llbBridge, exec, inp, inlineCache, job.SessionID) if err != nil { return err } diff --git a/solver/result.go b/solver/result.go index e5f4b57e162a..539a41ebe072 100644 --- a/solver/result.go +++ b/solver/result.go @@ -131,3 +131,15 @@ func SplitResultProxy(res ResultProxy) (ResultProxy, ResultProxy) { sem := int64(0) return &splitResultProxy{ResultProxy: res, sem: &sem}, &splitResultProxy{ResultProxy: res, sem: &sem} } + +type nopReleaseResultProxy struct { + ResultProxy +} + +func (r *nopReleaseResultProxy) Release(ctx context.Context) error { + return nil +} + +func NopReleaseResultProxy(res ResultProxy) ResultProxy { + return &nopReleaseResultProxy{ResultProxy: res} +} diff --git a/util/testutil/integration/util.go b/util/testutil/integration/util.go index 1ebfed93aa2f..c88258807f9c 100644 --- a/util/testutil/integration/util.go +++ b/util/testutil/integration/util.go @@ -20,6 +20,11 @@ import ( "golang.org/x/sync/errgroup" ) +// BuildkitSourcePath is the path where buildkit source can be found. +// +// (keep in sync with hack/test) +const BuildkitSourcePath = "/mnt/buildkit" + var ErrRequirements = errors.Errorf("missing requirements") type TmpDirWithName struct { diff --git a/worker/base/worker.go b/worker/base/worker.go index 2cf738645b57..426d8be79df2 100644 --- a/worker/base/worker.go +++ b/worker/base/worker.go @@ -22,6 +22,7 @@ import ( "github.com/moby/buildkit/executor/resources" "github.com/moby/buildkit/exporter" imageexporter "github.com/moby/buildkit/exporter/containerimage" + gatewayexporter "github.com/moby/buildkit/exporter/gateway" localexporter "github.com/moby/buildkit/exporter/local" ociexporter "github.com/moby/buildkit/exporter/oci" tarexporter "github.com/moby/buildkit/exporter/tar" @@ -265,6 +266,15 @@ func (w *Worker) Labels() map[string]string { return w.WorkerOpt.Labels } +func (w *Worker) Info() client.WorkerInfo { + return client.WorkerInfo{ + ID: w.ID(), + Labels: w.Labels(), + Platforms: w.Platforms(false), + BuildkitVersion: w.BuildkitVersion(), + } +} + func (w *Worker) Platforms(noCache bool) []ocispecs.Platform { if noCache { matchers := make([]platforms.MatchComparer, len(w.WorkerOpt.Platforms)) @@ -509,6 +519,13 @@ func (w *Worker) Prune(ctx context.Context, ch chan client.UsageInfo, opt ...cli func (w *Worker) Exporter(name string, sm *session.Manager) (exporter.Exporter, error) { switch name { + case client.ExporterGateway: + return gatewayexporter.New(gatewayexporter.Opt{ + SessionManager: sm, + ImageWriter: w.imageWriter, + LeaseManager: w.LeaseManager(), + WorkerInfo: w.Info(), + }) case client.ExporterImage: return imageexporter.New(imageexporter.Opt{ Images: w.ImageStore,