diff --git a/builder/alicloud/ecs/builder.go b/builder/alicloud/ecs/builder.go index d0ab061bb..c8980f063 100644 --- a/builder/alicloud/ecs/builder.go +++ b/builder/alicloud/ecs/builder.go @@ -1,6 +1,6 @@ //go:generate mapstructure-to-hcl2 -type Config,AlicloudDiskDevice -// The alicloud contains a packer.Builder implementation that +// The alicloud contains a packersdk.Builder implementation that // builds ecs images for alicloud. package ecs diff --git a/builder/alicloud/ecs/builder_test.go b/builder/alicloud/ecs/builder_test.go index 9b92a5c5d..3d2f898e2 100644 --- a/builder/alicloud/ecs/builder_test.go +++ b/builder/alicloud/ecs/builder_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" helperconfig "github.com/hashicorp/packer/packer-plugin-sdk/template/config" ) @@ -24,7 +24,7 @@ func testBuilderConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/amazon/chroot/builder_test.go b/builder/amazon/chroot/builder_test.go index bdecd2533..d43dd9f26 100644 --- a/builder/amazon/chroot/builder_test.go +++ b/builder/amazon/chroot/builder_test.go @@ -3,7 +3,7 @@ package chroot import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -19,7 +19,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/amazon/ebs/acceptance/builder_acceptance.go b/builder/amazon/ebs/acceptance/builder_acceptance.go index ea349d3fb..5956e5c9a 100644 --- a/builder/amazon/ebs/acceptance/builder_acceptance.go +++ b/builder/amazon/ebs/acceptance/builder_acceptance.go @@ -12,6 +12,7 @@ import ( amazonebsbuilder "github.com/hashicorp/packer/builder/amazon/ebs" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" testshelper "github.com/hashicorp/packer/helper/tests" ) @@ -56,6 +57,6 @@ func (s *AmazonEBSAccTest) CleanUp() error { func (s *AmazonEBSAccTest) GetBuilderStore() packer.MapOfBuilder { return packer.MapOfBuilder{ - "amazon-ebs": func() (packer.Builder, error) { return &amazonebsbuilder.Builder{}, nil }, + "amazon-ebs": func() (packersdk.Builder, error) { return &amazonebsbuilder.Builder{}, nil }, } } diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go index 72a22c291..a0808826a 100644 --- a/builder/amazon/ebs/builder.go +++ b/builder/amazon/ebs/builder.go @@ -1,7 +1,7 @@ //go:generate struct-markdown //go:generate mapstructure-to-hcl2 -type Config -// The amazonebs package contains a packer.Builder implementation that +// The amazonebs package contains a packersdk.Builder implementation that // builds AMIs for Amazon EC2. // // In general, there are two types of AMIs that can be created: ebs-backed or diff --git a/builder/amazon/ebs/builder_test.go b/builder/amazon/ebs/builder_test.go index 341a57988..0035bb796 100644 --- a/builder/amazon/ebs/builder_test.go +++ b/builder/amazon/ebs/builder_test.go @@ -3,7 +3,7 @@ package ebs import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -21,7 +21,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/amazon/ebssurrogate/builder.go b/builder/amazon/ebssurrogate/builder.go index 565cd6875..fef187ef9 100644 --- a/builder/amazon/ebssurrogate/builder.go +++ b/builder/amazon/ebssurrogate/builder.go @@ -1,7 +1,7 @@ //go:generate struct-markdown //go:generate mapstructure-to-hcl2 -type Config,RootBlockDevice,BlockDevice -// The ebssurrogate package contains a packer.Builder implementation that +// The ebssurrogate package contains a packersdk.Builder implementation that // builds a new EBS-backed AMI using an ephemeral instance. package ebssurrogate diff --git a/builder/amazon/ebssurrogate/builder_test.go b/builder/amazon/ebssurrogate/builder_test.go index 33ad6756f..a913ada32 100644 --- a/builder/amazon/ebssurrogate/builder_test.go +++ b/builder/amazon/ebssurrogate/builder_test.go @@ -5,7 +5,7 @@ import ( "github.com/hashicorp/packer/builder/amazon/common" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -22,7 +22,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatal("Builder should be a builder") } } diff --git a/builder/amazon/ebsvolume/builder.go b/builder/amazon/ebsvolume/builder.go index fce769a0a..038200e59 100644 --- a/builder/amazon/ebsvolume/builder.go +++ b/builder/amazon/ebsvolume/builder.go @@ -1,7 +1,7 @@ //go:generate struct-markdown //go:generate mapstructure-to-hcl2 -type Config,BlockDevice -// The ebsvolume package contains a packer.Builder implementation that builds +// The ebsvolume package contains a packersdk.Builder implementation that builds // EBS volumes for Amazon EC2 using an ephemeral instance, package ebsvolume diff --git a/builder/amazon/ebsvolume/builder_test.go b/builder/amazon/ebsvolume/builder_test.go index 7b3865390..f2a7b8ce5 100644 --- a/builder/amazon/ebsvolume/builder_test.go +++ b/builder/amazon/ebsvolume/builder_test.go @@ -3,7 +3,7 @@ package ebsvolume import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -20,7 +20,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go index 278eed4f9..8f19471f7 100644 --- a/builder/amazon/instance/builder.go +++ b/builder/amazon/instance/builder.go @@ -1,7 +1,7 @@ //go:generate struct-markdown //go:generate mapstructure-to-hcl2 -type Config -// The instance package contains a packer.Builder implementation that builds +// The instance package contains a packersdk.Builder implementation that builds // AMIs for Amazon EC2 backed by instance storage, as opposed to EBS storage. package instance diff --git a/builder/amazon/instance/builder_test.go b/builder/amazon/instance/builder_test.go index 68c3d9786..539761b4d 100644 --- a/builder/amazon/instance/builder_test.go +++ b/builder/amazon/instance/builder_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() (config map[string]interface{}, tf *os.File) { @@ -33,7 +33,7 @@ func testConfig() (config map[string]interface{}, tf *os.File) { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/azure/chroot/builder.go b/builder/azure/chroot/builder.go index e546bb08f..b5a818793 100644 --- a/builder/azure/chroot/builder.go +++ b/builder/azure/chroot/builder.go @@ -18,7 +18,6 @@ import ( "github.com/hashicorp/hcl/v2/hcldec" azcommon "github.com/hashicorp/packer/builder/azure/common" "github.com/hashicorp/packer/builder/azure/common/client" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/chroot" "github.com/hashicorp/packer/packer-plugin-sdk/common" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" @@ -146,7 +145,7 @@ type Builder struct { } // verify interface implementation -var _ packer.Builder = &Builder{} +var _ packersdk.Builder = &Builder{} func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() } diff --git a/builder/cloudstack/builder.go b/builder/cloudstack/builder.go index f60354e44..0873504e0 100644 --- a/builder/cloudstack/builder.go +++ b/builder/cloudstack/builder.go @@ -32,7 +32,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { return nil, nil, nil } -// Run implements the packer.Builder interface. +// Run implements the packersdk.Builder interface. func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) { b.ui = ui diff --git a/builder/cloudstack/builder_test.go b/builder/cloudstack/builder_test.go index e6b94a4c0..31af3fd96 100644 --- a/builder/cloudstack/builder_test.go +++ b/builder/cloudstack/builder_test.go @@ -3,14 +3,14 @@ package cloudstack import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestBuilder_Impl(t *testing.T) { var raw interface{} = &Builder{} - if _, ok := raw.(packer.Builder); !ok { - t.Fatalf("Builder does not implement packer.Builder") + if _, ok := raw.(packersdk.Builder); !ok { + t.Fatalf("Builder does not implement packersdk.Builder") } } diff --git a/builder/digitalocean/builder.go b/builder/digitalocean/builder.go index 366980f7c..7a7ef9bc5 100644 --- a/builder/digitalocean/builder.go +++ b/builder/digitalocean/builder.go @@ -1,4 +1,4 @@ -// The digitalocean package contains a packer.Builder implementation +// The digitalocean package contains a packersdk.Builder implementation // that builds DigitalOcean images (snapshots). package digitalocean diff --git a/builder/digitalocean/builder_test.go b/builder/digitalocean/builder_test.go index a767d52b9..d49d4140e 100644 --- a/builder/digitalocean/builder_test.go +++ b/builder/digitalocean/builder_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -21,7 +21,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/docker/builder_test.go b/builder/docker/builder_test.go index 546d30dd4..4b4dc5c47 100644 --- a/builder/docker/builder_test.go +++ b/builder/docker/builder_test.go @@ -3,9 +3,9 @@ package docker import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestBuilder_implBuilder(t *testing.T) { - var _ packer.Builder = new(Builder) + var _ packersdk.Builder = new(Builder) } diff --git a/builder/file/builder_test.go b/builder/file/builder_test.go index 83501f9e6..ee1f4154e 100644 --- a/builder/file/builder_test.go +++ b/builder/file/builder_test.go @@ -6,12 +6,11 @@ import ( "testing" builderT "github.com/hashicorp/packer/helper/builder/testing" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestBuilder_implBuilder(t *testing.T) { - var _ packer.Builder = new(Builder) + var _ packersdk.Builder = new(Builder) } func TestBuilderFileAcc_content(t *testing.T) { diff --git a/builder/googlecompute/builder.go b/builder/googlecompute/builder.go index 4d3f4d605..8e2ece5e7 100644 --- a/builder/googlecompute/builder.go +++ b/builder/googlecompute/builder.go @@ -1,4 +1,4 @@ -// The googlecompute package contains a packer.Builder implementation that +// The googlecompute package contains a packersdk.Builder implementation that // builds images for Google Compute Engine. package googlecompute diff --git a/builder/hyperv/iso/builder.go b/builder/hyperv/iso/builder.go index c38c895df..b8adf10c8 100644 --- a/builder/hyperv/iso/builder.go +++ b/builder/hyperv/iso/builder.go @@ -45,7 +45,7 @@ const ( DefaultPassword = "" ) -// Builder implements packer.Builder and builds the actual Hyperv +// Builder implements packersdk.Builder and builds the actual Hyperv // images. type Builder struct { config Config diff --git a/builder/hyperv/iso/builder_test.go b/builder/hyperv/iso/builder_test.go index 2cbddd8eb..98732c577 100644 --- a/builder/hyperv/iso/builder_test.go +++ b/builder/hyperv/iso/builder_test.go @@ -33,7 +33,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Error("Builder must implement builder.") } } diff --git a/builder/hyperv/vmcx/builder.go b/builder/hyperv/vmcx/builder.go index bf8084327..8aa28eb34 100644 --- a/builder/hyperv/vmcx/builder.go +++ b/builder/hyperv/vmcx/builder.go @@ -36,7 +36,7 @@ const ( DefaultPassword = "" ) -// Builder implements packer.Builder and builds the actual Hyperv +// Builder implements packersdk.Builder and builds the actual Hyperv // images. type Builder struct { config Config diff --git a/builder/hyperv/vmcx/builder_test.go b/builder/hyperv/vmcx/builder_test.go index 58e7bc4dc..334d05005 100644 --- a/builder/hyperv/vmcx/builder_test.go +++ b/builder/hyperv/vmcx/builder_test.go @@ -32,7 +32,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Error("Builder must implement builder.") } } diff --git a/builder/linode/builder.go b/builder/linode/builder.go index e89c7cf8f..c0b7a1dbb 100644 --- a/builder/linode/builder.go +++ b/builder/linode/builder.go @@ -1,4 +1,4 @@ -// The linode package contains a packer.Builder implementation +// The linode package contains a packersdk.Builder implementation // that builds Linode images. package linode diff --git a/builder/linode/builder_test.go b/builder/linode/builder_test.go index d3e776ff0..f19a78615 100644 --- a/builder/linode/builder_test.go +++ b/builder/linode/builder_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -21,7 +21,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/lxc/builder_test.go b/builder/lxc/builder_test.go index 20108202d..2300a9aaf 100644 --- a/builder/lxc/builder_test.go +++ b/builder/lxc/builder_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -50,7 +50,7 @@ func TestBuilderPrepare_ConfigFile(t *testing.T) { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/lxd/builder_test.go b/builder/lxd/builder_test.go index a2277932c..07e5f8583 100644 --- a/builder/lxd/builder_test.go +++ b/builder/lxd/builder_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -71,7 +71,7 @@ func TestBuilderPrepare_ConfigFile(t *testing.T) { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/ncloud/builder.go b/builder/ncloud/builder.go index c3cabe03a..dfde5f3c4 100644 --- a/builder/ncloud/builder.go +++ b/builder/ncloud/builder.go @@ -11,7 +11,7 @@ import ( packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) -// Builder assume this implements packer.Builder +// Builder assume this implements packersdk.Builder type Builder struct { config Config stateBag multistep.StateBag diff --git a/builder/null/builder_test.go b/builder/null/builder_test.go index 89cf03a24..4be603dc8 100644 --- a/builder/null/builder_test.go +++ b/builder/null/builder_test.go @@ -3,9 +3,9 @@ package null import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestBuilder_implBuilder(t *testing.T) { - var _ packer.Builder = new(Builder) + var _ packersdk.Builder = new(Builder) } diff --git a/builder/oneandone/builder_test.go b/builder/oneandone/builder_test.go index 46045bf9d..50446e5e8 100644 --- a/builder/oneandone/builder_test.go +++ b/builder/oneandone/builder_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -19,7 +19,7 @@ func testConfig() map[string]interface{} { func TestImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/openstack/builder.go b/builder/openstack/builder.go index 08ce7ad20..af751789a 100644 --- a/builder/openstack/builder.go +++ b/builder/openstack/builder.go @@ -1,6 +1,6 @@ //go:generate mapstructure-to-hcl2 -type Config,ImageFilter,ImageFilterOptions -// The openstack package contains a packer.Builder implementation that +// The openstack package contains a packersdk.Builder implementation that // builds Images for openstack. package openstack diff --git a/builder/openstack/builder_test.go b/builder/openstack/builder_test.go index 0a9ac3288..4b838ba0a 100644 --- a/builder/openstack/builder_test.go +++ b/builder/openstack/builder_test.go @@ -3,13 +3,13 @@ package openstack import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/oracle/oci/builder.go b/builder/oracle/oci/builder.go index 8bab1f151..625c3dc47 100644 --- a/builder/oracle/oci/builder.go +++ b/builder/oracle/oci/builder.go @@ -1,4 +1,4 @@ -// Package oci contains a packer.Builder implementation that builds Oracle +// Package oci contains a packersdk.Builder implementation that builds Oracle // Bare Metal Cloud Services (OCI) images. package oci diff --git a/builder/oracle/oci/builder_test.go b/builder/oracle/oci/builder_test.go index 80500ef55..8772e8863 100644 --- a/builder/oracle/oci/builder_test.go +++ b/builder/oracle/oci/builder_test.go @@ -3,13 +3,13 @@ package oci import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/osc/bsu/builder.go b/builder/osc/bsu/builder.go index 2694c5697..175a1a8ee 100644 --- a/builder/osc/bsu/builder.go +++ b/builder/osc/bsu/builder.go @@ -1,6 +1,6 @@ //go:generate mapstructure-to-hcl2 -type Config -// Package bsu contains a packer.Builder implementation that +// Package bsu contains a packersdk.Builder implementation that // builds OMIs for Outscale OAPI. // // In general, there are two types of OMIs that can be created: ebs-backed or diff --git a/builder/osc/bsu/builder_test.go b/builder/osc/bsu/builder_test.go index c700ccc06..61f09eea1 100644 --- a/builder/osc/bsu/builder_test.go +++ b/builder/osc/bsu/builder_test.go @@ -3,7 +3,7 @@ package bsu import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -21,7 +21,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/osc/bsusurrogate/builder.go b/builder/osc/bsusurrogate/builder.go index bb3379a61..03ff06027 100644 --- a/builder/osc/bsusurrogate/builder.go +++ b/builder/osc/bsusurrogate/builder.go @@ -1,6 +1,6 @@ //go:generate mapstructure-to-hcl2 -type Config,RootBlockDevice -// Package bsusurrogate contains a packer.Builder implementation that +// Package bsusurrogate contains a packersdk.Builder implementation that // builds a new EBS-backed OMI using an ephemeral instance. package bsusurrogate diff --git a/builder/osc/bsusurrogate/builder_test.go b/builder/osc/bsusurrogate/builder_test.go index d91f46af8..329aa23eb 100644 --- a/builder/osc/bsusurrogate/builder_test.go +++ b/builder/osc/bsusurrogate/builder_test.go @@ -3,13 +3,13 @@ package bsusurrogate import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatal("Builder should be a builder") } } diff --git a/builder/osc/bsuvolume/builder.go b/builder/osc/bsuvolume/builder.go index 76ed194e9..07a34d00a 100644 --- a/builder/osc/bsuvolume/builder.go +++ b/builder/osc/bsuvolume/builder.go @@ -1,6 +1,6 @@ //go:generate mapstructure-to-hcl2 -type Config,BlockDevice -// The ebsvolume package contains a packer.Builder implementation that +// The ebsvolume package contains a packersdk.Builder implementation that // builds EBS volumes for Outscale using an ephemeral instance, package bsuvolume diff --git a/builder/osc/bsuvolume/builder_test.go b/builder/osc/bsuvolume/builder_test.go index 27c4a80c0..0d48f9734 100644 --- a/builder/osc/bsuvolume/builder_test.go +++ b/builder/osc/bsuvolume/builder_test.go @@ -3,7 +3,7 @@ package bsuvolume import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -20,7 +20,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/parallels/iso/builder_test.go b/builder/parallels/iso/builder_test.go index 00e92c2f7..b56e57e7d 100644 --- a/builder/parallels/iso/builder_test.go +++ b/builder/parallels/iso/builder_test.go @@ -24,7 +24,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Error("Builder must implement builder.") } } diff --git a/builder/parallels/pvm/builder.go b/builder/parallels/pvm/builder.go index 6e9aad514..3a3fcb6e1 100644 --- a/builder/parallels/pvm/builder.go +++ b/builder/parallels/pvm/builder.go @@ -13,7 +13,7 @@ import ( packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) -// Builder implements packer.Builder and builds the actual Parallels +// Builder implements packersdk.Builder and builds the actual Parallels // images. type Builder struct { config Config diff --git a/builder/profitbricks/builder_test.go b/builder/profitbricks/builder_test.go index f16953a33..c91998581 100644 --- a/builder/profitbricks/builder_test.go +++ b/builder/profitbricks/builder_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -20,7 +20,7 @@ func testConfig() map[string]interface{} { func TestImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/proxmox/clone/builder.go b/builder/proxmox/clone/builder.go index 45be41a9d..772ee1fa4 100644 --- a/builder/proxmox/clone/builder.go +++ b/builder/proxmox/clone/builder.go @@ -4,7 +4,6 @@ import ( proxmoxapi "github.com/Telmate/proxmox-api-go/proxmox" "github.com/hashicorp/hcl/v2/hcldec" proxmox "github.com/hashicorp/packer/builder/proxmox/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" @@ -19,8 +18,8 @@ type Builder struct { config Config } -// Builder implements packer.Builder -var _ packer.Builder = &Builder{} +// Builder implements packersdk.Builder +var _ packersdk.Builder = &Builder{} func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() } diff --git a/builder/proxmox/iso/builder.go b/builder/proxmox/iso/builder.go index 3eadef1f1..0a90b9173 100644 --- a/builder/proxmox/iso/builder.go +++ b/builder/proxmox/iso/builder.go @@ -6,7 +6,6 @@ import ( proxmoxapi "github.com/Telmate/proxmox-api-go/proxmox" "github.com/hashicorp/hcl/v2/hcldec" proxmox "github.com/hashicorp/packer/builder/proxmox/common" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" @@ -19,8 +18,8 @@ type Builder struct { config Config } -// Builder implements packer.Builder -var _ packer.Builder = &Builder{} +// Builder implements packersdk.Builder +var _ packersdk.Builder = &Builder{} func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() } diff --git a/builder/qemu/builder_test.go b/builder/qemu/builder_test.go index 2efb1f612..09f1a7d64 100644 --- a/builder/qemu/builder_test.go +++ b/builder/qemu/builder_test.go @@ -3,13 +3,13 @@ package qemu import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Error("Builder must implement builder.") } } diff --git a/builder/scaleway/builder.go b/builder/scaleway/builder.go index 960aba889..e0de084b9 100644 --- a/builder/scaleway/builder.go +++ b/builder/scaleway/builder.go @@ -1,4 +1,4 @@ -// The scaleway package contains a packer.Builder implementation +// The scaleway package contains a packersdk.Builder implementation // that builds Scaleway images (snapshots). package scaleway diff --git a/builder/scaleway/builder_test.go b/builder/scaleway/builder_test.go index e223d6e42..a044cc1b8 100644 --- a/builder/scaleway/builder_test.go +++ b/builder/scaleway/builder_test.go @@ -4,7 +4,7 @@ import ( "strconv" "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -22,7 +22,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/ucloud/uhost/builder.go b/builder/ucloud/uhost/builder.go index 491f1e76d..32c14c241 100644 --- a/builder/ucloud/uhost/builder.go +++ b/builder/ucloud/uhost/builder.go @@ -1,6 +1,6 @@ //go:generate mapstructure-to-hcl2 -type Config -// The ucloud-uhost contains a packer.Builder implementation that +// The ucloud-uhost contains a packersdk.Builder implementation that // builds uhost images for UCloud UHost instance. package uhost diff --git a/builder/ucloud/uhost/builder_test.go b/builder/ucloud/uhost/builder_test.go index cbc8d1d4e..f227ef9cf 100644 --- a/builder/ucloud/uhost/builder_test.go +++ b/builder/ucloud/uhost/builder_test.go @@ -5,7 +5,7 @@ import ( "testing" ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testBuilderConfig() map[string]interface{} { @@ -25,7 +25,7 @@ func testBuilderConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/vagrant/builder.go b/builder/vagrant/builder.go index 9499f0df7..c978f5ce2 100644 --- a/builder/vagrant/builder.go +++ b/builder/vagrant/builder.go @@ -24,7 +24,7 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate" ) -// Builder implements packer.Builder and builds the actual VirtualBox +// Builder implements packersdk.Builder and builds the actual VirtualBox // images. type Builder struct { config Config diff --git a/builder/vagrant/builder_test.go b/builder/vagrant/builder_test.go index 177e81c0f..59030f520 100644 --- a/builder/vagrant/builder_test.go +++ b/builder/vagrant/builder_test.go @@ -3,13 +3,13 @@ package vagrant import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/virtualbox/iso/acceptance/builder_acceptance.go b/builder/virtualbox/iso/acceptance/builder_acceptance.go index c31fd90d6..08bc889db 100644 --- a/builder/virtualbox/iso/acceptance/builder_acceptance.go +++ b/builder/virtualbox/iso/acceptance/builder_acceptance.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/packer/builder/virtualbox/iso" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" testshelper "github.com/hashicorp/packer/helper/tests" ) @@ -41,6 +42,6 @@ func (v *VirtualBoxISOAccTest) CleanUp() error { func (v *VirtualBoxISOAccTest) GetBuilderStore() packer.MapOfBuilder { return packer.MapOfBuilder{ - "virtualbox-iso": func() (packer.Builder, error) { return &iso.Builder{}, nil }, + "virtualbox-iso": func() (packersdk.Builder, error) { return &iso.Builder{}, nil }, } } diff --git a/builder/virtualbox/iso/builder_test.go b/builder/virtualbox/iso/builder_test.go index d10d6f1b7..982cf784b 100644 --- a/builder/virtualbox/iso/builder_test.go +++ b/builder/virtualbox/iso/builder_test.go @@ -24,7 +24,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Error("Builder must implement builder.") } } diff --git a/builder/virtualbox/ovf/builder.go b/builder/virtualbox/ovf/builder.go index 098570d3e..2ecb4a7b7 100644 --- a/builder/virtualbox/ovf/builder.go +++ b/builder/virtualbox/ovf/builder.go @@ -13,7 +13,7 @@ import ( packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) -// Builder implements packer.Builder and builds the actual VirtualBox +// Builder implements packersdk.Builder and builds the actual VirtualBox // images. type Builder struct { config Config diff --git a/builder/virtualbox/vm/builder.go b/builder/virtualbox/vm/builder.go index 8e5f9ef71..c8613e271 100644 --- a/builder/virtualbox/vm/builder.go +++ b/builder/virtualbox/vm/builder.go @@ -13,7 +13,7 @@ import ( packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) -// Builder implements packer.Builder and builds the actual VirtualBox +// Builder implements packersdk.Builder and builds the actual VirtualBox // images. type Builder struct { config Config diff --git a/builder/vmware/iso/builder_test.go b/builder/vmware/iso/builder_test.go index 55f7fc757..05e1e223d 100644 --- a/builder/vmware/iso/builder_test.go +++ b/builder/vmware/iso/builder_test.go @@ -25,7 +25,7 @@ func testConfig() map[string]interface{} { func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Error("Builder must implement builder.") } } diff --git a/builder/vmware/iso/step_create_vmx_test.go b/builder/vmware/iso/step_create_vmx_test.go index dad326b2a..bef646c65 100644 --- a/builder/vmware/iso/step_create_vmx_test.go +++ b/builder/vmware/iso/step_create_vmx_test.go @@ -139,16 +139,16 @@ func setupVMwareBuild(t *testing.T, builderConfig map[string]string, provisioner // create our config to test the vmware-iso builder components := packer.ComponentFinder{ BuilderStore: packer.MapOfBuilder{ - "vmware-iso": func() (packer.Builder, error) { return &Builder{}, nil }, + "vmware-iso": func() (packersdk.Builder, error) { return &Builder{}, nil }, }, Hook: func(n string) (packersdk.Hook, error) { return &packersdk.DispatchHook{}, nil }, ProvisionerStore: packer.MapOfProvisioner{ - "shell": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil }, + "shell": func() (packersdk.Provisioner, error) { return &shell.Provisioner{}, nil }, }, PostProcessorStore: packer.MapOfPostProcessor{ - "something": func() (packer.PostProcessor, error) { return &packer.MockPostProcessor{}, nil }, + "something": func() (packersdk.PostProcessor, error) { return &packer.MockPostProcessor{}, nil }, }, } config := packer.CoreConfig{ diff --git a/builder/vmware/vmx/builder.go b/builder/vmware/vmx/builder.go index e36c2711b..366b6fd0c 100644 --- a/builder/vmware/vmx/builder.go +++ b/builder/vmware/vmx/builder.go @@ -15,7 +15,7 @@ import ( packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) -// Builder implements packer.Builder and builds the actual VMware +// Builder implements packersdk.Builder and builds the actual VMware // images. type Builder struct { config Config diff --git a/builder/vsphere/clone/builder_test.go b/builder/vsphere/clone/builder_test.go index 5f57eb7ad..e72e9f10b 100644 --- a/builder/vsphere/clone/builder_test.go +++ b/builder/vsphere/clone/builder_test.go @@ -3,13 +3,13 @@ package clone import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestCloneBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} raw = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/builder/yandex/builder_test.go b/builder/yandex/builder_test.go index bbb3bfa51..bb9a4775b 100644 --- a/builder/yandex/builder_test.go +++ b/builder/yandex/builder_test.go @@ -3,12 +3,12 @@ package yandex import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestBuilder_ImplementsBuilder(t *testing.T) { var raw interface{} = &Builder{} - if _, ok := raw.(packer.Builder); !ok { + if _, ok := raw.(packersdk.Builder); !ok { t.Fatalf("Builder should be a builder") } } diff --git a/command/build_parallel_test.go b/command/build_parallel_test.go index 815350375..00b43258f 100644 --- a/command/build_parallel_test.go +++ b/command/build_parallel_test.go @@ -69,12 +69,12 @@ func testMetaParallel(t *testing.T, builder *ParallelTestBuilder, locked *Locked CoreConfig: &packer.CoreConfig{ Components: packer.ComponentFinder{ BuilderStore: packer.MapOfBuilder{ - "parallel-test": func() (packer.Builder, error) { return builder, nil }, - "file": func() (packer.Builder, error) { return &file.Builder{}, nil }, - "lock": func() (packer.Builder, error) { return locked, nil }, + "parallel-test": func() (packersdk.Builder, error) { return builder, nil }, + "file": func() (packersdk.Builder, error) { return &file.Builder{}, nil }, + "lock": func() (packersdk.Builder, error) { return locked, nil }, }, ProvisionerStore: packer.MapOfProvisioner{ - "sleep": func() (packer.Provisioner, error) { return &sleep.Provisioner{}, nil }, + "sleep": func() (packersdk.Provisioner, error) { return &sleep.Provisioner{}, nil }, }, }, }, diff --git a/command/build_test.go b/command/build_test.go index c67505ad7..b5d9694c9 100644 --- a/command/build_test.go +++ b/command/build_test.go @@ -837,17 +837,17 @@ func fileExists(filename string) bool { func testCoreConfigBuilder(t *testing.T) *packer.CoreConfig { components := packer.ComponentFinder{ BuilderStore: packer.MapOfBuilder{ - "file": func() (packer.Builder, error) { return &file.Builder{}, nil }, - "null": func() (packer.Builder, error) { return &null.Builder{}, nil }, + "file": func() (packersdk.Builder, error) { return &file.Builder{}, nil }, + "null": func() (packersdk.Builder, error) { return &null.Builder{}, nil }, }, ProvisionerStore: packer.MapOfProvisioner{ - "shell-local": func() (packer.Provisioner, error) { return &shell_local.Provisioner{}, nil }, - "shell": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil }, - "file": func() (packer.Provisioner, error) { return &filep.Provisioner{}, nil }, + "shell-local": func() (packersdk.Provisioner, error) { return &shell_local.Provisioner{}, nil }, + "shell": func() (packersdk.Provisioner, error) { return &shell.Provisioner{}, nil }, + "file": func() (packersdk.Provisioner, error) { return &filep.Provisioner{}, nil }, }, PostProcessorStore: packer.MapOfPostProcessor{ - "shell-local": func() (packer.PostProcessor, error) { return &shell_local_pp.PostProcessor{}, nil }, - "manifest": func() (packer.PostProcessor, error) { return &manifest.PostProcessor{}, nil }, + "shell-local": func() (packersdk.PostProcessor, error) { return &shell_local_pp.PostProcessor{}, nil }, + "manifest": func() (packersdk.PostProcessor, error) { return &manifest.PostProcessor{}, nil }, }, } return &packer.CoreConfig{ diff --git a/command/build_timeout_test.go b/command/build_timeout_test.go index 4fde04aea..59b4c2b3f 100644 --- a/command/build_timeout_test.go +++ b/command/build_timeout_test.go @@ -17,11 +17,11 @@ import ( func testCoreConfigSleepBuilder(t *testing.T) *packer.CoreConfig { components := packer.ComponentFinder{ BuilderStore: packer.MapOfBuilder{ - "file": func() (packer.Builder, error) { return &file.Builder{}, nil }, + "file": func() (packersdk.Builder, error) { return &file.Builder{}, nil }, }, ProvisionerStore: packer.MapOfProvisioner{ - "sleep": func() (packer.Provisioner, error) { return &sleep.Provisioner{}, nil }, - "shell-local": func() (packer.Provisioner, error) { return &shell_local.Provisioner{}, nil }, + "sleep": func() (packersdk.Provisioner, error) { return &sleep.Provisioner{}, nil }, + "shell-local": func() (packersdk.Provisioner, error) { return &shell_local.Provisioner{}, nil }, }, } return &packer.CoreConfig{ diff --git a/command/exec_test.go b/command/exec_test.go index 8a13b5e76..8f3d2d345 100644 --- a/command/exec_test.go +++ b/command/exec_test.go @@ -119,18 +119,18 @@ func commandMeta() Meta { func getBareComponentFinder() packer.ComponentFinder { return packer.ComponentFinder{ BuilderStore: packer.MapOfBuilder{ - "file": func() (packer.Builder, error) { return &file.Builder{}, nil }, - "null": func() (packer.Builder, error) { return &null.Builder{}, nil }, - "amazon-ebs": func() (packer.Builder, error) { return &ebs.Builder{}, nil }, + "file": func() (packersdk.Builder, error) { return &file.Builder{}, nil }, + "null": func() (packersdk.Builder, error) { return &null.Builder{}, nil }, + "amazon-ebs": func() (packersdk.Builder, error) { return &ebs.Builder{}, nil }, }, ProvisionerStore: packer.MapOfProvisioner{ - "shell-local": func() (packer.Provisioner, error) { return &shell_local.Provisioner{}, nil }, - "shell": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil }, - "file": func() (packer.Provisioner, error) { return &filep.Provisioner{}, nil }, + "shell-local": func() (packersdk.Provisioner, error) { return &shell_local.Provisioner{}, nil }, + "shell": func() (packersdk.Provisioner, error) { return &shell.Provisioner{}, nil }, + "file": func() (packersdk.Provisioner, error) { return &filep.Provisioner{}, nil }, }, PostProcessorStore: packer.MapOfPostProcessor{ - "shell-local": func() (packer.PostProcessor, error) { return &shell_local_pp.PostProcessor{}, nil }, - "manifest": func() (packer.PostProcessor, error) { return &manifest.PostProcessor{}, nil }, + "shell-local": func() (packersdk.PostProcessor, error) { return &shell_local_pp.PostProcessor{}, nil }, + "manifest": func() (packersdk.PostProcessor, error) { return &manifest.PostProcessor{}, nil }, }, } } diff --git a/command/plugin.go b/command/plugin.go index b3bf09bc7..d557c8449 100644 --- a/command/plugin.go +++ b/command/plugin.go @@ -10,7 +10,7 @@ import ( "regexp" "strings" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer/plugin" alicloudecsbuilder "github.com/hashicorp/packer/builder/alicloud/ecs" @@ -111,7 +111,7 @@ type PluginCommand struct { Meta } -var Builders = map[string]packer.Builder{ +var Builders = map[string]packersdk.Builder{ "alicloud-ecs": new(alicloudecsbuilder.Builder), "amazon-chroot": new(amazonchrootbuilder.Builder), "amazon-ebs": new(amazonebsbuilder.Builder), @@ -166,7 +166,7 @@ var Builders = map[string]packer.Builder{ "yandex": new(yandexbuilder.Builder), } -var Provisioners = map[string]packer.Provisioner{ +var Provisioners = map[string]packersdk.Provisioner{ "ansible": new(ansibleprovisioner.Provisioner), "ansible-local": new(ansiblelocalprovisioner.Provisioner), "azure-dtlartifact": new(azuredtlartifactprovisioner.Provisioner), @@ -187,7 +187,7 @@ var Provisioners = map[string]packer.Provisioner{ "windows-shell": new(windowsshellprovisioner.Provisioner), } -var PostProcessors = map[string]packer.PostProcessor{ +var PostProcessors = map[string]packersdk.PostProcessor{ "alicloud-import": new(alicloudimportpostprocessor.PostProcessor), "amazon-import": new(amazonimportpostprocessor.PostProcessor), "artifice": new(artificepostprocessor.PostProcessor), diff --git a/config.go b/config.go index 5c54f8e80..75f601bb2 100644 --- a/config.go +++ b/config.go @@ -98,17 +98,17 @@ func (c *config) loadSingleComponent(path string) (string, error) { switch { case strings.HasPrefix(pluginName, "packer-builder-"): pluginName = pluginName[len("packer-builder-"):] - c.Builders[pluginName] = func() (packer.Builder, error) { + c.Builders[pluginName] = func() (packersdk.Builder, error) { return c.pluginClient(path).Builder() } case strings.HasPrefix(pluginName, "packer-post-processor-"): pluginName = pluginName[len("packer-post-processor-"):] - c.PostProcessors[pluginName] = func() (packer.PostProcessor, error) { + c.PostProcessors[pluginName] = func() (packersdk.PostProcessor, error) { return c.pluginClient(path).PostProcessor() } case strings.HasPrefix(pluginName, "packer-provisioner-"): pluginName = pluginName[len("packer-provisioner-"):] - c.Provisioners[pluginName] = func() (packer.Provisioner, error) { + c.Provisioners[pluginName] = func() (packersdk.Provisioner, error) { return c.pluginClient(path).Provisioner() } } @@ -180,9 +180,9 @@ func (c *config) Discover() error { return nil } -// This is a proper packer.BuilderFunc that can be used to load packer.Builder +// This is a proper packer.BuilderFunc that can be used to load packersdk.Builder // implementations from the defined plugins. -func (c *config) StartBuilder(name string) (packer.Builder, error) { +func (c *config) StartBuilder(name string) (packersdk.Builder, error) { log.Printf("Loading builder: %s\n", name) return c.Builders.Start(name) } @@ -194,16 +194,16 @@ func (c *config) StarHook(name string) (packersdk.Hook, error) { return c.pluginClient(name).Hook() } -// This is a proper packer.PostProcessorFunc that can be used to load -// packer.PostProcessor implementations from defined plugins. -func (c *config) StartPostProcessor(name string) (packer.PostProcessor, error) { +// This is a proper packersdk.PostProcessorFunc that can be used to load +// packersdk.PostProcessor implementations from defined plugins. +func (c *config) StartPostProcessor(name string) (packersdk.PostProcessor, error) { log.Printf("Loading post-processor: %s", name) return c.PostProcessors.Start(name) } // This is a proper packer.ProvisionerFunc that can be used to load // packer.Provisioner implementations from defined plugins. -func (c *config) StartProvisioner(name string) (packer.Provisioner, error) { +func (c *config) StartProvisioner(name string) (packersdk.Provisioner, error) { log.Printf("Loading provisioner: %s\n", name) return c.Provisioners.Start(name) } @@ -225,7 +225,7 @@ func (c *config) discoverExternalComponents(path string) error { } for pluginName, pluginPath := range pluginPaths { newPath := pluginPath // this needs to be stored in a new variable for the func below - c.Builders[pluginName] = func() (packer.Builder, error) { + c.Builders[pluginName] = func() (packersdk.Builder, error) { return c.pluginClient(newPath).Builder() } externallyUsed = append(externallyUsed, pluginName) @@ -242,7 +242,7 @@ func (c *config) discoverExternalComponents(path string) error { } for pluginName, pluginPath := range pluginPaths { newPath := pluginPath // this needs to be stored in a new variable for the func below - c.PostProcessors[pluginName] = func() (packer.PostProcessor, error) { + c.PostProcessors[pluginName] = func() (packersdk.PostProcessor, error) { return c.pluginClient(newPath).PostProcessor() } externallyUsed = append(externallyUsed, pluginName) @@ -259,7 +259,7 @@ func (c *config) discoverExternalComponents(path string) error { } for pluginName, pluginPath := range pluginPaths { newPath := pluginPath // this needs to be stored in a new variable for the func below - c.Provisioners[pluginName] = func() (packer.Provisioner, error) { + c.Provisioners[pluginName] = func() (packersdk.Provisioner, error) { return c.pluginClient(newPath).Provisioner() } externallyUsed = append(externallyUsed, pluginName) @@ -321,7 +321,7 @@ func (c *config) discoverInternalComponents() error { builder := builder _, found := (c.Builders)[builder] if !found { - c.Builders[builder] = func() (packer.Builder, error) { + c.Builders[builder] = func() (packersdk.Builder, error) { bin := fmt.Sprintf("%s%splugin%spacker-builder-%s", packerPath, PACKERSPACE, PACKERSPACE, builder) return c.pluginClient(bin).Builder() @@ -333,7 +333,7 @@ func (c *config) discoverInternalComponents() error { provisioner := provisioner _, found := (c.Provisioners)[provisioner] if !found { - c.Provisioners[provisioner] = func() (packer.Provisioner, error) { + c.Provisioners[provisioner] = func() (packersdk.Provisioner, error) { bin := fmt.Sprintf("%s%splugin%spacker-provisioner-%s", packerPath, PACKERSPACE, PACKERSPACE, provisioner) return c.pluginClient(bin).Provisioner() @@ -345,7 +345,7 @@ func (c *config) discoverInternalComponents() error { postProcessor := postProcessor _, found := (c.PostProcessors)[postProcessor] if !found { - c.PostProcessors[postProcessor] = func() (packer.PostProcessor, error) { + c.PostProcessors[postProcessor] = func() (packersdk.PostProcessor, error) { bin := fmt.Sprintf("%s%splugin%spacker-post-processor-%s", packerPath, PACKERSPACE, PACKERSPACE, postProcessor) return c.pluginClient(bin).PostProcessor() diff --git a/hcl2template/common_test.go b/hcl2template/common_test.go index ac65ac3e7..b0eb30aa4 100644 --- a/hcl2template/common_test.go +++ b/hcl2template/common_test.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/packer/builder/null" . "github.com/hashicorp/packer/hcl2template/internal" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/zclconf/go-cty/cty" ) @@ -20,17 +21,17 @@ func getBasicParser() *Parser { return &Parser{ Parser: hclparse.NewParser(), BuilderSchemas: packer.MapOfBuilder{ - "amazon-ebs": func() (packer.Builder, error) { return &MockBuilder{}, nil }, - "virtualbox-iso": func() (packer.Builder, error) { return &MockBuilder{}, nil }, - "null": func() (packer.Builder, error) { return &null.Builder{}, nil }, + "amazon-ebs": func() (packersdk.Builder, error) { return &MockBuilder{}, nil }, + "virtualbox-iso": func() (packersdk.Builder, error) { return &MockBuilder{}, nil }, + "null": func() (packersdk.Builder, error) { return &null.Builder{}, nil }, }, ProvisionersSchemas: packer.MapOfProvisioner{ - "shell": func() (packer.Provisioner, error) { return &MockProvisioner{}, nil }, - "file": func() (packer.Provisioner, error) { return &MockProvisioner{}, nil }, + "shell": func() (packersdk.Provisioner, error) { return &MockProvisioner{}, nil }, + "file": func() (packersdk.Provisioner, error) { return &MockProvisioner{}, nil }, }, PostProcessorsSchemas: packer.MapOfPostProcessor{ - "amazon-import": func() (packer.PostProcessor, error) { return &MockPostProcessor{}, nil }, - "manifest": func() (packer.PostProcessor, error) { return &MockPostProcessor{}, nil }, + "amazon-import": func() (packersdk.PostProcessor, error) { return &MockPostProcessor{}, nil }, + "manifest": func() (packersdk.PostProcessor, error) { return &MockPostProcessor{}, nil }, }, } } diff --git a/hcl2template/internal/mock.go b/hcl2template/internal/mock.go index 0bc620e54..c6d7bcce8 100644 --- a/hcl2template/internal/mock.go +++ b/hcl2template/internal/mock.go @@ -7,7 +7,6 @@ import ( "time" "github.com/hashicorp/hcl/v2/hcldec" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/zclconf/go-cty/cty" @@ -70,7 +69,7 @@ type MockBuilder struct { Config MockConfig } -var _ packer.Builder = new(MockBuilder) +var _ packersdk.Builder = new(MockBuilder) func (b *MockBuilder) ConfigSpec() hcldec.ObjectSpec { return b.Config.FlatMapstructure().HCL2Spec() } @@ -90,7 +89,7 @@ type MockProvisioner struct { Config MockConfig } -var _ packer.Provisioner = new(MockProvisioner) +var _ packersdk.Provisioner = new(MockProvisioner) func (b *MockProvisioner) ConfigSpec() hcldec.ObjectSpec { return b.Config.FlatMapstructure().HCL2Spec() @@ -112,7 +111,7 @@ type MockPostProcessor struct { Config MockConfig } -var _ packer.PostProcessor = new(MockPostProcessor) +var _ packersdk.PostProcessor = new(MockPostProcessor) func (b *MockPostProcessor) ConfigSpec() hcldec.ObjectSpec { return b.Config.FlatMapstructure().HCL2Spec() diff --git a/hcl2template/types.build.post-processor.go b/hcl2template/types.build.post-processor.go index fcfa2dc0e..4b91f2533 100644 --- a/hcl2template/types.build.post-processor.go +++ b/hcl2template/types.build.post-processor.go @@ -5,7 +5,7 @@ import ( "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/gohcl" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // ProvisionerBlock references a detected but unparsed post processor @@ -61,7 +61,7 @@ func (p *Parser) decodePostProcessor(block *hcl.Block) (*PostProcessorBlock, hcl return postProcessor, diags } -func (cfg *PackerConfig) startPostProcessor(source SourceBlock, pp *PostProcessorBlock, ectx *hcl.EvalContext) (packer.PostProcessor, hcl.Diagnostics) { +func (cfg *PackerConfig) startPostProcessor(source SourceBlock, pp *PostProcessorBlock, ectx *hcl.EvalContext) (packersdk.PostProcessor, hcl.Diagnostics) { // ProvisionerBlock represents a detected but unparsed provisioner var diags hcl.Diagnostics diff --git a/hcl2template/types.build.provisioners.go b/hcl2template/types.build.provisioners.go index a50156782..da3253ba7 100644 --- a/hcl2template/types.build.provisioners.go +++ b/hcl2template/types.build.provisioners.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/gohcl" hcl2shim "github.com/hashicorp/packer/hcl2template/shim" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/zclconf/go-cty/cty" ) @@ -148,7 +148,7 @@ func (p *Parser) decodeProvisioner(block *hcl.Block, cfg *PackerConfig) (*Provis return provisioner, diags } -func (cfg *PackerConfig) startProvisioner(source SourceBlock, pb *ProvisionerBlock, ectx *hcl.EvalContext) (packer.Provisioner, hcl.Diagnostics) { +func (cfg *PackerConfig) startProvisioner(source SourceBlock, pb *ProvisionerBlock, ectx *hcl.EvalContext) (packersdk.Provisioner, hcl.Diagnostics) { var diags hcl.Diagnostics provisioner, err := cfg.provisionersSchemas.Start(pb.PType) diff --git a/hcl2template/types.hcl_post-processor.go b/hcl2template/types.hcl_post-processor.go index 43e35a021..ce279b72f 100644 --- a/hcl2template/types.hcl_post-processor.go +++ b/hcl2template/types.hcl_post-processor.go @@ -6,7 +6,6 @@ import ( "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/hcldec" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/zclconf/go-cty/cty" ) @@ -16,7 +15,7 @@ import ( // calling PostProcess: with contextual variables. // This permits using "${build.ID}" values for example. type HCL2PostProcessor struct { - PostProcessor packer.PostProcessor + PostProcessor packersdk.PostProcessor postProcessorBlock *PostProcessorBlock evalContext *hcl.EvalContext builderVariables map[string]string diff --git a/hcl2template/types.hcl_provisioner.go b/hcl2template/types.hcl_provisioner.go index d7cfcbd80..c52fb31be 100644 --- a/hcl2template/types.hcl_provisioner.go +++ b/hcl2template/types.hcl_provisioner.go @@ -6,7 +6,6 @@ import ( "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/hcldec" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/zclconf/go-cty/cty" ) @@ -16,7 +15,7 @@ import ( // calling Provision: with contextual variables. // This permits using "${build.ID}" values for example. type HCL2Provisioner struct { - Provisioner packer.Provisioner + Provisioner packersdk.Provisioner provisionerBlock *ProvisionerBlock evalContext *hcl.EvalContext builderVariables map[string]string diff --git a/hcl2template/types.source.go b/hcl2template/types.source.go index 076d83d1b..3a8be02fe 100644 --- a/hcl2template/types.source.go +++ b/hcl2template/types.source.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/gohcl" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/zclconf/go-cty/cty" ) @@ -88,7 +89,7 @@ func (p *Parser) decodeSource(block *hcl.Block) (SourceBlock, hcl.Diagnostics) { return source, diags } -func (cfg *PackerConfig) startBuilder(source SourceBlock, ectx *hcl.EvalContext, opts packer.GetBuildsOptions) (packer.Builder, hcl.Diagnostics, []string) { +func (cfg *PackerConfig) startBuilder(source SourceBlock, ectx *hcl.EvalContext, opts packer.GetBuildsOptions) (packersdk.Builder, hcl.Diagnostics, []string) { var diags hcl.Diagnostics builder, err := cfg.builderSchemas.Start(source.Type) diff --git a/helper/builder/testing/testing.go b/helper/builder/testing/testing.go index 37089c158..746147866 100644 --- a/helper/builder/testing/testing.go +++ b/helper/builder/testing/testing.go @@ -28,7 +28,7 @@ type TestCase struct { // Builder is the Builder that will be tested. It will be available // as the "test" builder in the template. - Builder packer.Builder + Builder packersdk.Builder // Template is the template contents to use. Template string @@ -66,10 +66,10 @@ type TestT interface { type TestBuilderStore struct { packer.BuilderStore - StartFn func(name string) (packer.Builder, error) + StartFn func(name string) (packersdk.Builder, error) } -func (tbs TestBuilderStore) Start(name string) (packer.Builder, error) { return tbs.StartFn(name) } +func (tbs TestBuilderStore) Start(name string) (packersdk.Builder, error) { return tbs.StartFn(name) } // Test performs an acceptance test on a backend with the given test case. // @@ -115,7 +115,7 @@ func Test(t TestT, c TestCase) { core := packer.NewCore(&packer.CoreConfig{ Components: packer.ComponentFinder{ BuilderStore: TestBuilderStore{ - StartFn: func(n string) (packer.Builder, error) { + StartFn: func(n string) (packersdk.Builder, error) { if n == "test" { return c.Builder, nil } diff --git a/helper/tests/core.go b/helper/tests/core.go index 88e6e6b49..87b19d0b5 100644 --- a/helper/tests/core.go +++ b/helper/tests/core.go @@ -26,11 +26,11 @@ func FileExists(filename string) bool { func testCoreConfigBuilder(t *testing.T) *packer.CoreConfig { components := packer.ComponentFinder{ BuilderStore: packer.MapOfBuilder{ - "amazon-ebs": func() (packer.Builder, error) { return &amazonebsbuilder.Builder{}, nil }, + "amazon-ebs": func() (packersdk.Builder, error) { return &amazonebsbuilder.Builder{}, nil }, }, ProvisionerStore: packer.MapOfProvisioner{ - "shell": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil }, - "file": func() (packer.Provisioner, error) { return &fileprovisioner.Provisioner{}, nil }, + "shell": func() (packersdk.Provisioner, error) { return &shell.Provisioner{}, nil }, + "file": func() (packersdk.Provisioner, error) { return &fileprovisioner.Provisioner{}, nil }, }, PostProcessorStore: packer.MapOfPostProcessor{}, } diff --git a/packer/builder.go b/packer-plugin-sdk/packer/builder.go similarity index 90% rename from packer/builder.go rename to packer-plugin-sdk/packer/builder.go index 586ae4a4e..11bdc3046 100644 --- a/packer/builder.go +++ b/packer-plugin-sdk/packer/builder.go @@ -2,8 +2,6 @@ package packer import ( "context" - - packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Implementers of Builder are responsible for actually building images @@ -17,7 +15,7 @@ import ( // parallelism is strictly disabled, so it is safe to request input from // stdin and so on. type Builder interface { - packersdk.HCL2Speccer + HCL2Speccer // Prepare is responsible for configuring the builder and validating // that configuration. Any setup should be done in this method. Note that @@ -37,5 +35,5 @@ type Builder interface { Prepare(...interface{}) ([]string, []string, error) // Run is where the actual build should take place. It takes a Build and a Ui. - Run(context.Context, packersdk.Ui, packersdk.Hook) (packersdk.Artifact, error) + Run(context.Context, Ui, Hook) (Artifact, error) } diff --git a/packer/post_processor.go b/packer-plugin-sdk/packer/post_processor.go similarity index 83% rename from packer/post_processor.go rename to packer-plugin-sdk/packer/post_processor.go index cd47e297c..e99bcdd8a 100644 --- a/packer/post_processor.go +++ b/packer-plugin-sdk/packer/post_processor.go @@ -2,8 +2,6 @@ package packer import ( "context" - - packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // A PostProcessor is responsible for taking an artifact of a build @@ -12,7 +10,7 @@ import ( // the result of a build, compresses it, and returns a new artifact containing // a single file of the prior artifact compressed. type PostProcessor interface { - packersdk.HCL2Speccer + HCL2Speccer // Configure is responsible for setting up configuration, storing // the state for later, and returning and errors, such as validation @@ -26,5 +24,5 @@ type PostProcessor interface { // user input for keep_input_artifact is ignored and the artifact is either // kept or discarded according to the value set in `keep`. // PostProcess is cancellable using context - PostProcess(context.Context, packersdk.Ui, packersdk.Artifact) (a packersdk.Artifact, keep bool, forceOverride bool, err error) + PostProcess(context.Context, Ui, Artifact) (a Artifact, keep bool, forceOverride bool, err error) } diff --git a/packer-plugin-sdk/packer/provisioner.go b/packer-plugin-sdk/packer/provisioner.go new file mode 100644 index 000000000..1f70e70a9 --- /dev/null +++ b/packer-plugin-sdk/packer/provisioner.go @@ -0,0 +1,20 @@ +package packer + +import "context" + +// A provisioner is responsible for installing and configuring software +// on a machine prior to building the actual image. +type Provisioner interface { + HCL2Speccer + + // Prepare is called with a set of configurations to setup the + // internal state of the provisioner. The multiple configurations + // should be merged in some sane way. + Prepare(...interface{}) error + + // Provision is called to actually provision the machine. A context is + // given for cancellation, a UI is given to communicate with the user, and + // a communicator is given that is guaranteed to be connected to some + // machine so that provisioning can be done. + Provision(context.Context, Ui, Communicator, map[string]interface{}) error +} diff --git a/packer/build.go b/packer/build.go index 551f8af3e..d36503426 100644 --- a/packer/build.go +++ b/packer/build.go @@ -95,7 +95,7 @@ type Build interface { type CoreBuild struct { BuildName string Type string - Builder Builder + Builder packersdk.Builder BuilderConfig interface{} BuilderType string hooks map[string][]packersdk.Hook @@ -118,7 +118,7 @@ type CoreBuild struct { // CoreBuildPostProcessor Keeps track of the post-processor and the // configuration of the post-processor used within a build. type CoreBuildPostProcessor struct { - PostProcessor PostProcessor + PostProcessor packersdk.PostProcessor PType string PName string config map[string]interface{} @@ -130,7 +130,7 @@ type CoreBuildPostProcessor struct { type CoreBuildProvisioner struct { PType string PName string - Provisioner Provisioner + Provisioner packersdk.Provisioner config []interface{} } diff --git a/packer/core.go b/packer/core.go index 07d0841d1..1c49231d5 100644 --- a/packer/core.go +++ b/packer/core.go @@ -50,16 +50,16 @@ type CoreConfig struct { } // The function type used to lookup Builder implementations. -type BuilderFunc func(name string) (Builder, error) +type BuilderFunc func(name string) (packersdk.Builder, error) // The function type used to lookup Hook implementations. type HookFunc func(name string) (packersdk.Hook, error) // The function type used to lookup PostProcessor implementations. -type PostProcessorFunc func(name string) (PostProcessor, error) +type PostProcessorFunc func(name string) (packersdk.PostProcessor, error) // The function type used to lookup Provisioner implementations. -type ProvisionerFunc func(name string) (Provisioner, error) +type ProvisionerFunc func(name string) (packersdk.Provisioner, error) type BasicStore interface { Has(name string) bool @@ -68,17 +68,17 @@ type BasicStore interface { type BuilderStore interface { BasicStore - Start(name string) (Builder, error) + Start(name string) (packersdk.Builder, error) } type ProvisionerStore interface { BasicStore - Start(name string) (Provisioner, error) + Start(name string) (packersdk.Provisioner, error) } type PostProcessorStore interface { BasicStore - Start(name string) (PostProcessor, error) + Start(name string) (packersdk.PostProcessor, error) } // ComponentFinder is a struct that contains the various function diff --git a/packer/core_test.go b/packer/core_test.go index 1099d6790..813c58d18 100644 --- a/packer/core_test.go +++ b/packer/core_test.go @@ -801,9 +801,9 @@ func TestCoreBuild_provRetry(t *testing.T) { pString := new(MockProvisioner) pInt := new(MockProvisioner) config.Components.ProvisionerStore = MapOfProvisioner{ - "test-string": func() (Provisioner, error) { return pString, nil }, + "test-string": func() (packersdk.Provisioner, error) { return pString, nil }, // backwards compatibility - "test-integer": func() (Provisioner, error) { return pInt, nil }, + "test-integer": func() (packersdk.Provisioner, error) { return pInt, nil }, } core := TestCore(t, config) diff --git a/packer/maps.go b/packer/maps.go index 7cad0a014..388aa2381 100644 --- a/packer/maps.go +++ b/packer/maps.go @@ -2,16 +2,18 @@ package packer import ( "fmt" + + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) -type MapOfProvisioner map[string]func() (Provisioner, error) +type MapOfProvisioner map[string]func() (packersdk.Provisioner, error) func (mop MapOfProvisioner) Has(provisioner string) bool { _, res := mop[provisioner] return res } -func (mop MapOfProvisioner) Start(provisioner string) (Provisioner, error) { +func (mop MapOfProvisioner) Start(provisioner string) (packersdk.Provisioner, error) { p, found := mop[provisioner] if !found { return nil, fmt.Errorf("Unknown provisioner %s", provisioner) @@ -27,14 +29,14 @@ func (mop MapOfProvisioner) List() []string { return res } -type MapOfPostProcessor map[string]func() (PostProcessor, error) +type MapOfPostProcessor map[string]func() (packersdk.PostProcessor, error) func (mopp MapOfPostProcessor) Has(postProcessor string) bool { _, res := mopp[postProcessor] return res } -func (mopp MapOfPostProcessor) Start(postProcessor string) (PostProcessor, error) { +func (mopp MapOfPostProcessor) Start(postProcessor string) (packersdk.PostProcessor, error) { p, found := mopp[postProcessor] if !found { return nil, fmt.Errorf("Unknown post-processor %s", postProcessor) @@ -50,14 +52,14 @@ func (mopp MapOfPostProcessor) List() []string { return res } -type MapOfBuilder map[string]func() (Builder, error) +type MapOfBuilder map[string]func() (packersdk.Builder, error) func (mob MapOfBuilder) Has(builder string) bool { _, res := mob[builder] return res } -func (mob MapOfBuilder) Start(builder string) (Builder, error) { +func (mob MapOfBuilder) Start(builder string) (packersdk.Builder, error) { d, found := mob[builder] if !found { return nil, fmt.Errorf("Unknown builder %s", builder) diff --git a/packer/plugin/builder.go b/packer/plugin/builder.go index 9778b58fa..615437b8a 100644 --- a/packer/plugin/builder.go +++ b/packer/plugin/builder.go @@ -5,12 +5,11 @@ import ( "log" "github.com/hashicorp/hcl/v2/hcldec" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type cmdBuilder struct { - builder packer.Builder + builder packersdk.Builder client *Client } diff --git a/packer/plugin/client.go b/packer/plugin/client.go index a8b1f8b1a..ce450ba17 100644 --- a/packer/plugin/client.go +++ b/packer/plugin/client.go @@ -16,7 +16,6 @@ import ( "time" "unicode" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" packrpc "github.com/hashicorp/packer/packer/rpc" ) @@ -131,7 +130,7 @@ func (c *Client) Exited() bool { // Returns a builder implementation that is communicating over this // client. If the client hasn't been started, this will start it. -func (c *Client) Builder() (packer.Builder, error) { +func (c *Client) Builder() (packersdk.Builder, error) { client, err := c.packrpcClient() if err != nil { return nil, err @@ -153,7 +152,7 @@ func (c *Client) Hook() (packersdk.Hook, error) { // Returns a post-processor implementation that is communicating over // this client. If the client hasn't been started, this will start it. -func (c *Client) PostProcessor() (packer.PostProcessor, error) { +func (c *Client) PostProcessor() (packersdk.PostProcessor, error) { client, err := c.packrpcClient() if err != nil { return nil, err @@ -164,7 +163,7 @@ func (c *Client) PostProcessor() (packer.PostProcessor, error) { // Returns a provisioner implementation that is communicating over this // client. If the client hasn't been started, this will start it. -func (c *Client) Provisioner() (packer.Provisioner, error) { +func (c *Client) Provisioner() (packersdk.Provisioner, error) { client, err := c.packrpcClient() if err != nil { return nil, err diff --git a/packer/plugin/post_processor.go b/packer/plugin/post_processor.go index fa98ebaf0..68706863e 100644 --- a/packer/plugin/post_processor.go +++ b/packer/plugin/post_processor.go @@ -5,12 +5,11 @@ import ( "log" "github.com/hashicorp/hcl/v2/hcldec" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type cmdPostProcessor struct { - p packer.PostProcessor + p packersdk.PostProcessor client *Client } diff --git a/packer/plugin/provisioner.go b/packer/plugin/provisioner.go index 9d502b9ff..00b5e88e4 100644 --- a/packer/plugin/provisioner.go +++ b/packer/plugin/provisioner.go @@ -5,12 +5,11 @@ import ( "log" "github.com/hashicorp/hcl/v2/hcldec" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type cmdProvisioner struct { - p packer.Provisioner + p packersdk.Provisioner client *Client } diff --git a/packer/provisioner.go b/packer/provisioner.go index b1ac9c005..3a7449027 100644 --- a/packer/provisioner.go +++ b/packer/provisioner.go @@ -12,26 +12,9 @@ import ( "github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata" ) -// A provisioner is responsible for installing and configuring software -// on a machine prior to building the actual image. -type Provisioner interface { - packersdk.HCL2Speccer - - // Prepare is called with a set of configurations to setup the - // internal state of the provisioner. The multiple configurations - // should be merged in some sane way. - Prepare(...interface{}) error - - // Provision is called to actually provision the machine. A context is - // given for cancellation, a UI is given to communicate with the user, and - // a communicator is given that is guaranteed to be connected to some - // machine so that provisioning can be done. - Provision(context.Context, packersdk.Ui, packersdk.Communicator, map[string]interface{}) error -} - // A HookedProvisioner represents a provisioner and information describing it type HookedProvisioner struct { - Provisioner Provisioner + Provisioner packersdk.Provisioner Config interface{} TypeName string } @@ -151,7 +134,7 @@ func (h *ProvisionHook) Run(ctx context.Context, name string, ui packersdk.Ui, c // the provisioner is actually run. type PausedProvisioner struct { PauseBefore time.Duration - Provisioner Provisioner + Provisioner packersdk.Provisioner } func (p *PausedProvisioner) ConfigSpec() hcldec.ObjectSpec { return p.ConfigSpec() } @@ -177,7 +160,7 @@ func (p *PausedProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm // the provisioner whenever there's an error. type RetriedProvisioner struct { MaxRetries int - Provisioner Provisioner + Provisioner packersdk.Provisioner } func (r *RetriedProvisioner) ConfigSpec() hcldec.ObjectSpec { return r.ConfigSpec() } @@ -218,7 +201,7 @@ func (r *RetriedProvisioner) Provision(ctx context.Context, ui packersdk.Ui, com // DebuggedProvisioner is a Provisioner implementation that waits until a key // press before the provisioner is actually run. type DebuggedProvisioner struct { - Provisioner Provisioner + Provisioner packersdk.Provisioner cancelCh chan struct{} doneCh chan struct{} diff --git a/packer/provisioner_test.go b/packer/provisioner_test.go index b50be279d..26fc7267d 100644 --- a/packer/provisioner_test.go +++ b/packer/provisioner_test.go @@ -91,7 +91,7 @@ func TestProvisionHook_cancel(t *testing.T) { // TODO(mitchellh): Test that they're run in the proper order func TestPausedProvisioner_impl(t *testing.T) { - var _ Provisioner = new(PausedProvisioner) + var _ packersdk.Provisioner = new(PausedProvisioner) } func TestPausedProvisionerPrepare(t *testing.T) { @@ -174,7 +174,7 @@ func TestPausedProvisionerCancel(t *testing.T) { } func TestDebuggedProvisioner_impl(t *testing.T) { - var _ Provisioner = new(DebuggedProvisioner) + var _ packersdk.Provisioner = new(DebuggedProvisioner) } func TestDebuggedProvisionerPrepare(t *testing.T) { @@ -234,7 +234,7 @@ func TestDebuggedProvisionerCancel(t *testing.T) { } func TestRetriedProvisioner_impl(t *testing.T) { - var _ Provisioner = new(RetriedProvisioner) + var _ packersdk.Provisioner = new(RetriedProvisioner) } func TestRetriedProvisionerPrepare(t *testing.T) { diff --git a/packer/provisioner_timeout.go b/packer/provisioner_timeout.go index 6b2b5649c..57e96ada7 100644 --- a/packer/provisioner_timeout.go +++ b/packer/provisioner_timeout.go @@ -11,7 +11,7 @@ import ( // TimeoutProvisioner is a Provisioner implementation that can timeout after a // duration type TimeoutProvisioner struct { - Provisioner + packersdk.Provisioner Timeout time.Duration } diff --git a/packer/rpc/builder.go b/packer/rpc/builder.go index dc962675f..409f9f421 100644 --- a/packer/rpc/builder.go +++ b/packer/rpc/builder.go @@ -4,24 +4,23 @@ import ( "context" "log" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) -// An implementation of packer.Builder where the builder is actually executed +// An implementation of packersdk.Builder where the builder is actually executed // over an RPC connection. type builder struct { commonClient } -// BuilderServer wraps a packer.Builder implementation and makes it exportable +// BuilderServer wraps a packersdk.Builder implementation and makes it exportable // as part of a Golang RPC server. type BuilderServer struct { context context.Context contextCancel func() commonServer - builder packer.Builder + builder packersdk.Builder } type BuilderPrepareArgs struct { diff --git a/packer/rpc/builder_test.go b/packer/rpc/builder_test.go index eca0f9ea6..2b09f817d 100644 --- a/packer/rpc/builder_test.go +++ b/packer/rpc/builder_test.go @@ -155,5 +155,5 @@ func TestBuilderCancel(t *testing.T) { } func TestBuilder_ImplementsBuilder(t *testing.T) { - var _ packer.Builder = new(builder) + var _ packersdk.Builder = new(builder) } diff --git a/packer/rpc/client.go b/packer/rpc/client.go index 93bf76fd6..b84b8b600 100644 --- a/packer/rpc/client.go +++ b/packer/rpc/client.go @@ -89,7 +89,7 @@ func (c *Client) Build() packer.Build { } } -func (c *Client) Builder() packer.Builder { +func (c *Client) Builder() packersdk.Builder { return &builder{ commonClient: commonClient{ endpoint: DefaultBuilderEndpoint, @@ -119,7 +119,7 @@ func (c *Client) Hook() packersdk.Hook { } } -func (c *Client) PostProcessor() packer.PostProcessor { +func (c *Client) PostProcessor() packersdk.PostProcessor { return &postProcessor{ commonClient: commonClient{ endpoint: DefaultPostProcessorEndpoint, @@ -129,7 +129,7 @@ func (c *Client) PostProcessor() packer.PostProcessor { } } -func (c *Client) Provisioner() packer.Provisioner { +func (c *Client) Provisioner() packersdk.Provisioner { return &provisioner{ commonClient: commonClient{ endpoint: DefaultProvisionerEndpoint, diff --git a/packer/rpc/post_processor.go b/packer/rpc/post_processor.go index 92818b730..0595c4bfe 100644 --- a/packer/rpc/post_processor.go +++ b/packer/rpc/post_processor.go @@ -4,24 +4,23 @@ import ( "context" "log" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) -// An implementation of packer.PostProcessor where the PostProcessor is actually +// An implementation of packersdk.PostProcessor where the PostProcessor is actually // executed over an RPC connection. type postProcessor struct { commonClient } -// PostProcessorServer wraps a packer.PostProcessor implementation and makes it +// PostProcessorServer wraps a packersdk.PostProcessor implementation and makes it // exportable as part of a Golang RPC server. type PostProcessorServer struct { context context.Context contextCancel func() commonServer - p packer.PostProcessor + p packersdk.PostProcessor } type PostProcessorConfigureArgs struct { diff --git a/packer/rpc/post_processor_test.go b/packer/rpc/post_processor_test.go index 25507bfa5..4ccfd7167 100644 --- a/packer/rpc/post_processor_test.go +++ b/packer/rpc/post_processor_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/hashicorp/hcl/v2/hcldec" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) @@ -134,7 +133,7 @@ func TestPostProcessorRPC_cancel(t *testing.T) { func TestPostProcessor_Implements(t *testing.T) { var raw interface{} raw = new(postProcessor) - if _, ok := raw.(packer.PostProcessor); !ok { + if _, ok := raw.(packersdk.PostProcessor); !ok { t.Fatal("not a postprocessor") } } diff --git a/packer/rpc/provisioner.go b/packer/rpc/provisioner.go index 8337cf6db..391e968cf 100644 --- a/packer/rpc/provisioner.go +++ b/packer/rpc/provisioner.go @@ -4,24 +4,23 @@ import ( "context" "log" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) -// An implementation of packer.Provisioner where the provisioner is actually +// An implementation of packersdk.Provisioner where the provisioner is actually // executed over an RPC connection. type provisioner struct { commonClient } -// ProvisionerServer wraps a packer.Provisioner implementation and makes it +// ProvisionerServer wraps a packersdk.Provisioner implementation and makes it // exportable as part of a Golang RPC server. type ProvisionerServer struct { context context.Context contextCancel func() commonServer - p packer.Provisioner + p packersdk.Provisioner } type ProvisionerPrepareArgs struct { diff --git a/packer/rpc/provisioner_test.go b/packer/rpc/provisioner_test.go index 5b3d8844a..be77943d9 100644 --- a/packer/rpc/provisioner_test.go +++ b/packer/rpc/provisioner_test.go @@ -50,5 +50,5 @@ func TestProvisionerRPC(t *testing.T) { } func TestProvisioner_Implements(t *testing.T) { - var _ packer.Provisioner = new(provisioner) + var _ packersdk.Provisioner = new(provisioner) } diff --git a/packer/rpc/server.go b/packer/rpc/server.go index 07ebf70f9..dc648f427 100644 --- a/packer/rpc/server.go +++ b/packer/rpc/server.go @@ -77,7 +77,7 @@ func (s *Server) RegisterBuild(b packer.Build) error { }) } -func (s *Server) RegisterBuilder(b packer.Builder) error { +func (s *Server) RegisterBuilder(b packersdk.Builder) error { return s.server.RegisterName(DefaultBuilderEndpoint, &BuilderServer{ commonServer: commonServer{ selfConfigurable: b, @@ -103,7 +103,7 @@ func (s *Server) RegisterHook(h packersdk.Hook) error { }) } -func (s *Server) RegisterPostProcessor(p packer.PostProcessor) error { +func (s *Server) RegisterPostProcessor(p packersdk.PostProcessor) error { return s.server.RegisterName(DefaultPostProcessorEndpoint, &PostProcessorServer{ commonServer: commonServer{ selfConfigurable: p, @@ -113,7 +113,7 @@ func (s *Server) RegisterPostProcessor(p packer.PostProcessor) error { }) } -func (s *Server) RegisterProvisioner(p packer.Provisioner) error { +func (s *Server) RegisterProvisioner(p packersdk.Provisioner) error { return s.server.RegisterName(DefaultProvisionerEndpoint, &ProvisionerServer{ commonServer: commonServer{ selfConfigurable: p, diff --git a/packer/testing.go b/packer/testing.go index 29875ed16..b6162093a 100644 --- a/packer/testing.go +++ b/packer/testing.go @@ -12,7 +12,7 @@ func TestCoreConfig(t *testing.T) *CoreConfig { // Create some test components components := ComponentFinder{ BuilderStore: MapOfBuilder{ - "test": func() (Builder, error) { return &MockBuilder{}, nil }, + "test": func() (packersdk.Builder, error) { return &MockBuilder{}, nil }, }, } @@ -46,7 +46,7 @@ func TestBuilder(t *testing.T, c *CoreConfig, n string) *MockBuilder { var b MockBuilder c.Components.BuilderStore = MapOfBuilder{ - n: func() (Builder, error) { return &b, nil }, + n: func() (packersdk.Builder, error) { return &b, nil }, } return &b @@ -58,7 +58,7 @@ func TestProvisioner(t *testing.T, c *CoreConfig, n string) *MockProvisioner { var b MockProvisioner c.Components.ProvisionerStore = MapOfProvisioner{ - n: func() (Provisioner, error) { return &b, nil }, + n: func() (packersdk.Provisioner, error) { return &b, nil }, } return &b @@ -70,7 +70,7 @@ func TestPostProcessor(t *testing.T, c *CoreConfig, n string) *MockPostProcessor var b MockPostProcessor c.Components.PostProcessorStore = MapOfPostProcessor{ - n: func() (PostProcessor, error) { return &b, nil }, + n: func() (packersdk.PostProcessor, error) { return &b, nil }, } return &b diff --git a/post-processor/digitalocean-import/post-processor_test.go b/post-processor/digitalocean-import/post-processor_test.go index 2f89d7e0f..23f664d90 100644 --- a/post-processor/digitalocean-import/post-processor_test.go +++ b/post-processor/digitalocean-import/post-processor_test.go @@ -3,11 +3,11 @@ package digitaloceanimport import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestPostProcessor_ImplementsPostProcessor(t *testing.T) { - var _ packer.PostProcessor = new(PostProcessor) + var _ packersdk.PostProcessor = new(PostProcessor) } func TestPostProcessor_ImageArtifactExtraction(t *testing.T) { diff --git a/post-processor/docker-import/post-processor_test.go b/post-processor/docker-import/post-processor_test.go index 1b28ad1f3..601788af5 100644 --- a/post-processor/docker-import/post-processor_test.go +++ b/post-processor/docker-import/post-processor_test.go @@ -3,9 +3,9 @@ package dockerimport import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestPostProcessor_ImplementsPostProcessor(t *testing.T) { - var _ packer.PostProcessor = new(PostProcessor) + var _ packersdk.PostProcessor = new(PostProcessor) } diff --git a/post-processor/docker-push/post-processor_test.go b/post-processor/docker-push/post-processor_test.go index ba9d84d93..94c6e03b8 100644 --- a/post-processor/docker-push/post-processor_test.go +++ b/post-processor/docker-push/post-processor_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/hashicorp/packer/builder/docker" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" dockerimport "github.com/hashicorp/packer/post-processor/docker-import" ) @@ -19,7 +18,7 @@ func testUi() *packersdk.BasicUi { } func TestPostProcessor_ImplementsPostProcessor(t *testing.T) { - var _ packer.PostProcessor = new(PostProcessor) + var _ packersdk.PostProcessor = new(PostProcessor) } func TestPostProcessor_PostProcess(t *testing.T) { diff --git a/post-processor/docker-save/post-processor_test.go b/post-processor/docker-save/post-processor_test.go index 02bdaec18..206102502 100644 --- a/post-processor/docker-save/post-processor_test.go +++ b/post-processor/docker-save/post-processor_test.go @@ -3,9 +3,9 @@ package dockersave import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestPostProcessor_ImplementsPostProcessor(t *testing.T) { - var _ packer.PostProcessor = new(PostProcessor) + var _ packersdk.PostProcessor = new(PostProcessor) } diff --git a/post-processor/docker-tag/post-processor_test.go b/post-processor/docker-tag/post-processor_test.go index 2d6fc0562..df3e2baca 100644 --- a/post-processor/docker-tag/post-processor_test.go +++ b/post-processor/docker-tag/post-processor_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/hashicorp/packer/builder/docker" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" dockerimport "github.com/hashicorp/packer/post-processor/docker-import" "github.com/stretchr/testify/assert" @@ -36,7 +35,7 @@ func testUi() *packersdk.BasicUi { } func TestPostProcessor_ImplementsPostProcessor(t *testing.T) { - var _ packer.PostProcessor = new(PostProcessor) + var _ packersdk.PostProcessor = new(PostProcessor) } func TestPostProcessor_PostProcess(t *testing.T) { diff --git a/post-processor/shell-local/post-processor_test.go b/post-processor/shell-local/post-processor_test.go index 515704f9d..fe4e67063 100644 --- a/post-processor/shell-local/post-processor_test.go +++ b/post-processor/shell-local/post-processor_test.go @@ -6,12 +6,12 @@ import ( "runtime" "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/stretchr/testify/assert" ) func TestPostProcessor_ImplementsPostProcessor(t *testing.T) { - var _ packer.PostProcessor = new(PostProcessor) + var _ packersdk.PostProcessor = new(PostProcessor) } func testConfig() map[string]interface{} { @@ -23,7 +23,7 @@ func testConfig() map[string]interface{} { func TestPostProcessor_Impl(t *testing.T) { var raw interface{} raw = &PostProcessor{} - if _, ok := raw.(packer.PostProcessor); !ok { + if _, ok := raw.(packersdk.PostProcessor); !ok { t.Fatalf("must be a post processor") } } diff --git a/post-processor/vagrant-cloud/post-processor.go b/post-processor/vagrant-cloud/post-processor.go index 4b87f0c4b..32b4e4fc1 100644 --- a/post-processor/vagrant-cloud/post-processor.go +++ b/post-processor/vagrant-cloud/post-processor.go @@ -1,6 +1,6 @@ //go:generate mapstructure-to-hcl2 -type Config -// vagrant_cloud implements the packer.PostProcessor interface and adds a +// vagrant_cloud implements the packersdk.PostProcessor interface and adds a // post-processor that uploads artifacts from the vagrant post-processor // and vagrant builder to Vagrant Cloud (vagrantcloud.com) or manages // self hosted boxes on the Vagrant Cloud diff --git a/post-processor/vagrant-cloud/post-processor_test.go b/post-processor/vagrant-cloud/post-processor_test.go index 56e2b8006..0ff209a1d 100644 --- a/post-processor/vagrant-cloud/post-processor_test.go +++ b/post-processor/vagrant-cloud/post-processor_test.go @@ -13,7 +13,6 @@ import ( "strings" "testing" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/stretchr/testify/assert" ) @@ -425,7 +424,7 @@ func testUi() *packersdk.BasicUi { } func TestPostProcessor_ImplementsPostProcessor(t *testing.T) { - var _ packer.PostProcessor = new(PostProcessor) + var _ packersdk.PostProcessor = new(PostProcessor) } func TestProviderFromBuilderName(t *testing.T) { diff --git a/post-processor/vagrant/post-processor.go b/post-processor/vagrant/post-processor.go index e73739989..341aef2d6 100644 --- a/post-processor/vagrant/post-processor.go +++ b/post-processor/vagrant/post-processor.go @@ -1,6 +1,6 @@ //go:generate mapstructure-to-hcl2 -type Config -// vagrant implements the packer.PostProcessor interface and adds a +// vagrant implements the packersdk.PostProcessor interface and adds a // post-processor that turns artifacts of known builders into Vagrant // boxes. package vagrant diff --git a/post-processor/vagrant/post-processor_test.go b/post-processor/vagrant/post-processor_test.go index 3be292f99..d2b947925 100644 --- a/post-processor/vagrant/post-processor_test.go +++ b/post-processor/vagrant/post-processor_test.go @@ -9,7 +9,6 @@ import ( "strings" "testing" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) @@ -34,7 +33,7 @@ func testUi() *packersdk.BasicUi { } func TestPostProcessor_ImplementsPostProcessor(t *testing.T) { - var _ packer.PostProcessor = new(PostProcessor) + var _ packersdk.PostProcessor = new(PostProcessor) } func TestPostProcessorPrepare_compressionLevel(t *testing.T) { diff --git a/provisioner/ansible-local/provisioner_test.go b/provisioner/ansible-local/provisioner_test.go index 225854f87..19d7f87e4 100644 --- a/provisioner/ansible-local/provisioner_test.go +++ b/provisioner/ansible-local/provisioner_test.go @@ -21,7 +21,7 @@ import ( func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatalf("must be a Provisioner") } } diff --git a/provisioner/ansible/provisioner_test.go b/provisioner/ansible/provisioner_test.go index 83f4d6960..aa939d80f 100644 --- a/provisioner/ansible/provisioner_test.go +++ b/provisioner/ansible/provisioner_test.go @@ -14,7 +14,6 @@ import ( "strings" "testing" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" confighelper "github.com/hashicorp/packer/packer-plugin-sdk/template/config" @@ -43,7 +42,7 @@ func testConfig(t *testing.T) map[string]interface{} { func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatalf("must be a Provisioner") } } diff --git a/provisioner/chef-client/provisioner_test.go b/provisioner/chef-client/provisioner_test.go index 40aca6988..80349fa5a 100644 --- a/provisioner/chef-client/provisioner_test.go +++ b/provisioner/chef-client/provisioner_test.go @@ -7,7 +7,6 @@ import ( "strings" "testing" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) @@ -20,7 +19,7 @@ func testConfig() map[string]interface{} { func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatalf("must be a Provisioner") } } diff --git a/provisioner/chef-solo/provisioner_test.go b/provisioner/chef-solo/provisioner_test.go index 6df4c378c..9a378efc0 100644 --- a/provisioner/chef-solo/provisioner_test.go +++ b/provisioner/chef-solo/provisioner_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -15,7 +16,7 @@ func testConfig() map[string]interface{} { func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatalf("must be a Provisioner") } } diff --git a/provisioner/converge/provisioner_test.go b/provisioner/converge/provisioner_test.go index ee38905a5..8b2c4bf29 100644 --- a/provisioner/converge/provisioner_test.go +++ b/provisioner/converge/provisioner_test.go @@ -3,7 +3,7 @@ package converge import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -21,7 +21,7 @@ func testConfig() map[string]interface{} { func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatal("must be a Provisioner") } } diff --git a/provisioner/file/provisioner_test.go b/provisioner/file/provisioner_test.go index e0c5166ad..510dabfc7 100644 --- a/provisioner/file/provisioner_test.go +++ b/provisioner/file/provisioner_test.go @@ -23,7 +23,7 @@ func testConfig() map[string]interface{} { func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatalf("must be a provisioner") } } diff --git a/provisioner/inspec/provisioner_test.go b/provisioner/inspec/provisioner_test.go index f814768a9..3725a7ba2 100644 --- a/provisioner/inspec/provisioner_test.go +++ b/provisioner/inspec/provisioner_test.go @@ -10,7 +10,7 @@ import ( "strings" "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) // Be sure to remove the InSpec stub file in each test with: @@ -35,7 +35,7 @@ func testConfig(t *testing.T) map[string]interface{} { func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatalf("must be a Provisioner") } } diff --git a/provisioner/powershell/provisioner_acc_test.go b/provisioner/powershell/provisioner_acc_test.go index 3e485a055..baad86fad 100644 --- a/provisioner/powershell/provisioner_acc_test.go +++ b/provisioner/powershell/provisioner_acc_test.go @@ -65,8 +65,8 @@ func (s *PowershellProvisionerAccTest) GetConfig() (string, error) { func (s *PowershellProvisionerAccTest) GetProvisionerStore() packer.MapOfProvisioner { return packer.MapOfProvisioner{ - TestProvisionerName: func() (packer.Provisioner, error) { return &powershell.Provisioner{}, nil }, - "windows-shell": func() (packer.Provisioner, error) { return &windowsshellprovisioner.Provisioner{}, nil }, + TestProvisionerName: func() (packersdk.Provisioner, error) { return &powershell.Provisioner{}, nil }, + "windows-shell": func() (packersdk.Provisioner, error) { return &windowsshellprovisioner.Provisioner{}, nil }, } } diff --git a/provisioner/powershell/provisioner_test.go b/provisioner/powershell/provisioner_test.go index 7fb8f355e..feb14c2f1 100644 --- a/provisioner/powershell/provisioner_test.go +++ b/provisioner/powershell/provisioner_test.go @@ -46,7 +46,7 @@ func TestProvisionerPrepare_extractScript(t *testing.T) { func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatalf("must be a Provisioner") } } diff --git a/provisioner/puppet-masterless/provisioner_test.go b/provisioner/puppet-masterless/provisioner_test.go index ebaee2dd3..9a522c59f 100644 --- a/provisioner/puppet-masterless/provisioner_test.go +++ b/provisioner/puppet-masterless/provisioner_test.go @@ -32,7 +32,7 @@ func testConfig() (config map[string]interface{}, tf *os.File) { func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatalf("must be a Provisioner") } } diff --git a/provisioner/puppet-server/provisioner_test.go b/provisioner/puppet-server/provisioner_test.go index 68e9369b6..04d9d9dde 100644 --- a/provisioner/puppet-server/provisioner_test.go +++ b/provisioner/puppet-server/provisioner_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() (config map[string]interface{}, tf *os.File) { @@ -24,7 +24,7 @@ func testConfig() (config map[string]interface{}, tf *os.File) { func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatalf("must be a Provisioner") } } diff --git a/provisioner/salt-masterless/provisioner_test.go b/provisioner/salt-masterless/provisioner_test.go index f8f2fb7a9..dc4d404d2 100644 --- a/provisioner/salt-masterless/provisioner_test.go +++ b/provisioner/salt-masterless/provisioner_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -18,7 +18,7 @@ func testConfig() map[string]interface{} { func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatalf("must be a Provisioner") } } diff --git a/provisioner/shell-local/provisioner_acc_test.go b/provisioner/shell-local/provisioner_acc_test.go index a23ceb3c5..0b2e608a1 100644 --- a/provisioner/shell-local/provisioner_acc_test.go +++ b/provisioner/shell-local/provisioner_acc_test.go @@ -42,7 +42,7 @@ func (s *ShellLocalProvisionerAccTest) GetConfig() (string, error) { func (s *ShellLocalProvisionerAccTest) GetProvisionerStore() packer.MapOfProvisioner { return packer.MapOfProvisioner{ - "shell-local": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil }, + "shell-local": func() (packersdk.Provisioner, error) { return &shell.Provisioner{}, nil }, } } diff --git a/provisioner/shell-local/provisioner_test.go b/provisioner/shell-local/provisioner_test.go index 9f4fb9d2a..f173763b3 100644 --- a/provisioner/shell-local/provisioner_test.go +++ b/provisioner/shell-local/provisioner_test.go @@ -3,11 +3,11 @@ package shell import ( "testing" - "github.com/hashicorp/packer/packer" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func TestProvisioner_impl(t *testing.T) { - var _ packer.Provisioner = new(Provisioner) + var _ packersdk.Provisioner = new(Provisioner) } func TestConfigPrepare(t *testing.T) { diff --git a/provisioner/shell/provisioner_acc_test.go b/provisioner/shell/provisioner_acc_test.go index faf785a0a..5ba6ac42f 100644 --- a/provisioner/shell/provisioner_acc_test.go +++ b/provisioner/shell/provisioner_acc_test.go @@ -45,8 +45,8 @@ func (s *ShellProvisionerAccTest) GetConfig() (string, error) { func (s *ShellProvisionerAccTest) GetProvisionerStore() packer.MapOfProvisioner { return packer.MapOfProvisioner{ - "shell": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil }, - "file": func() (packer.Provisioner, error) { return &file.Provisioner{}, nil }, + "shell": func() (packersdk.Provisioner, error) { return &shell.Provisioner{}, nil }, + "file": func() (packersdk.Provisioner, error) { return &file.Provisioner{}, nil }, } } diff --git a/provisioner/shell/provisioner_test.go b/provisioner/shell/provisioner_test.go index 8f88bcc53..8068f3e65 100644 --- a/provisioner/shell/provisioner_test.go +++ b/provisioner/shell/provisioner_test.go @@ -7,8 +7,8 @@ import ( "strings" "testing" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) func testConfig() map[string]interface{} { @@ -20,7 +20,7 @@ func testConfig() map[string]interface{} { func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatalf("must be a Provisioner") } } diff --git a/provisioner/sleep/provisioner.go b/provisioner/sleep/provisioner.go index 8c3de5dd8..1f6746c97 100644 --- a/provisioner/sleep/provisioner.go +++ b/provisioner/sleep/provisioner.go @@ -7,7 +7,6 @@ import ( "time" "github.com/hashicorp/hcl/v2/hcldec" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer-plugin-sdk/template/config" ) @@ -16,7 +15,7 @@ type Provisioner struct { Duration time.Duration } -var _ packer.Provisioner = new(Provisioner) +var _ packersdk.Provisioner = new(Provisioner) func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.FlatMapstructure().HCL2Spec() } diff --git a/provisioner/windows-restart/provisioner_test.go b/provisioner/windows-restart/provisioner_test.go index 6d87216c2..93397e803 100644 --- a/provisioner/windows-restart/provisioner_test.go +++ b/provisioner/windows-restart/provisioner_test.go @@ -7,7 +7,6 @@ import ( "testing" "time" - "github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) @@ -18,7 +17,7 @@ func testConfig() map[string]interface{} { func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatalf("must be a Provisioner") } } diff --git a/provisioner/windows-shell/provisioner_test.go b/provisioner/windows-shell/provisioner_test.go index b523721a2..961bbe76c 100644 --- a/provisioner/windows-shell/provisioner_test.go +++ b/provisioner/windows-shell/provisioner_test.go @@ -9,7 +9,6 @@ import ( "strings" "testing" - "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) @@ -49,7 +48,7 @@ func TestProvisionerPrepare_extractScript(t *testing.T) { func TestProvisioner_Impl(t *testing.T) { var raw interface{} raw = &Provisioner{} - if _, ok := raw.(packer.Provisioner); !ok { + if _, ok := raw.(packersdk.Provisioner); !ok { t.Fatalf("must be a Provisioner") } } diff --git a/scripts/generate-plugins.go b/scripts/generate-plugins.go index 8fe8feddd..5034aab60 100644 --- a/scripts/generate-plugins.go +++ b/scripts/generate-plugins.go @@ -90,14 +90,14 @@ type plugin struct { // makeMap creates a map named Name with type packer.Name that looks something // like this: // -// var Builders = map[string]packer.Builder{ +// var Builders = map[string]packersdk.Builder{ // "amazon-chroot": new(chroot.Builder), // "amazon-ebs": new(ebs.Builder), // "amazon-instance": new(instance.Builder), func makeMap(varName, varType string, items []plugin) string { output := "" - output += fmt.Sprintf("var %s = map[string]packer.%s{\n", varName, varType) + output += fmt.Sprintf("var %s = map[string]packersdk.%s{\n", varName, varType) for _, item := range items { output += fmt.Sprintf("\t\"%s\": new(%s.%s),\n", item.PluginName, item.ImportName, item.TypeName) } @@ -254,6 +254,7 @@ import ( "strings" "github.com/hashicorp/packer/packer" +packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" "github.com/hashicorp/packer/packer/plugin" IMPORTS diff --git a/website/pages/partials/builder/hyperv/iso/Builder.mdx b/website/pages/partials/builder/hyperv/iso/Builder.mdx index 882c75759..d1741938a 100644 --- a/website/pages/partials/builder/hyperv/iso/Builder.mdx +++ b/website/pages/partials/builder/hyperv/iso/Builder.mdx @@ -1,4 +1,4 @@ -Builder implements packer.Builder and builds the actual Hyperv +Builder implements packersdk.Builder and builds the actual Hyperv images. diff --git a/website/pages/partials/builder/hyperv/vmcx/Builder.mdx b/website/pages/partials/builder/hyperv/vmcx/Builder.mdx index 339182ec8..e32f49ca6 100644 --- a/website/pages/partials/builder/hyperv/vmcx/Builder.mdx +++ b/website/pages/partials/builder/hyperv/vmcx/Builder.mdx @@ -1,4 +1,4 @@ -Builder implements packer.Builder and builds the actual Hyperv +Builder implements packersdk.Builder and builds the actual Hyperv images. diff --git a/website/pages/partials/builder/vagrant/Builder.mdx b/website/pages/partials/builder/vagrant/Builder.mdx index e14895d17..e23466d3c 100644 --- a/website/pages/partials/builder/vagrant/Builder.mdx +++ b/website/pages/partials/builder/vagrant/Builder.mdx @@ -1,4 +1,4 @@ -Builder implements packer.Builder and builds the actual VirtualBox +Builder implements packersdk.Builder and builds the actual VirtualBox images.