Documentation ¶
Overview ¶
Package plugin has the functions necessary for discovering and launching plugins. This exposes both builtin plugins as well as external, custom plugins.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Builtins is the map of all available builtin plugins and their // options for launching them. Builtins = map[string][]sdk.Option{ "files": files.Options, "pack": pack.Options, "docker": docker.Options, "docker-pull": dockerpull.Options, "exec": exec.Options, "google-cloud-run": cloudrun.Options, "azure-container-instance": aci.Options, "kubernetes": k8s.Options, "netlify": netlify.Options, "aws-ecs": ecs.Options, "aws-ecr": ecr.Options, "nomad": nomad.Options, "aws-ami": ami.Options, "aws-ec2": ec2.Options, "aws-alb": alb.Options, "aws-ssm": ssm.Options, "vault": vault.Options, } // BaseFactories is the set of base plugin factories. This will include any // built-in or well-known plugins by default. This should be used as the base // for building any set of factories. BaseFactories = map[component.Type]*factory.Factory{ component.MapperType: mustFactory(factory.New((*interface{})(nil))), component.BuilderType: mustFactory(factory.New(component.TypeMap[component.BuilderType])), component.RegistryType: mustFactory(factory.New(component.TypeMap[component.RegistryType])), component.PlatformType: mustFactory(factory.New(component.TypeMap[component.PlatformType])), component.ReleaseManagerType: mustFactory(factory.New(component.TypeMap[component.ReleaseManagerType])), component.ConfigSourcerType: mustFactory(factory.New(component.TypeMap[component.ConfigSourcerType])), } )
Functions ¶
func BuiltinFactory ¶
BuiltinFactory creates a factory for a built-in plugin type.
func DefaultPaths ¶
DefaultPaths returns the default search paths for plugins. These are:
- pwd given
- "$pwd/.waypoint/plugins"
- "$XDG_CONFIG_DIR/waypoint/plugins"
func Discover ¶
Discover finds the given plugin and returns the command for it. The command can subsequently be used with Factory to build a factory for a specific plugin type. If the plugin is not found `(nil, nil)` is returned.
The plugin binary must have the form "waypoint-plugin-<name>" (with a ".exe" extension on Windows).
This will search the paths given. You can use DefaultPaths() to get the default set of paths.
func Factory ¶
Factory returns the factory function for a plugin that is already represented by an *exec.Cmd. This returns an *Instance and NOT the component interface value directly. This instance lets you more carefully manage the lifecycle of the plugin as well as get additional information about the plugin.
Types ¶
type Instance ¶
type Instance struct { // Component is the dispensed component Component interface{} // Mappers is the list of mappers that this plugin is providing. Mappers []*argmapper.Func // Closer is a function that should be called to clean up resources // associated with this plugin. Close func() }
Instance is the result generated by the factory. This lets us pack a bit more information into plugin-launched components.