plugin

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2021 License: MPL-2.0 Imports: 19 Imported by: 109

Documentation

Overview

The plugin package provides the functionality to both expose a Packer plugin binary and to connect to an existing Packer plugin binary.

Packer supports plugins in the form of self-contained external static Go binaries. These binaries behave in a certain way (enforced by this package) and are connected to in a certain way (also enforced by this package).

Index

Constants

View Source
const APIVersion = "5"

The APIVersion is outputted along with the RPC address. The plugin client validates this API version and will show an error if it doesn't know how to speak it.

View Source
const DEFAULT_NAME = "-packer-default-plugin-name-"

Use this name to make the name of the plugin in the packer template match the multiplugin suffix, instead of requiring a second part. For example, calling :

pps.RegisterProvisioner(plugin.DEFAULT_NAME, new(CommentProvisioner))

On a plugin named `packer-plugin-foo`, will make the `foo` provisioner available with your CommentProvisioner doing that. There can only be one unnamed plugin per plugin type.

View Source
const MagicCookieKey = "PACKER_PLUGIN_MAGIC_COOKIE"
View Source
const MagicCookieValue = "d602bf8f470bc67ca7faa0386276bbdd4330efaf76d1a219cb4d6991ca9872b2"

Variables

View Source
var ErrManuallyStartedPlugin = errors.New(
	"Please do not execute plugins directly. Packer will execute these for you.")
View Source
var Interrupts int32 = 0

This is a count of the number of interrupts the process has received. This is updated with sync/atomic whenever a SIGINT is received and can be checked by the plugin safely to take action.

Functions

func Server

func Server() (*packrpc.Server, error)

Server waits for a connection to this plugin and returns a Packer RPC server that you can use to register components and serve them.

Types

type Set

type Set struct {
	Builders       map[string]packersdk.Builder
	PostProcessors map[string]packersdk.PostProcessor
	Provisioners   map[string]packersdk.Provisioner
	Datasources    map[string]packersdk.Datasource
	// contains filtered or unexported fields
}

Set is a plugin set. It's API is meant to be very close to what is returned by plugin.Server It can describe itself or run a single plugin using the CLI arguments.

func NewSet

func NewSet() *Set

func (*Set) RegisterBuilder

func (i *Set) RegisterBuilder(name string, builder packersdk.Builder)

func (*Set) RegisterDatasource added in v0.0.7

func (i *Set) RegisterDatasource(name string, datasource packersdk.Datasource)

func (*Set) RegisterPostProcessor

func (i *Set) RegisterPostProcessor(name string, postProcessor packersdk.PostProcessor)

func (*Set) RegisterProvisioner

func (i *Set) RegisterProvisioner(name string, provisioner packersdk.Provisioner)

func (*Set) Run

func (i *Set) Run() error

Run takes the os Args and runs a packer plugin command from it.

  • "describe" command makes the plugin set describe itself.
  • "start builder builder-name" starts the builder "builder-name"
  • "start post-processor example" starts the post-processor "example"

func (*Set) RunCommand

func (i *Set) RunCommand(args ...string) error

func (*Set) SetVersion

func (i *Set) SetVersion(version *pluginVersion.PluginVersion)

type SetDescription

type SetDescription struct {
	Version        string   `json:"version"`
	SDKVersion     string   `json:"sdk_version"`
	Builders       []string `json:"builders"`
	PostProcessors []string `json:"post_processors"`
	Provisioners   []string `json:"provisioners"`
	Datasources    []string `json:"datasources"`
}

SetDescription describes a Set.

Directories

Path Synopsis
This is an example plugin.
This is an example plugin.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL