From b3ad61e1805a9f9733cac87c5b5dea886aa08dfe Mon Sep 17 00:00:00 2001 From: Will Browne Date: Wed, 15 Nov 2023 16:53:30 +0100 Subject: [PATCH] Plugins: Add plugin version field to proto interface (#78213) add plugin version --- pkg/plugins/backendplugin/grpcplugin/client_proto.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/plugins/backendplugin/grpcplugin/client_proto.go b/pkg/plugins/backendplugin/grpcplugin/client_proto.go index af18a2b092f..5326cf3ba8b 100644 --- a/pkg/plugins/backendplugin/grpcplugin/client_proto.go +++ b/pkg/plugins/backendplugin/grpcplugin/client_proto.go @@ -26,19 +26,22 @@ type ProtoClient interface { PID() (string, error) PluginID() string + PluginVersion() string Logger() log.Logger Start(context.Context) error Stop(context.Context) error } type protoClient struct { - plugin *grpcPlugin + plugin *grpcPlugin + pluginVersion string mu sync.RWMutex } type ProtoClientOpts struct { PluginID string + PluginVersion string ExecutablePath string ExecutableArgs []string Env []string @@ -58,7 +61,7 @@ func NewProtoClient(opts ProtoClientOpts) (ProtoClient, error) { func() []string { return opts.Env }, ) - return &protoClient{plugin: p}, nil + return &protoClient{plugin: p, pluginVersion: opts.PluginVersion}, nil } func (r *protoClient) PID() (string, error) { @@ -72,6 +75,10 @@ func (r *protoClient) PluginID() string { return r.plugin.descriptor.pluginID } +func (r *protoClient) PluginVersion() string { + return r.pluginVersion +} + func (r *protoClient) Logger() log.Logger { return r.plugin.logger }