Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build(ctx *app.Context, opts *BuildOptions) error
Build can be used to build an artifact with Packer and parse the artifact out into a Build properly.
This function automatically knows how to parse various built-in artifacts of Packer. For the exact functionality of the parse functions, see the documentation of the various parse functions.
This function implements the app.App.Build function. TODO: Test
Types ¶
type BuildOptions ¶
type BuildOptions struct {
// Dir is the directory where Packer will be executed from.
// If this isn't set, it'll default to "#{ctx.Dir}/build"
Dir string
// The path to the template to execute. If this isn't set, it'll
// default to "#{Dir}/template.json"
TemplatePath string
// InfraOutputMap is a map to change the key of an infra output
// to a different key for a Packer variable. The key of this map
// is the infra output key, and teh value is the Packer variable name.
InfraOutputMap map[string]string
}
type OutputCallback ¶
type OutputCallback func(*Output)
OutputCallback is the type that is called when there is a matching machine-readable output line for the UI.
func ParseArtifactAmazon ¶
func ParseArtifactAmazon(m map[string]string) OutputCallback
ParseArtifactAmazon parses AMIs out of the output.
The map will be populated where the key is the region and the value is the AMI ID.
type Packer ¶
type Packer struct {
// Path is the path to Packer itself. If empty, "packer"
// will be used and looked up via the PATH var.
Path string
// Dir is the working directory where all Packer commands are executed
Dir string
// Ui, if given, will be used to stream output from the Packer commands.
// If this is nil, then the output will be logged but won't be visible
// to the user.
Ui ui.Ui
// Callbacks is a list of callbacks that will be called for certain
// event types within the output
Callbacks map[string]OutputCallback
// Variables is a list of variables to pass to Packer.
Variables map[string]string
}
Packer wraps `packer` execution into an easy-to-use API