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