Skip to content

Refactor getter for invoke - #7

Merged
gjenkins8 merged 2 commits into
scottrigby:plugin-integrationfrom
gjenkins8:gjenkins/plugin-integration/convert_getter
Jul 30, 2025
Merged

gjenkins8 merged 2 commits into
scottrigby:plugin-integrationfrom
gjenkins8:gjenkins/plugin-integration/convert_getter

Conversation

@gjenkins8

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:

Special notes for your reviewer:

If applicable:

  • this PR contains user facing changes (the docs needed label should be applied if so)
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

Signed-off-by: George Jenkins <[email protected]>

@scottrigby scottrigby left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like the getter refactor changes part. some thoughts and questions

Comment thread pkg/getter/plugingetter.go Outdated

// Get runs downloader plugin command
func (p *pluginGetter) Get(href string, options ...Option) (*bytes.Buffer, error) {
func convertOptions(globalOptions, options []Option) (schema.GetterOptionsV1, error) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete the plugin.ExecDownloader func in this PR, since you're removing the only call to it

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(deleted)

Comment thread pkg/cmd/load_plugins.go

// Invoke plugin
err = plug.Invoke(os.Stdin, out, os.Stderr, env)
_, err = plug.Invoke(context.Background(), &plugin.Input{Stdin: os.Stdin, Stdout: out, Stderr: os.Stderr})

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you opt to add stdout and stderr to Input rather than Output struct? My thought was it would be:

type Input struct {
        // the plugin type-specific  versioned message struct
	Message any
	Stdin io.Reader
}

type Output struct {
        Message any
	Stdout, Stderr io.Writer
}

and to be clear, i was thinking Invoke() would add Output as a param too, and error would be the only return value.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Input" and "Output" here, is input parameters from the caller, and output parameters from the plugin (respectively). Think request and response.

Confusingly, e.g. stdout is an input the caller has to provide (it has to provide its stdout stream). Then the stream carries the actual output data from the plugin. ie. the plugin isn't responding with a stdout stream, it is using the callers stdout stream.

I used the terminology "Input" and "Output" when I was thinking callers would be passing data "messages" only (in the https://en.wikipedia.org/wiki/Message_passing sense). Not sure if there is some better terminology than "Input" and "Output" (I was trying to avoid "request" / "response")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and to be clear, i was thinking Invoke() would add Output as a param too, and error would be the only return value.

Loosely, I took inspiration from https://pkg.go.dev/net/http#RoundTripper (context should be a function parameter as well, it isn't on round tripper for legacy reasons)

Comment thread pkg/plugin/plugin.go
Stdin io.Reader

// Optional: Writers to consume the plugin's "stdout" and "stderr"
Stdout, Stderr io.Writer

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was considering stdout could perhaps be io.ReadWriter for postrender plugins. But did you get postrender plugins to work with this as it is now? I see all the postrender tests are commented out.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Postrenderer I want to update in a new PR. Trying to chunk through one thing at a time.

You can't read from Stdout, so not sure how/why io.ReadWriter would come into play here?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that for postrender we need somewhere to read from and write back to. In the most recent working version on (before #3 was merged) Runtime Postrender gets renderedManifests passed as *bytes.Buffer pointer so the value can be modified. We can get into it more when fixing/re-implementing postrenderer plugin type with these interface changes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right -- we can just pass buffer(s) via the input/output "messages"

Comment thread pkg/plugin/runtime_subprocess.go Outdated
return r.InvokeWithEnv(main, args, env, stdin, stdout, stderr)
return convertOutput(buf), nil

//main, args, err := PrepareCommands(cmds, true, r.extraArgs)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we handle extraArgs if we're removing these PrepareCommands()? I don't think that is addressed in #3 or this PR?

It merges extraArgs into any arguments supplied in the plugin. It
returns the main command and an args array.

Comment thread pkg/plugin/runtime_subprocess.go Outdated
Comment on lines +33 to +39
// Downloaders represents the plugins capability if it can retrieve
// charts from
type SubprocessDownloaders struct {
// Protocols are the list of schemes from the charts URL.
Protocols []string `json:"protocols"`
// Command is the executable path with which the plugin performs
// the actual download for the corresponding Protocols
Command string `json:"command"`

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thinking we should change references to "downloaders" here, since we're changing the plugin type name.

Suggested change
// Downloaders represents the plugins capability if it can retrieve
// charts from
type SubprocessDownloaders struct {
// Protocols are the list of schemes from the charts URL.
Protocols []string `json:"protocols"`
// Command is the executable path with which the plugin performs
// the actual download for the corresponding Protocols
Command string `json:"command"`
// SubprocessGetterCommands represents a list of subprocess commands for a getter
// plugin, each of which handles one or more protocols defined by the plugin config
type SubprocessGetterCommands struct {
// Protocols are the list of schemes handled by this command
Protocols []string `json:"protocols"`
// Command is the executable path used to handle the protocols
// the actual download for the corresponding Protocols
Command string `json:"command"`

Comment thread pkg/plugin/runtime_subprocess.go Outdated

// Downloaders field is used if the plugin supply downloader mechanism
// for special protocols.
Downloaders []SubprocessDownloaders `json:"downloaders"`

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

Suggested change
Downloaders []SubprocessDownloaders `json:"downloaders"`
GetterCommands [] SubprocessGetterCommands `json:"getterCommands"`

prog.Stdout = buf
prog.Stderr = os.Stderr

func executeCmd(prog *exec.Cmd, pluginName string) error {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we've stopped passing env here, we no longer set prog.Env = env before prog.Run(). Is this handled another way somewhere?

Comment thread pkg/plugin/runtime_subprocess_getter.go Outdated
Comment on lines +30 to +33
func getProtocolDownloader(downloaders []SubprocessDownloaders, protocol string) *SubprocessDownloaders {
for _, d := range downloaders {
if slices.Contains(d.Protocols, protocol) {
return &d

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above. we really just need the command here, and there should only be one. may be good idea to error if more than one command is found for a protocol.

Suggested change
func getProtocolDownloader(downloaders []SubprocessDownloaders, protocol string) *SubprocessDownloaders {
for _, d := range downloaders {
if slices.Contains(d.Protocols, protocol) {
return &d
func getProtocolCommand(getterCommands []SubprocessGetterCommands, protocol string) string{
for _, d := range getterCommands {
if slices.Contains(d.Protocols, protocol) {
return d.Command

Comment thread pkg/getter/plugingetter_test.go Outdated
t.Errorf("Expected %q, got %q", expect, got)
}
}
// func TestPluginGetter(t *testing.T) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i get that you want to fix post render plugins with the updated interfaces in a separate PR, but we should get this one working in this PR, yes?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(test was added)

Comment thread pkg/plugin/schema/getter.go Outdated
Timeout time.Duration
}

type GetterInputV1 struct {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about this?

Suggested change
type GetterInputV1 struct {
type InputMessageGetterV1 struct {

And then also version type ConfigGetter struct to type ConfigGetterV1 struct(to match plugin type stringgetter/v1`. and likewise version all the other ConfigTYPE implementations)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(updated name)

Signed-off-by: George Jenkins <[email protected]>
@gjenkins8
gjenkins8 force-pushed the gjenkins/plugin-integration/convert_getter branch from f8f0c7f to 5ff30f0 Compare July 30, 2025 06:32
@gjenkins8
gjenkins8 merged commit 2024c69 into scottrigby:plugin-integration Jul 30, 2025
@gjenkins8
gjenkins8 deleted the gjenkins/plugin-integration/convert_getter branch July 30, 2025 19:58
scottrigby added a commit that referenced this pull request Aug 2, 2025
scottrigby added a commit that referenced this pull request Aug 4, 2025
gjenkins8 pushed a commit that referenced this pull request Aug 16, 2025
…mand type flag

Signed-off-by: Scott Rigby <[email protected]>

TODO for execRender

Signed-off-by: Scott Rigby <[email protected]>

Replace --post-renderer arbitrary binary execution with plugin of type postrender

Signed-off-by: Scott Rigby <[email protected]>

Note this old todo for moving postrenderer to plugin system is now complete:

	// NOTE(thomastaylor312): I am leaving this code commented out here. During
	// the implementation of post-render, it was brought up that if we are
	// relying on plugins, we should actually use the plugin system so it can
	// properly handle multiple OSs. This will be a feature add in the future,
	// so I left this code for reference. It can be deleted or reused once the
	// feature is implemented

Signed-off-by: Scott Rigby <[email protected]>

Move postrenderer package to plugins. combine and fix tests

Signed-off-by: Scott Rigby <[email protected]>

Fix references to pkg/plugin

Signed-off-by: Scott Rigby <[email protected]>

Fix TestPostRendererFlagSetOnce test

Signed-off-by: Scott Rigby <[email protected]>

Fix TestLoadPluginsForCompletion

Signed-off-by: Scott Rigby <[email protected]>

Fix TestLoadPlugins

Signed-off-by: Scott Rigby <[email protected]>

Fix linting

Signed-off-by: Scott Rigby <[email protected]>

List and use legacy plugins using the same Plugin struct and removing unmarshall strict

Signed-off-by: Scott Rigby <[email protected]>

Add Plugin interface in front of PluginLegacy and Pluginv1

Signed-off-by: Scott Rigby <[email protected]>

Disambiguate API version legacy from type. There is no more legacy type (legacy plugins are either cli or download)

Signed-off-by: Scott Rigby <[email protected]>

Validate PluginV1

Signed-off-by: Scott Rigby <[email protected]>

Add apiVersion to test data

fix nil pointer dereference for tests

Signed-off-by: Scott Rigby <[email protected]>

TODO for testing

Signed-off-by: Scott Rigby <[email protected]>

Comments and TODOs

Signed-off-by: Scott Rigby <[email protected]>

Try Plugin Config interface and Config implementations per plugin type

Signed-off-by: Scott Rigby <[email protected]>

Add Runtime and RuntimeConfig interfaces, and implement per runtime (subprocess and Wasm). Move fields to the applicable config structs. TODO update tests and testdata YAML to match

Signed-off-by: Scott Rigby <[email protected]>

Attempt to reorganize fields to make sense on new structs, YAML to match, and update tests to match

Signed-off-by: Scott Rigby <[email protected]>

pkg/plugin tests pass

Signed-off-by: Scott Rigby <[email protected]>

Fix TestLoadPlugins. All tests pass now

Signed-off-by: Scott Rigby <[email protected]>

Do not attept to unmarshall into PluginLegacy if apiVersion is present but with the wrong value. Give better error instead

Signed-off-by: Scott Rigby <[email protected]>

Remove legacy field fallback for PluginV1. Users should update their plugin.yaml fully if they set apiVersion to v1

Signed-off-by: Scott Rigby <[email protected]>

Reorganize code into separate files for better readability

Signed-off-by: Scott Rigby <[email protected]>

fix runHook

Signed-off-by: Scott Rigby <[email protected]>

Add plugin sourceURL

Signed-off-by: Scott Rigby <[email protected]>

Change CLI plugin config to match cobra options

Signed-off-by: Scott Rigby <[email protected]>

Fix tests after updating shortHelp, longHelp and usage fields

Signed-off-by: Scott Rigby <[email protected]>

add missing newlines at EOF

Signed-off-by: Scott Rigby <[email protected]>

Unsuccessful attempt at consolidating all subprocess funcs into Runtime.Invoke. Tests pass but functionality doesn't work. Keeping for reference to ideas but will revert in next commit

Signed-off-by: Scott Rigby <[email protected]>

Revert "Unsuccessful attempt at consolidating all subprocess funcs into Runtime.Invoke. Tests pass but functionality doesn't work. Keeping for reference to ideas but will revert in next commit"

This reverts commit 842b1b3.

Fix regression from a3bc64a that prevented legacy CLI plugins from loading

Signed-off-by: Scott Rigby <[email protected]>

move all direct os/exec calls from any code outside pkg/plugin

Signed-off-by: Scott Rigby <[email protected]>

change all calls to exec funcs in pkg/plugin/exec.go to now use new invoke methods

Signed-off-by: Scott Rigby <[email protected]>

move runtime-specific code from runtime.go into separate files for better organization

Signed-off-by: Scott Rigby <[email protected]>

Fix gofmt

Signed-off-by: Scott Rigby <[email protected]>

Update TODOs and comments

Signed-off-by: Scott Rigby <[email protected]>

More TODOs

Signed-off-by: Scott Rigby <[email protected]>

execHook is only used within the package. don't export. consolidate with other funcs later

Signed-off-by: Scott Rigby <[email protected]>

Refactor the Postrenderer interface to use a runtime-agnostic factory pattern

Signed-off-by: Scott Rigby <[email protected]>

Add new Runtime.Postrender method to better organize runtime-specific logic for postrender type plugins

Signed-off-by: Scott Rigby <[email protected]>

Consolidate remaining exec functions into runtime_subprocess.go. Keep chipping away at them

Signed-off-by: Scott Rigby <[email protected]>

rename ExecError to plugin.Error. it's not only for exec

Signed-off-by: Scott Rigby <[email protected]>

Simplify to use just Runtime.Invoke

Signed-off-by: Scott Rigby <[email protected]>

move execHook into RuntimeSubprocess.InvokeHook

Signed-off-by: Scott Rigby <[email protected]>

Remove unused Plugin.GetRuntime

Signed-off-by: Scott Rigby <[email protected]>

Rename Plugin.GetMetadata method to Metadata

Signed-off-by: Scott Rigby <[email protected]>

Create Metadata interface. Move GetConfig, GetRuntimeConfig, GetAPIVersion, GetName, and GetType methods from Plugin to Metadata interface

Signed-off-by: Scott Rigby <[email protected]>

Shorten Plugin.GetRuntimeInstance to Plugin.Runtime

Signed-off-by: Scott Rigby <[email protected]>

Shorten RuntimeConfig.GetRuntimeType and Config.GetType to just Type

Signed-off-by: Scott Rigby <[email protected]>

Move Invoke to Plugin (and for now invoke-like commands, until we merge them). Remove old PrepareCommand properly (handle ignoreFlags). As of now clients are expected to account for the ignore flag. Un-export Runtime methods

Signed-off-by: Scott Rigby <[email protected]>

Change LoadDir to switch. Deliberately not adding conversion function

Signed-off-by: Scott Rigby <[email protected]>

Fix Load all return and error

Signed-off-by: Scott Rigby <[email protected]>

Fix some semantics. Avoid yaml package name conflict

Signed-off-by: Scott Rigby <[email protected]>

Change reflect.DeepEqual to assert.Equal for Plugin.Metadata

Signed-off-by: Scott Rigby <[email protected]>

Add more robust plugin find criteria with findFunc and filterFunc pattern

Co-authored-by: George Jenkins <[email protected]>

Signed-off-by: Scott Rigby <[email protected]>

Integrate PR #7 into old interfaces

Signed-off-by: Scott Rigby <[email protected]>

Finish integrating #7 into orig interfaces. Tests all pass ✅

Signed-off-by: Scott Rigby <[email protected]>

Integrate draft PR Convert post-renderer to invoke #9

Signed-off-by: Scott Rigby <[email protected]>

revert back to postrenderER (for the record I dislike this, but agree it's consistent)

Signed-off-by: Scott Rigby <[email protected]>

Change some naming

Signed-off-by: Scott Rigby <[email protected]>

Fix make test-style (goimports/golangci-lint) errors

Signed-off-by: Scott Rigby <[email protected]>

OCI installer for plugins

Signed-off-by: Scott Rigby <[email protected]>

Simplify. We only want to support tarballs. This is the only reliable way to preserve file mode for executables

Signed-off-by: Scott Rigby <[email protected]>

Update pkg/getter/ocigetter to work for both charts and plugins, and update plugin OCI installer accordingly

Signed-off-by: Scott Rigby <[email protected]>

Plugin runtime support (#15)

Fix linting issues (#18)

Extism/v1 plugin runtime support (#17)

Fix legacy metadata downloader convert

lint

Move pkg/plugins -> internal/plugin (#16)
gjenkins8 pushed a commit that referenced this pull request Aug 16, 2025
…mand type flag

Signed-off-by: Scott Rigby <[email protected]>

TODO for execRender

Signed-off-by: Scott Rigby <[email protected]>

Replace --post-renderer arbitrary binary execution with plugin of type postrender

Signed-off-by: Scott Rigby <[email protected]>

Note this old todo for moving postrenderer to plugin system is now complete:

	// NOTE(thomastaylor312): I am leaving this code commented out here. During
	// the implementation of post-render, it was brought up that if we are
	// relying on plugins, we should actually use the plugin system so it can
	// properly handle multiple OSs. This will be a feature add in the future,
	// so I left this code for reference. It can be deleted or reused once the
	// feature is implemented

Signed-off-by: Scott Rigby <[email protected]>

Move postrenderer package to plugins. combine and fix tests

Signed-off-by: Scott Rigby <[email protected]>

Fix references to pkg/plugin

Signed-off-by: Scott Rigby <[email protected]>

Fix TestPostRendererFlagSetOnce test

Signed-off-by: Scott Rigby <[email protected]>

Fix TestLoadPluginsForCompletion

Signed-off-by: Scott Rigby <[email protected]>

Fix TestLoadPlugins

Signed-off-by: Scott Rigby <[email protected]>

Fix linting

Signed-off-by: Scott Rigby <[email protected]>

List and use legacy plugins using the same Plugin struct and removing unmarshall strict

Signed-off-by: Scott Rigby <[email protected]>

Add Plugin interface in front of PluginLegacy and Pluginv1

Signed-off-by: Scott Rigby <[email protected]>

Disambiguate API version legacy from type. There is no more legacy type (legacy plugins are either cli or download)

Signed-off-by: Scott Rigby <[email protected]>

Validate PluginV1

Signed-off-by: Scott Rigby <[email protected]>

Add apiVersion to test data

fix nil pointer dereference for tests

Signed-off-by: Scott Rigby <[email protected]>

TODO for testing

Signed-off-by: Scott Rigby <[email protected]>

Comments and TODOs

Signed-off-by: Scott Rigby <[email protected]>

Try Plugin Config interface and Config implementations per plugin type

Signed-off-by: Scott Rigby <[email protected]>

Add Runtime and RuntimeConfig interfaces, and implement per runtime (subprocess and Wasm). Move fields to the applicable config structs. TODO update tests and testdata YAML to match

Signed-off-by: Scott Rigby <[email protected]>

Attempt to reorganize fields to make sense on new structs, YAML to match, and update tests to match

Signed-off-by: Scott Rigby <[email protected]>

pkg/plugin tests pass

Signed-off-by: Scott Rigby <[email protected]>

Fix TestLoadPlugins. All tests pass now

Signed-off-by: Scott Rigby <[email protected]>

Do not attept to unmarshall into PluginLegacy if apiVersion is present but with the wrong value. Give better error instead

Signed-off-by: Scott Rigby <[email protected]>

Remove legacy field fallback for PluginV1. Users should update their plugin.yaml fully if they set apiVersion to v1

Signed-off-by: Scott Rigby <[email protected]>

Reorganize code into separate files for better readability

Signed-off-by: Scott Rigby <[email protected]>

fix runHook

Signed-off-by: Scott Rigby <[email protected]>

Add plugin sourceURL

Signed-off-by: Scott Rigby <[email protected]>

Change CLI plugin config to match cobra options

Signed-off-by: Scott Rigby <[email protected]>

Fix tests after updating shortHelp, longHelp and usage fields

Signed-off-by: Scott Rigby <[email protected]>

add missing newlines at EOF

Signed-off-by: Scott Rigby <[email protected]>

Unsuccessful attempt at consolidating all subprocess funcs into Runtime.Invoke. Tests pass but functionality doesn't work. Keeping for reference to ideas but will revert in next commit

Signed-off-by: Scott Rigby <[email protected]>

Revert "Unsuccessful attempt at consolidating all subprocess funcs into Runtime.Invoke. Tests pass but functionality doesn't work. Keeping for reference to ideas but will revert in next commit"

This reverts commit 842b1b3.

Fix regression from a3bc64a that prevented legacy CLI plugins from loading

Signed-off-by: Scott Rigby <[email protected]>

move all direct os/exec calls from any code outside pkg/plugin

Signed-off-by: Scott Rigby <[email protected]>

change all calls to exec funcs in pkg/plugin/exec.go to now use new invoke methods

Signed-off-by: Scott Rigby <[email protected]>

move runtime-specific code from runtime.go into separate files for better organization

Signed-off-by: Scott Rigby <[email protected]>

Fix gofmt

Signed-off-by: Scott Rigby <[email protected]>

Update TODOs and comments

Signed-off-by: Scott Rigby <[email protected]>

More TODOs

Signed-off-by: Scott Rigby <[email protected]>

execHook is only used within the package. don't export. consolidate with other funcs later

Signed-off-by: Scott Rigby <[email protected]>

Refactor the Postrenderer interface to use a runtime-agnostic factory pattern

Signed-off-by: Scott Rigby <[email protected]>

Add new Runtime.Postrender method to better organize runtime-specific logic for postrender type plugins

Signed-off-by: Scott Rigby <[email protected]>

Consolidate remaining exec functions into runtime_subprocess.go. Keep chipping away at them

Signed-off-by: Scott Rigby <[email protected]>

rename ExecError to plugin.Error. it's not only for exec

Signed-off-by: Scott Rigby <[email protected]>

Simplify to use just Runtime.Invoke

Signed-off-by: Scott Rigby <[email protected]>

move execHook into RuntimeSubprocess.InvokeHook

Signed-off-by: Scott Rigby <[email protected]>

Remove unused Plugin.GetRuntime

Signed-off-by: Scott Rigby <[email protected]>

Rename Plugin.GetMetadata method to Metadata

Signed-off-by: Scott Rigby <[email protected]>

Create Metadata interface. Move GetConfig, GetRuntimeConfig, GetAPIVersion, GetName, and GetType methods from Plugin to Metadata interface

Signed-off-by: Scott Rigby <[email protected]>

Shorten Plugin.GetRuntimeInstance to Plugin.Runtime

Signed-off-by: Scott Rigby <[email protected]>

Shorten RuntimeConfig.GetRuntimeType and Config.GetType to just Type

Signed-off-by: Scott Rigby <[email protected]>

Move Invoke to Plugin (and for now invoke-like commands, until we merge them). Remove old PrepareCommand properly (handle ignoreFlags). As of now clients are expected to account for the ignore flag. Un-export Runtime methods

Signed-off-by: Scott Rigby <[email protected]>

Change LoadDir to switch. Deliberately not adding conversion function

Signed-off-by: Scott Rigby <[email protected]>

Fix Load all return and error

Signed-off-by: Scott Rigby <[email protected]>

Fix some semantics. Avoid yaml package name conflict

Signed-off-by: Scott Rigby <[email protected]>

Change reflect.DeepEqual to assert.Equal for Plugin.Metadata

Signed-off-by: Scott Rigby <[email protected]>

Add more robust plugin find criteria with findFunc and filterFunc pattern

Co-authored-by: George Jenkins <[email protected]>

Signed-off-by: Scott Rigby <[email protected]>

Integrate PR #7 into old interfaces

Signed-off-by: Scott Rigby <[email protected]>

Finish integrating #7 into orig interfaces. Tests all pass ✅

Signed-off-by: Scott Rigby <[email protected]>

Integrate draft PR Convert post-renderer to invoke #9

Signed-off-by: Scott Rigby <[email protected]>

revert back to postrenderER (for the record I dislike this, but agree it's consistent)

Signed-off-by: Scott Rigby <[email protected]>

Change some naming

Signed-off-by: Scott Rigby <[email protected]>

Fix make test-style (goimports/golangci-lint) errors

Signed-off-by: Scott Rigby <[email protected]>

OCI installer for plugins

Signed-off-by: Scott Rigby <[email protected]>

Simplify. We only want to support tarballs. This is the only reliable way to preserve file mode for executables

Signed-off-by: Scott Rigby <[email protected]>

Update pkg/getter/ocigetter to work for both charts and plugins, and update plugin OCI installer accordingly

Signed-off-by: Scott Rigby <[email protected]>

Plugin runtime support (#15)

Fix linting issues (#18)

Extism/v1 plugin runtime support (#17)

Fix legacy metadata downloader convert

lint

Move pkg/plugins -> internal/plugin (#16)
gjenkins8 pushed a commit that referenced this pull request Aug 16, 2025
…mand type flag

Signed-off-by: Scott Rigby <[email protected]>

TODO for execRender

Signed-off-by: Scott Rigby <[email protected]>

Replace --post-renderer arbitrary binary execution with plugin of type postrender

Signed-off-by: Scott Rigby <[email protected]>

Note this old todo for moving postrenderer to plugin system is now complete:

	// NOTE(thomastaylor312): I am leaving this code commented out here. During
	// the implementation of post-render, it was brought up that if we are
	// relying on plugins, we should actually use the plugin system so it can
	// properly handle multiple OSs. This will be a feature add in the future,
	// so I left this code for reference. It can be deleted or reused once the
	// feature is implemented

Signed-off-by: Scott Rigby <[email protected]>

Move postrenderer package to plugins. combine and fix tests

Signed-off-by: Scott Rigby <[email protected]>

Fix references to pkg/plugin

Signed-off-by: Scott Rigby <[email protected]>

Fix TestPostRendererFlagSetOnce test

Signed-off-by: Scott Rigby <[email protected]>

Fix TestLoadPluginsForCompletion

Signed-off-by: Scott Rigby <[email protected]>

Fix TestLoadPlugins

Signed-off-by: Scott Rigby <[email protected]>

Fix linting

Signed-off-by: Scott Rigby <[email protected]>

List and use legacy plugins using the same Plugin struct and removing unmarshall strict

Signed-off-by: Scott Rigby <[email protected]>

Add Plugin interface in front of PluginLegacy and Pluginv1

Signed-off-by: Scott Rigby <[email protected]>

Disambiguate API version legacy from type. There is no more legacy type (legacy plugins are either cli or download)

Signed-off-by: Scott Rigby <[email protected]>

Validate PluginV1

Signed-off-by: Scott Rigby <[email protected]>

Add apiVersion to test data

fix nil pointer dereference for tests

Signed-off-by: Scott Rigby <[email protected]>

TODO for testing

Signed-off-by: Scott Rigby <[email protected]>

Comments and TODOs

Signed-off-by: Scott Rigby <[email protected]>

Try Plugin Config interface and Config implementations per plugin type

Signed-off-by: Scott Rigby <[email protected]>

Add Runtime and RuntimeConfig interfaces, and implement per runtime (subprocess and Wasm). Move fields to the applicable config structs. TODO update tests and testdata YAML to match

Signed-off-by: Scott Rigby <[email protected]>

Attempt to reorganize fields to make sense on new structs, YAML to match, and update tests to match

Signed-off-by: Scott Rigby <[email protected]>

pkg/plugin tests pass

Signed-off-by: Scott Rigby <[email protected]>

Fix TestLoadPlugins. All tests pass now

Signed-off-by: Scott Rigby <[email protected]>

Do not attept to unmarshall into PluginLegacy if apiVersion is present but with the wrong value. Give better error instead

Signed-off-by: Scott Rigby <[email protected]>

Remove legacy field fallback for PluginV1. Users should update their plugin.yaml fully if they set apiVersion to v1

Signed-off-by: Scott Rigby <[email protected]>

Reorganize code into separate files for better readability

Signed-off-by: Scott Rigby <[email protected]>

fix runHook

Signed-off-by: Scott Rigby <[email protected]>

Add plugin sourceURL

Signed-off-by: Scott Rigby <[email protected]>

Change CLI plugin config to match cobra options

Signed-off-by: Scott Rigby <[email protected]>

Fix tests after updating shortHelp, longHelp and usage fields

Signed-off-by: Scott Rigby <[email protected]>

add missing newlines at EOF

Signed-off-by: Scott Rigby <[email protected]>

Unsuccessful attempt at consolidating all subprocess funcs into Runtime.Invoke. Tests pass but functionality doesn't work. Keeping for reference to ideas but will revert in next commit

Signed-off-by: Scott Rigby <[email protected]>

Revert "Unsuccessful attempt at consolidating all subprocess funcs into Runtime.Invoke. Tests pass but functionality doesn't work. Keeping for reference to ideas but will revert in next commit"

This reverts commit 842b1b3.

Fix regression from a3bc64a that prevented legacy CLI plugins from loading

Signed-off-by: Scott Rigby <[email protected]>

move all direct os/exec calls from any code outside pkg/plugin

Signed-off-by: Scott Rigby <[email protected]>

change all calls to exec funcs in pkg/plugin/exec.go to now use new invoke methods

Signed-off-by: Scott Rigby <[email protected]>

move runtime-specific code from runtime.go into separate files for better organization

Signed-off-by: Scott Rigby <[email protected]>

Fix gofmt

Signed-off-by: Scott Rigby <[email protected]>

Update TODOs and comments

Signed-off-by: Scott Rigby <[email protected]>

More TODOs

Signed-off-by: Scott Rigby <[email protected]>

execHook is only used within the package. don't export. consolidate with other funcs later

Signed-off-by: Scott Rigby <[email protected]>

Refactor the Postrenderer interface to use a runtime-agnostic factory pattern

Signed-off-by: Scott Rigby <[email protected]>

Add new Runtime.Postrender method to better organize runtime-specific logic for postrender type plugins

Signed-off-by: Scott Rigby <[email protected]>

Consolidate remaining exec functions into runtime_subprocess.go. Keep chipping away at them

Signed-off-by: Scott Rigby <[email protected]>

rename ExecError to plugin.Error. it's not only for exec

Signed-off-by: Scott Rigby <[email protected]>

Simplify to use just Runtime.Invoke

Signed-off-by: Scott Rigby <[email protected]>

move execHook into RuntimeSubprocess.InvokeHook

Signed-off-by: Scott Rigby <[email protected]>

Remove unused Plugin.GetRuntime

Signed-off-by: Scott Rigby <[email protected]>

Rename Plugin.GetMetadata method to Metadata

Signed-off-by: Scott Rigby <[email protected]>

Create Metadata interface. Move GetConfig, GetRuntimeConfig, GetAPIVersion, GetName, and GetType methods from Plugin to Metadata interface

Signed-off-by: Scott Rigby <[email protected]>

Shorten Plugin.GetRuntimeInstance to Plugin.Runtime

Signed-off-by: Scott Rigby <[email protected]>

Shorten RuntimeConfig.GetRuntimeType and Config.GetType to just Type

Signed-off-by: Scott Rigby <[email protected]>

Move Invoke to Plugin (and for now invoke-like commands, until we merge them). Remove old PrepareCommand properly (handle ignoreFlags). As of now clients are expected to account for the ignore flag. Un-export Runtime methods

Signed-off-by: Scott Rigby <[email protected]>

Change LoadDir to switch. Deliberately not adding conversion function

Signed-off-by: Scott Rigby <[email protected]>

Fix Load all return and error

Signed-off-by: Scott Rigby <[email protected]>

Fix some semantics. Avoid yaml package name conflict

Signed-off-by: Scott Rigby <[email protected]>

Change reflect.DeepEqual to assert.Equal for Plugin.Metadata

Signed-off-by: Scott Rigby <[email protected]>

Add more robust plugin find criteria with findFunc and filterFunc pattern

Co-authored-by: George Jenkins <[email protected]>

Signed-off-by: Scott Rigby <[email protected]>

Integrate PR #7 into old interfaces

Signed-off-by: Scott Rigby <[email protected]>

Finish integrating #7 into orig interfaces. Tests all pass ✅

Signed-off-by: Scott Rigby <[email protected]>

Integrate draft PR Convert post-renderer to invoke #9

Signed-off-by: Scott Rigby <[email protected]>

revert back to postrenderER (for the record I dislike this, but agree it's consistent)

Signed-off-by: Scott Rigby <[email protected]>

Change some naming

Signed-off-by: Scott Rigby <[email protected]>

Fix make test-style (goimports/golangci-lint) errors

Signed-off-by: Scott Rigby <[email protected]>

OCI installer for plugins

Signed-off-by: Scott Rigby <[email protected]>

Simplify. We only want to support tarballs. This is the only reliable way to preserve file mode for executables

Signed-off-by: Scott Rigby <[email protected]>

Update pkg/getter/ocigetter to work for both charts and plugins, and update plugin OCI installer accordingly

Signed-off-by: Scott Rigby <[email protected]>

Plugin runtime support (#15)

Fix linting issues (#18)

Extism/v1 plugin runtime support (#17)

Fix legacy metadata downloader convert

lint

Move pkg/plugins -> internal/plugin (#16)
gjenkins8 pushed a commit that referenced this pull request Aug 16, 2025
…mand type flag

Signed-off-by: Scott Rigby <[email protected]>

TODO for execRender

Signed-off-by: Scott Rigby <[email protected]>

Replace --post-renderer arbitrary binary execution with plugin of type postrender

Signed-off-by: Scott Rigby <[email protected]>

Note this old todo for moving postrenderer to plugin system is now complete:

	// NOTE(thomastaylor312): I am leaving this code commented out here. During
	// the implementation of post-render, it was brought up that if we are
	// relying on plugins, we should actually use the plugin system so it can
	// properly handle multiple OSs. This will be a feature add in the future,
	// so I left this code for reference. It can be deleted or reused once the
	// feature is implemented

Signed-off-by: Scott Rigby <[email protected]>

Move postrenderer package to plugins. combine and fix tests

Signed-off-by: Scott Rigby <[email protected]>

Fix references to pkg/plugin

Signed-off-by: Scott Rigby <[email protected]>

Fix TestPostRendererFlagSetOnce test

Signed-off-by: Scott Rigby <[email protected]>

Fix TestLoadPluginsForCompletion

Signed-off-by: Scott Rigby <[email protected]>

Fix TestLoadPlugins

Signed-off-by: Scott Rigby <[email protected]>

Fix linting

Signed-off-by: Scott Rigby <[email protected]>

List and use legacy plugins using the same Plugin struct and removing unmarshall strict

Signed-off-by: Scott Rigby <[email protected]>

Add Plugin interface in front of PluginLegacy and Pluginv1

Signed-off-by: Scott Rigby <[email protected]>

Disambiguate API version legacy from type. There is no more legacy type (legacy plugins are either cli or download)

Signed-off-by: Scott Rigby <[email protected]>

Validate PluginV1

Signed-off-by: Scott Rigby <[email protected]>

Add apiVersion to test data

fix nil pointer dereference for tests

Signed-off-by: Scott Rigby <[email protected]>

TODO for testing

Signed-off-by: Scott Rigby <[email protected]>

Comments and TODOs

Signed-off-by: Scott Rigby <[email protected]>

Try Plugin Config interface and Config implementations per plugin type

Signed-off-by: Scott Rigby <[email protected]>

Add Runtime and RuntimeConfig interfaces, and implement per runtime (subprocess and Wasm). Move fields to the applicable config structs. TODO update tests and testdata YAML to match

Signed-off-by: Scott Rigby <[email protected]>

Attempt to reorganize fields to make sense on new structs, YAML to match, and update tests to match

Signed-off-by: Scott Rigby <[email protected]>

pkg/plugin tests pass

Signed-off-by: Scott Rigby <[email protected]>

Fix TestLoadPlugins. All tests pass now

Signed-off-by: Scott Rigby <[email protected]>

Do not attept to unmarshall into PluginLegacy if apiVersion is present but with the wrong value. Give better error instead

Signed-off-by: Scott Rigby <[email protected]>

Remove legacy field fallback for PluginV1. Users should update their plugin.yaml fully if they set apiVersion to v1

Signed-off-by: Scott Rigby <[email protected]>

Reorganize code into separate files for better readability

Signed-off-by: Scott Rigby <[email protected]>

fix runHook

Signed-off-by: Scott Rigby <[email protected]>

Add plugin sourceURL

Signed-off-by: Scott Rigby <[email protected]>

Change CLI plugin config to match cobra options

Signed-off-by: Scott Rigby <[email protected]>

Fix tests after updating shortHelp, longHelp and usage fields

Signed-off-by: Scott Rigby <[email protected]>

add missing newlines at EOF

Signed-off-by: Scott Rigby <[email protected]>

Unsuccessful attempt at consolidating all subprocess funcs into Runtime.Invoke. Tests pass but functionality doesn't work. Keeping for reference to ideas but will revert in next commit

Signed-off-by: Scott Rigby <[email protected]>

Revert "Unsuccessful attempt at consolidating all subprocess funcs into Runtime.Invoke. Tests pass but functionality doesn't work. Keeping for reference to ideas but will revert in next commit"

This reverts commit 842b1b3.

Fix regression from a3bc64a that prevented legacy CLI plugins from loading

Signed-off-by: Scott Rigby <[email protected]>

move all direct os/exec calls from any code outside pkg/plugin

Signed-off-by: Scott Rigby <[email protected]>

change all calls to exec funcs in pkg/plugin/exec.go to now use new invoke methods

Signed-off-by: Scott Rigby <[email protected]>

move runtime-specific code from runtime.go into separate files for better organization

Signed-off-by: Scott Rigby <[email protected]>

Fix gofmt

Signed-off-by: Scott Rigby <[email protected]>

Update TODOs and comments

Signed-off-by: Scott Rigby <[email protected]>

More TODOs

Signed-off-by: Scott Rigby <[email protected]>

execHook is only used within the package. don't export. consolidate with other funcs later

Signed-off-by: Scott Rigby <[email protected]>

Refactor the Postrenderer interface to use a runtime-agnostic factory pattern

Signed-off-by: Scott Rigby <[email protected]>

Add new Runtime.Postrender method to better organize runtime-specific logic for postrender type plugins

Signed-off-by: Scott Rigby <[email protected]>

Consolidate remaining exec functions into runtime_subprocess.go. Keep chipping away at them

Signed-off-by: Scott Rigby <[email protected]>

rename ExecError to plugin.Error. it's not only for exec

Signed-off-by: Scott Rigby <[email protected]>

Simplify to use just Runtime.Invoke

Signed-off-by: Scott Rigby <[email protected]>

move execHook into RuntimeSubprocess.InvokeHook

Signed-off-by: Scott Rigby <[email protected]>

Remove unused Plugin.GetRuntime

Signed-off-by: Scott Rigby <[email protected]>

Rename Plugin.GetMetadata method to Metadata

Signed-off-by: Scott Rigby <[email protected]>

Create Metadata interface. Move GetConfig, GetRuntimeConfig, GetAPIVersion, GetName, and GetType methods from Plugin to Metadata interface

Signed-off-by: Scott Rigby <[email protected]>

Shorten Plugin.GetRuntimeInstance to Plugin.Runtime

Signed-off-by: Scott Rigby <[email protected]>

Shorten RuntimeConfig.GetRuntimeType and Config.GetType to just Type

Signed-off-by: Scott Rigby <[email protected]>

Move Invoke to Plugin (and for now invoke-like commands, until we merge them). Remove old PrepareCommand properly (handle ignoreFlags). As of now clients are expected to account for the ignore flag. Un-export Runtime methods

Signed-off-by: Scott Rigby <[email protected]>

Change LoadDir to switch. Deliberately not adding conversion function

Signed-off-by: Scott Rigby <[email protected]>

Fix Load all return and error

Signed-off-by: Scott Rigby <[email protected]>

Fix some semantics. Avoid yaml package name conflict

Signed-off-by: Scott Rigby <[email protected]>

Change reflect.DeepEqual to assert.Equal for Plugin.Metadata

Signed-off-by: Scott Rigby <[email protected]>

Add more robust plugin find criteria with findFunc and filterFunc pattern

Co-authored-by: George Jenkins <[email protected]>

Signed-off-by: Scott Rigby <[email protected]>

Integrate PR #7 into old interfaces

Signed-off-by: Scott Rigby <[email protected]>

Finish integrating #7 into orig interfaces. Tests all pass ✅

Signed-off-by: Scott Rigby <[email protected]>

Integrate draft PR Convert post-renderer to invoke #9

Signed-off-by: Scott Rigby <[email protected]>

revert back to postrenderER (for the record I dislike this, but agree it's consistent)

Signed-off-by: Scott Rigby <[email protected]>

Change some naming

Signed-off-by: Scott Rigby <[email protected]>

Fix make test-style (goimports/golangci-lint) errors

Signed-off-by: Scott Rigby <[email protected]>

OCI installer for plugins

Signed-off-by: Scott Rigby <[email protected]>

Simplify. We only want to support tarballs. This is the only reliable way to preserve file mode for executables

Signed-off-by: Scott Rigby <[email protected]>

Update pkg/getter/ocigetter to work for both charts and plugins, and update plugin OCI installer accordingly

Signed-off-by: Scott Rigby <[email protected]>

Plugin runtime support (#15)

Fix linting issues (#18)

Extism/v1 plugin runtime support (#17)

Fix legacy metadata downloader convert

lint

Move pkg/plugins -> internal/plugin (#16)
scottrigby added a commit that referenced this pull request Aug 13, 2026
…26-6061

backport of helm#32450

updated with:

```
go get google.golang.org/[email protected]
go mod tidy
```

example actions failure:
https://github.com/helm/helm/actions/runs/31733009013/job/94557780520

```
  Vulnerability #1: GO-2026-6061
      Vulnerabilities in the xDS RBAC authorization engine and the HTTP/2
      transport server implementation in google.golang.org/grpc
    More info: https://pkg.go.dev/vuln/GO-2026-6061
    Module: google.golang.org/grpc
      Found in: google.golang.org/[email protected]
      Fixed in: google.golang.org/[email protected]
      Example traces found:
  Error:       #1: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.ClientStream.Close
  Error:       #2: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.ClientStream.Header
  Error:       #3: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.ClientStream.Read
  Error:       #4: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.ClientStream.RecvCompress
  Error:       #5: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.ClientStream.TrailersOnly
  Error:       #6: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.ClientStream.Write
  Error:       #7: pkg/action/lazyclient.go:49:17: action.lazyClient.init calls sync.Once.Do, which eventually calls transport.NewHTTP2Client
  Error:       #8: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.Stream.ReadMessageHeader
  Error:       #9: pkg/action/lazyclient.go:49:17: action.lazyClient.init calls sync.Once.Do, which eventually calls transport.http2Client.Close
  Error:       #10: pkg/action/lazyclient.go:49:17: action.lazyClient.init calls sync.Once.Do, which eventually calls transport.http2Client.GracefulClose
  Error:       #11: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.http2Client.NewStream
```

Signed-off-by: Scott Rigby <[email protected]>
scottrigby added a commit that referenced this pull request Aug 13, 2026
…26-6061 (helm#32536)

backport of helm#32450

updated with:

```
go get google.golang.org/[email protected]
go mod tidy
```

example actions failure:
https://github.com/helm/helm/actions/runs/31733009013/job/94557780520

```
  Vulnerability #1: GO-2026-6061
      Vulnerabilities in the xDS RBAC authorization engine and the HTTP/2
      transport server implementation in google.golang.org/grpc
    More info: https://pkg.go.dev/vuln/GO-2026-6061
    Module: google.golang.org/grpc
      Found in: google.golang.org/[email protected]
      Fixed in: google.golang.org/[email protected]
      Example traces found:
  Error:       #1: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.ClientStream.Close
  Error:       #2: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.ClientStream.Header
  Error:       #3: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.ClientStream.Read
  Error:       #4: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.ClientStream.RecvCompress
  Error:       #5: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.ClientStream.TrailersOnly
  Error:       #6: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.ClientStream.Write
  Error:       #7: pkg/action/lazyclient.go:49:17: action.lazyClient.init calls sync.Once.Do, which eventually calls transport.NewHTTP2Client
  Error:       #8: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.Stream.ReadMessageHeader
  Error:       #9: pkg/action/lazyclient.go:49:17: action.lazyClient.init calls sync.Once.Do, which eventually calls transport.http2Client.Close
  Error:       #10: pkg/action/lazyclient.go:49:17: action.lazyClient.init calls sync.Once.Do, which eventually calls transport.http2Client.GracefulClose
  Error:       #11: pkg/repo/repotest/server.go:128:32: repotest.NewOCIServer calls registry.NewRegistry, which eventually calls transport.http2Client.NewStream
```

Signed-off-by: Scott Rigby <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants