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..ca599df66 100644 --- a/builder/vmware/iso/step_create_vmx_test.go +++ b/builder/vmware/iso/step_create_vmx_test.go @@ -139,7 +139,7 @@ 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 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..dd45a59d9 100644 --- a/command/build_parallel_test.go +++ b/command/build_parallel_test.go @@ -69,9 +69,9 @@ 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 }, diff --git a/command/build_test.go b/command/build_test.go index c67505ad7..01c656ed8 100644 --- a/command/build_test.go +++ b/command/build_test.go @@ -837,8 +837,8 @@ 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 }, diff --git a/command/build_timeout_test.go b/command/build_timeout_test.go index 4fde04aea..49c69c083 100644 --- a/command/build_timeout_test.go +++ b/command/build_timeout_test.go @@ -17,7 +17,7 @@ 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 }, diff --git a/command/exec_test.go b/command/exec_test.go index 8a13b5e76..6d5305fe0 100644 --- a/command/exec_test.go +++ b/command/exec_test.go @@ -119,9 +119,9 @@ 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 }, diff --git a/command/plugin.go b/command/plugin.go index b3bf09bc7..25f328db0 100644 --- a/command/plugin.go +++ b/command/plugin.go @@ -11,6 +11,7 @@ import ( "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 +112,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), diff --git a/config.go b/config.go index 5c54f8e80..fef54e165 100644 --- a/config.go +++ b/config.go @@ -98,7 +98,7 @@ 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-"): @@ -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) } @@ -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) @@ -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() diff --git a/hcl2template/common_test.go b/hcl2template/common_test.go index ac65ac3e7..17aa9c34b 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,9 +21,9 @@ 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 }, diff --git a/hcl2template/internal/mock.go b/hcl2template/internal/mock.go index 0bc620e54..4a6fc091f 100644 --- a/hcl2template/internal/mock.go +++ b/hcl2template/internal/mock.go @@ -70,7 +70,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() } 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..92b10b288 100644 --- a/helper/tests/core.go +++ b/helper/tests/core.go @@ -26,7 +26,7 @@ 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 }, 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/build.go b/packer/build.go index 551f8af3e..2bb39d485 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 diff --git a/packer/core.go b/packer/core.go index 07d0841d1..c3f68f7c8 100644 --- a/packer/core.go +++ b/packer/core.go @@ -50,7 +50,7 @@ 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) @@ -68,7 +68,7 @@ type BasicStore interface { type BuilderStore interface { BasicStore - Start(name string) (Builder, error) + Start(name string) (packersdk.Builder, error) } type ProvisionerStore interface { diff --git a/packer/maps.go b/packer/maps.go index 7cad0a014..1f30d991c 100644 --- a/packer/maps.go +++ b/packer/maps.go @@ -2,6 +2,8 @@ package packer import ( "fmt" + + packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" ) type MapOfProvisioner map[string]func() (Provisioner, error) @@ -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..b8c01b57b 100644 --- a/packer/plugin/client.go +++ b/packer/plugin/client.go @@ -131,7 +131,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 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..6d79567aa 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, diff --git a/packer/rpc/server.go b/packer/rpc/server.go index 07ebf70f9..94ffb96b6 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, diff --git a/packer/testing.go b/packer/testing.go index 29875ed16..8ced163bf 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 diff --git a/scripts/generate-plugins.go b/scripts/generate-plugins.go index 8fe8feddd..e6a53f5c5 100644 --- a/scripts/generate-plugins.go +++ b/scripts/generate-plugins.go @@ -90,7 +90,7 @@ 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), @@ -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