|
|
|
|
@ -9,6 +9,7 @@ import (
|
|
|
|
|
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
|
|
|
|
|
"github.com/hashicorp/packer-plugin-sdk/packerbuilderdata"
|
|
|
|
|
"github.com/hashicorp/packer/version"
|
|
|
|
|
"github.com/zclconf/go-cty/cty"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func boolPointer(tf bool) *bool {
|
|
|
|
|
@ -32,7 +33,7 @@ func testBuild() *CoreBuild {
|
|
|
|
|
},
|
|
|
|
|
PostProcessors: [][]CoreBuildPostProcessor{
|
|
|
|
|
{
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp"}, "testPP", "testPPName", make(map[string]interface{}), boolPointer(true)},
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp"}, "testPP", "testPPName", cty.Value{}, make(map[string]interface{}), boolPointer(true)},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Variables: make(map[string]string),
|
|
|
|
|
@ -302,7 +303,7 @@ func TestBuild_Run_Artifacts(t *testing.T) {
|
|
|
|
|
build = testBuild()
|
|
|
|
|
build.PostProcessors = [][]CoreBuildPostProcessor{
|
|
|
|
|
{
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp"}, "pp", "testPPName", make(map[string]interface{}), boolPointer(false)},
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp"}, "pp", "testPPName", cty.Value{}, make(map[string]interface{}), boolPointer(false)},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -327,10 +328,10 @@ func TestBuild_Run_Artifacts(t *testing.T) {
|
|
|
|
|
build = testBuild()
|
|
|
|
|
build.PostProcessors = [][]CoreBuildPostProcessor{
|
|
|
|
|
{
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp1"}, "pp", "testPPName", make(map[string]interface{}), boolPointer(false)},
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp1"}, "pp", "testPPName", cty.Value{}, make(map[string]interface{}), boolPointer(false)},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp2"}, "pp", "testPPName", make(map[string]interface{}), boolPointer(true)},
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp2"}, "pp", "testPPName", cty.Value{}, make(map[string]interface{}), boolPointer(true)},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -355,12 +356,12 @@ func TestBuild_Run_Artifacts(t *testing.T) {
|
|
|
|
|
build = testBuild()
|
|
|
|
|
build.PostProcessors = [][]CoreBuildPostProcessor{
|
|
|
|
|
{
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp1a"}, "pp", "testPPName", make(map[string]interface{}), boolPointer(false)},
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp1b"}, "pp", "testPPName", make(map[string]interface{}), boolPointer(true)},
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp1a"}, "pp", "testPPName", cty.Value{}, make(map[string]interface{}), boolPointer(false)},
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp1b"}, "pp", "testPPName", cty.Value{}, make(map[string]interface{}), boolPointer(true)},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp2a"}, "pp", "testPPName", make(map[string]interface{}), boolPointer(false)},
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp2b"}, "pp", "testPPName", make(map[string]interface{}), boolPointer(false)},
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp2a"}, "pp", "testPPName", cty.Value{}, make(map[string]interface{}), boolPointer(false)},
|
|
|
|
|
{&MockPostProcessor{ArtifactId: "pp2b"}, "pp", "testPPName", cty.Value{}, make(map[string]interface{}), boolPointer(false)},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -386,7 +387,7 @@ func TestBuild_Run_Artifacts(t *testing.T) {
|
|
|
|
|
build.PostProcessors = [][]CoreBuildPostProcessor{
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
&MockPostProcessor{ArtifactId: "pp", Keep: true, ForceOverride: true}, "pp", "testPPName", make(map[string]interface{}), boolPointer(false),
|
|
|
|
|
&MockPostProcessor{ArtifactId: "pp", Keep: true, ForceOverride: true}, "pp", "testPPName", cty.Value{}, make(map[string]interface{}), boolPointer(false),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
@ -414,7 +415,7 @@ func TestBuild_Run_Artifacts(t *testing.T) {
|
|
|
|
|
build.PostProcessors = [][]CoreBuildPostProcessor{
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
&MockPostProcessor{ArtifactId: "pp", Keep: true, ForceOverride: false}, "pp", "testPPName", make(map[string]interface{}), boolPointer(false),
|
|
|
|
|
&MockPostProcessor{ArtifactId: "pp", Keep: true, ForceOverride: false}, "pp", "testPPName", cty.Value{}, make(map[string]interface{}), boolPointer(false),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
@ -441,7 +442,7 @@ func TestBuild_Run_Artifacts(t *testing.T) {
|
|
|
|
|
build.PostProcessors = [][]CoreBuildPostProcessor{
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
&MockPostProcessor{ArtifactId: "pp", Keep: true, ForceOverride: false}, "pp", "testPPName", make(map[string]interface{}), nil,
|
|
|
|
|
&MockPostProcessor{ArtifactId: "pp", Keep: true, ForceOverride: false}, "pp", "testPPName", cty.Value{}, make(map[string]interface{}), nil,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|