From d9cae66d8d727db4806d453a5bdc0023d8248bb4 Mon Sep 17 00:00:00 2001 From: kiashok Date: Wed, 7 Feb 2024 11:14:12 -0800 Subject: [PATCH 1/2] Extend string match in make protos Signed-off-by: kiashok --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index dad5b1cb4..5cb6172a8 100644 --- a/Makefile +++ b/Makefile @@ -182,6 +182,7 @@ protos: bin/protoc-gen-go-fieldpath find v2 -name '*.pb.go' -exec sh -c 'f={}; mkdir -p $$(dirname "$${f#v2/}"); echo mv $$f $${f#v2/}; mv $$f $${f#v2/}' \; @mv ${TMPDIR}/vendor ${ROOTDIR} @rm -rf ${TMPDIR} v2 + go-fix-acronym -w -a '^Os' $(shell find api/ core/runtime/ -name '*.pb.go') go-fix-acronym -w -a '(Id|Io|Uuid|Os)$$' $(shell find api/ core/runtime/ -name '*.pb.go') check-protos: protos ## check if protobufs needs to be generated again From 5aa05481ddd40138eef79ec4bce2b0232adef354 Mon Sep 17 00:00:00 2001 From: kiashok Date: Wed, 7 Feb 2024 10:07:26 -0800 Subject: [PATCH 2/2] Add OSVersion to platform protobuf It also extends the functions in api/types/platform_helpers.go Signed-off-by: kiashok --- api/next.pb.txt | 7 +++++++ api/types/platform.pb.go | 22 ++++++++++++++++------ api/types/platform.proto | 1 + api/types/platform_helpers.go | 2 ++ 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/api/next.pb.txt b/api/next.pb.txt index 0519c7647..4e5795c73 100644 --- a/api/next.pb.txt +++ b/api/next.pb.txt @@ -881,6 +881,13 @@ file { type: TYPE_STRING json_name: "variant" } + field { + name: "os_version" + number: 4 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "osVersion" + } } options { go_package: "github.com/containerd/containerd/v2/api/types;types" diff --git a/api/types/platform.pb.go b/api/types/platform.pb.go index 5162fe689..4c14d3e11 100644 --- a/api/types/platform.pb.go +++ b/api/types/platform.pb.go @@ -45,6 +45,7 @@ type Platform struct { OS string `protobuf:"bytes,1,opt,name=os,proto3" json:"os,omitempty"` Architecture string `protobuf:"bytes,2,opt,name=architecture,proto3" json:"architecture,omitempty"` Variant string `protobuf:"bytes,3,opt,name=variant,proto3" json:"variant,omitempty"` + OSVersion string `protobuf:"bytes,4,opt,name=os_version,json=osVersion,proto3" json:"os_version,omitempty"` } func (x *Platform) Reset() { @@ -100,6 +101,13 @@ func (x *Platform) GetVariant() string { return "" } +func (x *Platform) GetOsVersion() string { + if x != nil { + return x.OSVersion + } + return "" +} + var File_github_com_containerd_containerd_api_types_platform_proto protoreflect.FileDescriptor var file_github_com_containerd_containerd_api_types_platform_proto_rawDesc = []byte{ @@ -107,17 +115,19 @@ var file_github_com_containerd_containerd_api_types_platform_proto_rawDesc = []b 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0x58, 0x0a, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x22, 0x77, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x6f, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x72, 0x63, 0x68, 0x69, 0x74, 0x65, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x72, 0x63, 0x68, 0x69, 0x74, 0x65, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, - 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x76, 0x32, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x73, 0x5f, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x73, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x64, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/types/platform.proto b/api/types/platform.proto index 85e2ecb45..9d76b9e3c 100644 --- a/api/types/platform.proto +++ b/api/types/platform.proto @@ -26,4 +26,5 @@ message Platform { string os = 1; string architecture = 2; string variant = 3; + string os_version = 4; } diff --git a/api/types/platform_helpers.go b/api/types/platform_helpers.go index 7e662e9bb..d8c1a6877 100644 --- a/api/types/platform_helpers.go +++ b/api/types/platform_helpers.go @@ -25,6 +25,7 @@ func OCIPlatformToProto(platforms []oci.Platform) []*Platform { for i := range platforms { ap[i] = &Platform{ OS: platforms[i].OS, + OSVersion: platforms[i].OSVersion, Architecture: platforms[i].Architecture, Variant: platforms[i].Variant, } @@ -39,6 +40,7 @@ func OCIPlatformFromProto(platforms []*Platform) []oci.Platform { for i := range platforms { op[i] = oci.Platform{ OS: platforms[i].OS, + OSVersion: platforms[i].OSVersion, Architecture: platforms[i].Architecture, Variant: platforms[i].Variant, }