Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Runner interface to allow custom command runner implementations #270

Merged
merged 15 commits into from
Aug 22, 2023

Conversation

tomhjp
Copy link
Contributor

@tomhjp tomhjp commented Aug 18, 2023

  • Adds a new set of interfaces in a runner package to allow custom implementations for running plugins.
  • Adds 3 new client-facing config options
  • From a server (plugin) point of view; Adds optional environment variables to control the plugin's listener unix sockets
  • Adds CmdRunner as the default Runner implementation, maintaining existing functionality and backwards compatibility

See hashicorp/go-secure-stdlib#84 for an example implementation of runner's interfaces.

Not planned (for now):

  • netrpc support

* Runner can be supplied by new config field RunnerFunc
* Also adds SkipHostEnv config option
* Adds optional environment variables to control plugin's unix socket
* Adds CmdRunner as the default Runner implementation, maintaining existing functionality
@tomhjp
Copy link
Contributor Author

tomhjp commented Aug 18, 2023

hashicorp/go-secure-stdlib#84 has an alternative container-based implementation for any reviewers who'd like to compare with CmdRunner.

@tomhjp tomhjp marked this pull request as ready for review August 21, 2023 16:52
server_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@fairclothjm fairclothjm left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@swenson swenson left a comment

Choose a reason for hiding this comment

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

LGTM, one nit and one suggestion

client.go Outdated Show resolved Hide resolved
server.go Outdated Show resolved Hide resolved
@tomhjp
Copy link
Contributor Author

tomhjp commented Aug 22, 2023

Thanks!

@tomhjp tomhjp merged commit de19819 into hashicorp:main Aug 22, 2023
1 check passed
@tomhjp tomhjp deleted the expose-plugin-runner-interface branch August 22, 2023 20:50
tomhjp added a commit that referenced this pull request Aug 24, 2023
A set of small follow-ups to #270:
* Make config.Cmd and config.RunnerFunc mutually exclusive
* Explicitly mark ReattachConfig as unsupported for RunnerFunc clients
* Improve 1 logger line for non-cmd implementations
tomhjp added a commit that referenced this pull request Aug 24, 2023
A set of small follow-ups to #270:
* Make config.Cmd and config.RunnerFunc mutually exclusive
* Explicitly mark ReattachConfig as unsupported for RunnerFunc clients
* Improve 1 logger line for non-cmd implementations
* Add ID() function to client, useful for client's debug log information
tomhjp added a commit that referenced this pull request Aug 24, 2023
A set of small follow-ups to #270:
* Make config.Cmd and config.RunnerFunc mutually exclusive
* Clients setting RunnerFunc can call ReattachConfig but need to supply
  their own ReattachFunc as it can't necessarily be derived from RunnerFunc.
* Improve 1 logger line for non-cmd implementations
* Add ID() function to client, useful for client's debug log information
tomhjp added a commit that referenced this pull request Aug 24, 2023
A set of small follow-ups to #270:
* Make `config.Cmd` and `config.RunnerFunc` mutually exclusive.
* Clients setting `RunnerFunc` can call `ReattachConfig` but need to supply
  their own `ReattachFunc` as it can't necessarily be derived from `RunnerFunc`.
  Exercise `ReattachConfig()` in tests in a way that previously panicked.
* Improve 1 logger line for non-cmd implementations.
* Add `ID()` function to client; allows clients to construct a `ReattachFunc`
  and also useful for client's debug log information.
tomhjp added a commit that referenced this pull request Aug 24, 2023
A set of small follow-ups to #270:
* Make `config.Cmd` and `config.RunnerFunc` mutually exclusive.
* Clients setting `RunnerFunc` can call `ReattachConfig` but need to supply
  their own `ReattachFunc` as it can't necessarily be derived from `RunnerFunc`.
  Exercise `ReattachConfig()` in tests in a way that previously panicked.
* Improve 1 logger line for non-cmd implementations.
* Add `ID()` function to client; allows clients to construct a `ReattachFunc`
  and also useful for client's debug log information.
tomhjp added a commit that referenced this pull request Aug 25, 2023
A set of small follow-ups to #270:

* Make `ClientConfig.Cmd` and `ClientConfig.RunnerFunc` mutually exclusive
* Clients setting `RunnerFunc` can call `ReattachConfig()` but need to supply their own `ReattachFunc` as it can't necessarily be derived from `RunnerFunc`. Exercise `ReattachConfig()` in tests in a way that previously panicked.
* Improve 1 logger line for non-cmd implementations.
* Add `ID()` function to client; accommodates creating a `ReattachFunc` and also useful for client's debug log information.
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.

3 participants