github.com/askholme/packer@v0.7.2-0.20140924152349-70d9566a6852/packer/builder.go (about) 1 package packer 2 3 // Implementers of Builder are responsible for actually building images 4 // on some platform given some configuration. 5 // 6 // In addition to the documentation on Prepare above: Prepare is sometimes 7 // configured with a `map[string]interface{}` that has a key "packer_debug". 8 // This is a boolean value. If it is set to true, then the builder should 9 // enable a debug mode which allows builder developers and advanced users 10 // to introspect what is going on during a build. During debug builds, 11 // parallelism is strictly disabled, so it is safe to request input from 12 // stdin and so on. 13 type Builder interface { 14 // Prepare is responsible for configuring the builder and validating 15 // that configuration. Any setup should be done in this method. Note that 16 // NO side effects should take place in prepare, it is meant as a state 17 // setup only. Calling Prepare is not necessarilly followed by a Run. 18 // 19 // The parameters to Prepare are a set of interface{} values of the 20 // configuration. These are almost always `map[string]interface{}` 21 // parsed from a template, but no guarantee is made. 22 // 23 // Each of the configuration values should merge into the final 24 // configuration. 25 // 26 // Prepare should return a list of warnings along with any errors 27 // that occured while preparing. 28 Prepare(...interface{}) ([]string, error) 29 30 // Run is where the actual build should take place. It takes a Build and a Ui. 31 Run(ui Ui, hook Hook, cache Cache) (Artifact, error) 32 33 // Cancel cancels a possibly running Builder. This should block until 34 // the builder actually cancels and cleans up after itself. 35 Cancel() 36 }