Commit 9387ba0f authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer: Make builder type available in configs [GH-154]

parent f621f889
......@@ -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"
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment