From abe03c42066e319f5a1c9f64990b9b55802239fd Mon Sep 17 00:00:00 2001 From: Mike Fridman Date: Fri, 25 Oct 2024 13:19:40 -0400 Subject: [PATCH] Add deprecated field to curated plugin --- .../beta/registry/plugin/pluginpush/pluginpush.go | 1 + .../bufremotepluginconfig.go | 3 +++ .../bufremotepluginconfig_test.go | 1 + .../bufremotepluginconfig/config.go | 1 + .../testdata/success/go/buf.plugin.yaml | 1 + .../alpha/registry/v1alpha1/plugin_curation.pb.go | 15 +++++++++++++-- .../alpha/registry/v1alpha1/plugin_curation.proto | 2 ++ 7 files changed, 22 insertions(+), 2 deletions(-) diff --git a/private/buf/cmd/buf/command/beta/registry/plugin/pluginpush/pluginpush.go b/private/buf/cmd/buf/command/beta/registry/plugin/pluginpush/pluginpush.go index 904768431a..ea46bc8357 100644 --- a/private/buf/cmd/buf/command/beta/registry/plugin/pluginpush/pluginpush.go +++ b/private/buf/cmd/buf/command/beta/registry/plugin/pluginpush/pluginpush.go @@ -345,6 +345,7 @@ func createCuratedPluginRequest( LicenseUrl: pluginConfig.LicenseURL, Visibility: visibility, IntegrationGuideUrl: pluginConfig.IntegrationGuideURL, + Deprecated: pluginConfig.Deprecated, }, nil } diff --git a/private/bufpkg/bufremoteplugin/bufremotepluginconfig/bufremotepluginconfig.go b/private/bufpkg/bufremoteplugin/bufremotepluginconfig/bufremotepluginconfig.go index d21f5247ad..6ddf2bab10 100644 --- a/private/bufpkg/bufremoteplugin/bufremotepluginconfig/bufremotepluginconfig.go +++ b/private/bufpkg/bufremoteplugin/bufremotepluginconfig/bufremotepluginconfig.go @@ -81,6 +81,8 @@ type Config struct { // IntegrationGuideURL is an optional attribute used to specify where // the plugin integration guide can be found. IntegrationGuideURL string + // Deprecated specifies whether the plugin is deprecated. + Deprecated bool } // RegistryConfig is the configuration for the registry of a plugin. @@ -407,6 +409,7 @@ type ExternalConfig struct { SPDXLicenseID string `json:"spdx_license_id,omitempty" yaml:"spdx_license_id,omitempty"` LicenseURL string `json:"license_url,omitempty" yaml:"license_url,omitempty"` IntegrationGuideURL string `json:"integration_guide_url,omitempty" yaml:"integration_guide_url,omitempty"` + Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` } // ExternalDependency represents a dependency on another plugin. diff --git a/private/bufpkg/bufremoteplugin/bufremotepluginconfig/bufremotepluginconfig_test.go b/private/bufpkg/bufremoteplugin/bufremotepluginconfig/bufremotepluginconfig_test.go index ecb3da3032..85abc3b1cf 100644 --- a/private/bufpkg/bufremoteplugin/bufremotepluginconfig/bufremotepluginconfig_test.go +++ b/private/bufpkg/bufremoteplugin/bufremotepluginconfig/bufremotepluginconfig_test.go @@ -68,6 +68,7 @@ func TestGetConfigForBucket(t *testing.T) { SPDXLicenseID: "Apache-2.0", LicenseURL: "https://github.com/grpc/grpc-go/blob/master/LICENSE", IntegrationGuideURL: "https://grpc.io/docs/languages/go/quickstart", + Deprecated: true, }, pluginConfig, ) diff --git a/private/bufpkg/bufremoteplugin/bufremotepluginconfig/config.go b/private/bufpkg/bufremoteplugin/bufremotepluginconfig/config.go index 378b19960b..f5e77e372b 100644 --- a/private/bufpkg/bufremoteplugin/bufremotepluginconfig/config.go +++ b/private/bufpkg/bufremoteplugin/bufremotepluginconfig/config.go @@ -83,6 +83,7 @@ func newConfig(externalConfig ExternalConfig, options []ConfigOption) (*Config, SPDXLicenseID: spdxLicenseID, LicenseURL: externalConfig.LicenseURL, IntegrationGuideURL: externalConfig.IntegrationGuideURL, + Deprecated: externalConfig.Deprecated, }, nil } diff --git a/private/bufpkg/bufremoteplugin/bufremotepluginconfig/testdata/success/go/buf.plugin.yaml b/private/bufpkg/bufremoteplugin/bufremotepluginconfig/testdata/success/go/buf.plugin.yaml index dfd2d07760..1b50956964 100644 --- a/private/bufpkg/bufremoteplugin/bufremotepluginconfig/testdata/success/go/buf.plugin.yaml +++ b/private/bufpkg/bufremoteplugin/bufremotepluginconfig/testdata/success/go/buf.plugin.yaml @@ -18,3 +18,4 @@ registry: spdx_license_id: Apache-2.0 license_url: https://github.com/grpc/grpc-go/blob/master/LICENSE integration_guide_url: https://grpc.io/docs/languages/go/quickstart +deprecated: true diff --git a/private/gen/proto/go/buf/alpha/registry/v1alpha1/plugin_curation.pb.go b/private/gen/proto/go/buf/alpha/registry/v1alpha1/plugin_curation.pb.go index d05c78ff80..91b67849e2 100644 --- a/private/gen/proto/go/buf/alpha/registry/v1alpha1/plugin_curation.pb.go +++ b/private/gen/proto/go/buf/alpha/registry/v1alpha1/plugin_curation.pb.go @@ -1874,6 +1874,8 @@ type CreateCuratedPluginRequest struct { Visibility CuratedPluginVisibility `protobuf:"varint,17,opt,name=visibility,proto3,enum=buf.alpha.registry.v1alpha1.CuratedPluginVisibility" json:"visibility,omitempty"` // The URL leading to the integration guide of the plugin, if available. IntegrationGuideUrl string `protobuf:"bytes,18,opt,name=integration_guide_url,json=integrationGuideUrl,proto3" json:"integration_guide_url,omitempty"` + // The deprecation status of the plugin. + Deprecated bool `protobuf:"varint,19,opt,name=deprecated,proto3" json:"deprecated,omitempty"` } func (x *CreateCuratedPluginRequest) Reset() { @@ -2011,6 +2013,13 @@ func (x *CreateCuratedPluginRequest) GetIntegrationGuideUrl() string { return "" } +func (x *CreateCuratedPluginRequest) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + type CreateCuratedPluginResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3571,7 +3580,7 @@ var file_buf_alpha_registry_v1alpha1_plugin_curation_proto_rawDesc = []byte{ 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x1d, 0x0a, 0x1b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa3, 0x06, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xc3, 0x06, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, @@ -3621,7 +3630,9 @@ var file_buf_alpha_registry_v1alpha1_plugin_curation_proto_rawDesc = []byte{ 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x32, 0x0a, 0x15, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x67, 0x75, 0x69, 0x64, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x47, 0x75, 0x69, 0x64, 0x65, 0x55, 0x72, 0x6c, 0x22, 0x6f, 0x0a, 0x1b, 0x43, 0x72, + 0x6f, 0x6e, 0x47, 0x75, 0x69, 0x64, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, + 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, + 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x22, 0x6f, 0x0a, 0x1b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x75, 0x72, 0x61, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, diff --git a/proto/buf/alpha/registry/v1alpha1/plugin_curation.proto b/proto/buf/alpha/registry/v1alpha1/plugin_curation.proto index 3903832fe0..9e05098ddb 100644 --- a/proto/buf/alpha/registry/v1alpha1/plugin_curation.proto +++ b/proto/buf/alpha/registry/v1alpha1/plugin_curation.proto @@ -502,6 +502,8 @@ message CreateCuratedPluginRequest { CuratedPluginVisibility visibility = 17; // The URL leading to the integration guide of the plugin, if available. string integration_guide_url = 18; + // The deprecation status of the plugin. + bool deprecated = 19; } message CreateCuratedPluginResponse {