packer: Make builder type available in configs [GH-154]
This commit is contained in:
parent
a47ad137a0
commit
b1c7d93ee8
|
@ -11,6 +11,11 @@ const (
|
|||
// build.
|
||||
BuildNameConfigKey = "packer_build_name"
|
||||
|
||||
// This is the key in the configuration that is set to the type
|
||||
// of the builder that is run. This is useful for provisioners and
|
||||
// such who want to make use of this.
|
||||
BuilderTypeConfigKey = "packer_builder_type"
|
||||
|
||||
// This is the key in configurations that is set to "true" when Packer
|
||||
// debugging is enabled.
|
||||
DebugConfigKey = "packer_debug"
|
||||
|
@ -110,6 +115,7 @@ func (b *coreBuild) Prepare() (err error) {
|
|||
|
||||
packerConfig := map[string]interface{}{
|
||||
BuildNameConfigKey: b.name,
|
||||
BuilderTypeConfigKey: b.builderType,
|
||||
DebugConfigKey: b.debug,
|
||||
ForceConfigKey: b.force,
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ func testBuild() *coreBuild {
|
|||
name: "test",
|
||||
builder: &TestBuilder{artifactId: "b"},
|
||||
builderConfig: 42,
|
||||
builderType: "foo",
|
||||
hooks: map[string][]Hook{
|
||||
"foo": []Hook{&TestHook{}},
|
||||
},
|
||||
|
@ -41,6 +42,7 @@ func TestBuild_Prepare(t *testing.T) {
|
|||
|
||||
packerConfig := map[string]interface{}{
|
||||
BuildNameConfigKey: "test",
|
||||
BuilderTypeConfigKey: "foo",
|
||||
DebugConfigKey: false,
|
||||
ForceConfigKey: false,
|
||||
}
|
||||
|
@ -88,6 +90,7 @@ func TestBuild_Prepare_Debug(t *testing.T) {
|
|||
|
||||
packerConfig := map[string]interface{}{
|
||||
BuildNameConfigKey: "test",
|
||||
BuilderTypeConfigKey: "foo",
|
||||
DebugConfigKey: true,
|
||||
ForceConfigKey: false,
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ package packer
|
|||
|
||||
import (
|
||||
"cgl.tideland.biz/asserts"
|
||||
"sort"
|
||||
"reflect"
|
||||
"sort"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue