packer: Comments on Build interface

This commit is contained in:
Mitchell Hashimoto 2013-06-14 12:15:51 -07:00
parent 4daefc2588
commit e00a30e729
1 changed files with 12 additions and 0 deletions

View File

@ -5,9 +5,21 @@ import "log"
// A Build represents a single job within Packer that is responsible for
// building some machine image artifact. Builds are meant to be parallelized.
type Build interface {
// Name is the name of the build. This is unique across a single template,
// but not absolutely unique. This is meant more to describe to the user
// what is being built rather than being a unique identifier.
Name() string
// Prepare configures the various components of this build and reports
// any errors in doing so (such as syntax errors, validation errors, etc.)
Prepare() error
// Run runs the actual builder, returning an artifact implementation
// of what is built. If anything goes wrong, an error is returned.
Run(Ui, Cache) (Artifact, error)
// Cancel will cancel a running build. This will block until the build
// is actually completely cancelled.
Cancel()
}