Documentation
¶
Index ¶
- func Concat(pluginArgs [][2]string) string
- func DownloadPlugin(source PluginSource, targetPath string) error
- func FindInPaths(plugin string, paths []string) (string, error)
- func MergeDuplicateEnviron(env []string) []string
- func ParseInputArgs(args string) ([][2]string, error)
- type DefaultExecutor
- type Error
- type Executor
- type PluginArgs
- type PluginSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Concat ¶
Concat joins the given array of key=value formatted strings into a single ; delimited string.
func DownloadPlugin ¶
func DownloadPlugin(source PluginSource, targetPath string) error
func FindInPaths ¶
FindInPaths returns the full path of the plugin executable by searching in the provided list of paths
func MergeDuplicateEnviron ¶
MergeDuplicateEnviron returns a copy of environment variables with any duplicates removed, and keeping the latest values. Only variables of format "key=value" are considered for merging.
func ParseInputArgs ¶
ParseInputArgs parses the given string into an array of key=value formatted strings.
Types ¶
type DefaultExecutor ¶
DefaultExecutor finds the plugin executable and invokes it as a os command
func (*DefaultExecutor) ExecutePlugin ¶
func (e *DefaultExecutor) ExecutePlugin(ctx context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error)
return the command output and the error
func (*DefaultExecutor) FindInPaths ¶
func (e *DefaultExecutor) FindInPaths(plugin string, paths []string) (string, error)
type Error ¶
type Error struct { Code uint `json:"code"` Msg string `json:"msg"` Details string `json:"details,omitempty"` }
Error describes an error during plugin execution
type Executor ¶
type Executor interface { // ExecutePlugin executes the plugin with the given parameters ExecutePlugin(ctx context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error) // FindInPaths finds the plugin in the given paths FindInPaths(plugin string, paths []string) (string, error) }
Executor is an interface that defines methods to lookup a plugin and execute it.
type PluginArgs ¶
type PluginArgs interface {
AsEnviron() []string
}
type PluginSource ¶
type PluginSource struct { Artifact string `json:"artifact"` AuthProvider authprovider.AuthProviderConfig `json:"authProvider,omitempty"` }
func ParsePluginSource ¶
func ParsePluginSource(source interface{}) (PluginSource, error)