extract builder interface to sdk
This commit is contained in:
parent
fab442eb52
commit
ada91b24e9
|
@ -1,6 +1,6 @@
|
||||||
//go:generate mapstructure-to-hcl2 -type Config,AlicloudDiskDevice
|
//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.
|
// builds ecs images for alicloud.
|
||||||
package ecs
|
package ecs
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"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"
|
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) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chroot
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testConfig() map[string]interface{} {
|
func testConfig() map[string]interface{} {
|
||||||
|
@ -19,7 +19,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
amazonebsbuilder "github.com/hashicorp/packer/builder/amazon/ebs"
|
amazonebsbuilder "github.com/hashicorp/packer/builder/amazon/ebs"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
|
|
||||||
testshelper "github.com/hashicorp/packer/helper/tests"
|
testshelper "github.com/hashicorp/packer/helper/tests"
|
||||||
)
|
)
|
||||||
|
@ -56,6 +57,6 @@ func (s *AmazonEBSAccTest) CleanUp() error {
|
||||||
|
|
||||||
func (s *AmazonEBSAccTest) GetBuilderStore() packer.MapOfBuilder {
|
func (s *AmazonEBSAccTest) GetBuilderStore() packer.MapOfBuilder {
|
||||||
return 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 },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//go:generate struct-markdown
|
//go:generate struct-markdown
|
||||||
//go:generate mapstructure-to-hcl2 -type Config
|
//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.
|
// builds AMIs for Amazon EC2.
|
||||||
//
|
//
|
||||||
// In general, there are two types of AMIs that can be created: ebs-backed or
|
// In general, there are two types of AMIs that can be created: ebs-backed or
|
||||||
|
|
|
@ -3,7 +3,7 @@ package ebs
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testConfig() map[string]interface{} {
|
func testConfig() map[string]interface{} {
|
||||||
|
@ -21,7 +21,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//go:generate struct-markdown
|
//go:generate struct-markdown
|
||||||
//go:generate mapstructure-to-hcl2 -type Config,RootBlockDevice,BlockDevice
|
//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.
|
// builds a new EBS-backed AMI using an ephemeral instance.
|
||||||
package ebssurrogate
|
package ebssurrogate
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/amazon/common"
|
"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{} {
|
func testConfig() map[string]interface{} {
|
||||||
|
@ -22,7 +22,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatal("Builder should be a builder")
|
t.Fatal("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//go:generate struct-markdown
|
//go:generate struct-markdown
|
||||||
//go:generate mapstructure-to-hcl2 -type Config,BlockDevice
|
//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,
|
// EBS volumes for Amazon EC2 using an ephemeral instance,
|
||||||
package ebsvolume
|
package ebsvolume
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package ebsvolume
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testConfig() map[string]interface{} {
|
func testConfig() map[string]interface{} {
|
||||||
|
@ -20,7 +20,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//go:generate struct-markdown
|
//go:generate struct-markdown
|
||||||
//go:generate mapstructure-to-hcl2 -type Config
|
//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.
|
// AMIs for Amazon EC2 backed by instance storage, as opposed to EBS storage.
|
||||||
package instance
|
package instance
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testConfig() (config map[string]interface{}, tf *os.File) {
|
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) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import (
|
||||||
"github.com/hashicorp/hcl/v2/hcldec"
|
"github.com/hashicorp/hcl/v2/hcldec"
|
||||||
azcommon "github.com/hashicorp/packer/builder/azure/common"
|
azcommon "github.com/hashicorp/packer/builder/azure/common"
|
||||||
"github.com/hashicorp/packer/builder/azure/common/client"
|
"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/chroot"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
"github.com/hashicorp/packer/packer-plugin-sdk/common"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
|
||||||
|
@ -146,7 +145,7 @@ type Builder struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify interface implementation
|
// verify interface implementation
|
||||||
var _ packer.Builder = &Builder{}
|
var _ packersdk.Builder = &Builder{}
|
||||||
|
|
||||||
func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() }
|
func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() }
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
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) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
|
||||||
b.ui = ui
|
b.ui = ui
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,14 @@ package cloudstack
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuilder_Impl(t *testing.T) {
|
func TestBuilder_Impl(t *testing.T) {
|
||||||
var raw interface{} = &Builder{}
|
var raw interface{} = &Builder{}
|
||||||
|
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder does not implement packer.Builder")
|
t.Fatalf("Builder does not implement packersdk.Builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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).
|
// that builds DigitalOcean images (snapshots).
|
||||||
|
|
||||||
package digitalocean
|
package digitalocean
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testConfig() map[string]interface{} {
|
func testConfig() map[string]interface{} {
|
||||||
|
@ -21,7 +21,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@ package docker
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuilder_implBuilder(t *testing.T) {
|
func TestBuilder_implBuilder(t *testing.T) {
|
||||||
var _ packer.Builder = new(Builder)
|
var _ packersdk.Builder = new(Builder)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,11 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
builderT "github.com/hashicorp/packer/helper/builder/testing"
|
builderT "github.com/hashicorp/packer/helper/builder/testing"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuilder_implBuilder(t *testing.T) {
|
func TestBuilder_implBuilder(t *testing.T) {
|
||||||
var _ packer.Builder = new(Builder)
|
var _ packersdk.Builder = new(Builder)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuilderFileAcc_content(t *testing.T) {
|
func TestBuilderFileAcc_content(t *testing.T) {
|
||||||
|
|
|
@ -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.
|
// builds images for Google Compute Engine.
|
||||||
package googlecompute
|
package googlecompute
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ const (
|
||||||
DefaultPassword = ""
|
DefaultPassword = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
// Builder implements packer.Builder and builds the actual Hyperv
|
// Builder implements packersdk.Builder and builds the actual Hyperv
|
||||||
// images.
|
// images.
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
config Config
|
config Config
|
||||||
|
|
|
@ -33,7 +33,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Error("Builder must implement builder.")
|
t.Error("Builder must implement builder.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ const (
|
||||||
DefaultPassword = ""
|
DefaultPassword = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
// Builder implements packer.Builder and builds the actual Hyperv
|
// Builder implements packersdk.Builder and builds the actual Hyperv
|
||||||
// images.
|
// images.
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
config Config
|
config Config
|
||||||
|
|
|
@ -32,7 +32,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Error("Builder must implement builder.")
|
t.Error("Builder must implement builder.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// The linode package contains a packer.Builder implementation
|
// The linode package contains a packersdk.Builder implementation
|
||||||
// that builds Linode images.
|
// that builds Linode images.
|
||||||
package linode
|
package linode
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testConfig() map[string]interface{} {
|
func testConfig() map[string]interface{} {
|
||||||
|
@ -21,7 +21,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testConfig() map[string]interface{} {
|
func testConfig() map[string]interface{} {
|
||||||
|
@ -50,7 +50,7 @@ func TestBuilderPrepare_ConfigFile(t *testing.T) {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testConfig() map[string]interface{} {
|
func testConfig() map[string]interface{} {
|
||||||
|
@ -71,7 +71,7 @@ func TestBuilderPrepare_ConfigFile(t *testing.T) {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Builder assume this implements packer.Builder
|
// Builder assume this implements packersdk.Builder
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
config Config
|
config Config
|
||||||
stateBag multistep.StateBag
|
stateBag multistep.StateBag
|
||||||
|
|
|
@ -3,9 +3,9 @@ package null
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuilder_implBuilder(t *testing.T) {
|
func TestBuilder_implBuilder(t *testing.T) {
|
||||||
var _ packer.Builder = new(Builder)
|
var _ packersdk.Builder = new(Builder)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testConfig() map[string]interface{} {
|
func testConfig() map[string]interface{} {
|
||||||
|
@ -19,7 +19,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestImplementsBuilder(t *testing.T) {
|
func TestImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//go:generate mapstructure-to-hcl2 -type Config,ImageFilter,ImageFilterOptions
|
//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.
|
// builds Images for openstack.
|
||||||
|
|
||||||
package openstack
|
package openstack
|
||||||
|
|
|
@ -3,13 +3,13 @@ package openstack
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
// Bare Metal Cloud Services (OCI) images.
|
||||||
package oci
|
package oci
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,13 @@ package oci
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//go:generate mapstructure-to-hcl2 -type Config
|
//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.
|
// builds OMIs for Outscale OAPI.
|
||||||
//
|
//
|
||||||
// In general, there are two types of OMIs that can be created: ebs-backed or
|
// In general, there are two types of OMIs that can be created: ebs-backed or
|
||||||
|
|
|
@ -3,7 +3,7 @@ package bsu
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testConfig() map[string]interface{} {
|
func testConfig() map[string]interface{} {
|
||||||
|
@ -21,7 +21,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//go:generate mapstructure-to-hcl2 -type Config,RootBlockDevice
|
//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.
|
// builds a new EBS-backed OMI using an ephemeral instance.
|
||||||
package bsusurrogate
|
package bsusurrogate
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,13 @@ package bsusurrogate
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatal("Builder should be a builder")
|
t.Fatal("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//go:generate mapstructure-to-hcl2 -type Config,BlockDevice
|
//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,
|
// builds EBS volumes for Outscale using an ephemeral instance,
|
||||||
package bsuvolume
|
package bsuvolume
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package bsuvolume
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testConfig() map[string]interface{} {
|
func testConfig() map[string]interface{} {
|
||||||
|
@ -20,7 +20,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Error("Builder must implement builder.")
|
t.Error("Builder must implement builder.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
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.
|
// images.
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
config Config
|
config Config
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testConfig() map[string]interface{} {
|
func testConfig() map[string]interface{} {
|
||||||
|
@ -20,7 +20,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestImplementsBuilder(t *testing.T) {
|
func TestImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
proxmoxapi "github.com/Telmate/proxmox-api-go/proxmox"
|
proxmoxapi "github.com/Telmate/proxmox-api-go/proxmox"
|
||||||
"github.com/hashicorp/hcl/v2/hcldec"
|
"github.com/hashicorp/hcl/v2/hcldec"
|
||||||
proxmox "github.com/hashicorp/packer/builder/proxmox/common"
|
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"
|
||||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
|
|
||||||
|
@ -19,8 +18,8 @@ type Builder struct {
|
||||||
config Config
|
config Config
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builder implements packer.Builder
|
// Builder implements packersdk.Builder
|
||||||
var _ packer.Builder = &Builder{}
|
var _ packersdk.Builder = &Builder{}
|
||||||
|
|
||||||
func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() }
|
func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() }
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
proxmoxapi "github.com/Telmate/proxmox-api-go/proxmox"
|
proxmoxapi "github.com/Telmate/proxmox-api-go/proxmox"
|
||||||
"github.com/hashicorp/hcl/v2/hcldec"
|
"github.com/hashicorp/hcl/v2/hcldec"
|
||||||
proxmox "github.com/hashicorp/packer/builder/proxmox/common"
|
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"
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
|
||||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
|
@ -19,8 +18,8 @@ type Builder struct {
|
||||||
config Config
|
config Config
|
||||||
}
|
}
|
||||||
|
|
||||||
// Builder implements packer.Builder
|
// Builder implements packersdk.Builder
|
||||||
var _ packer.Builder = &Builder{}
|
var _ packersdk.Builder = &Builder{}
|
||||||
|
|
||||||
func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() }
|
func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstructure().HCL2Spec() }
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,13 @@ package qemu
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Error("Builder must implement builder.")
|
t.Error("Builder must implement builder.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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).
|
// that builds Scaleway images (snapshots).
|
||||||
|
|
||||||
package scaleway
|
package scaleway
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testConfig() map[string]interface{} {
|
func testConfig() map[string]interface{} {
|
||||||
|
@ -22,7 +22,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//go:generate mapstructure-to-hcl2 -type Config
|
//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.
|
// builds uhost images for UCloud UHost instance.
|
||||||
package uhost
|
package uhost
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common"
|
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{} {
|
func testBuilderConfig() map[string]interface{} {
|
||||||
|
@ -25,7 +25,7 @@ func testBuilderConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import (
|
||||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
|
"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.
|
// images.
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
config Config
|
config Config
|
||||||
|
|
|
@ -3,13 +3,13 @@ package vagrant
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"github.com/hashicorp/packer/builder/virtualbox/iso"
|
"github.com/hashicorp/packer/builder/virtualbox/iso"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
|
|
||||||
testshelper "github.com/hashicorp/packer/helper/tests"
|
testshelper "github.com/hashicorp/packer/helper/tests"
|
||||||
)
|
)
|
||||||
|
@ -41,6 +42,6 @@ func (v *VirtualBoxISOAccTest) CleanUp() error {
|
||||||
|
|
||||||
func (v *VirtualBoxISOAccTest) GetBuilderStore() packer.MapOfBuilder {
|
func (v *VirtualBoxISOAccTest) GetBuilderStore() packer.MapOfBuilder {
|
||||||
return 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 },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Error("Builder must implement builder.")
|
t.Error("Builder must implement builder.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
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.
|
// images.
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
config Config
|
config Config
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
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.
|
// images.
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
config Config
|
config Config
|
||||||
|
|
|
@ -25,7 +25,7 @@ func testConfig() map[string]interface{} {
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Error("Builder must implement builder.")
|
t.Error("Builder must implement builder.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ func setupVMwareBuild(t *testing.T, builderConfig map[string]string, provisioner
|
||||||
// create our config to test the vmware-iso builder
|
// create our config to test the vmware-iso builder
|
||||||
components := packer.ComponentFinder{
|
components := packer.ComponentFinder{
|
||||||
BuilderStore: packer.MapOfBuilder{
|
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) {
|
Hook: func(n string) (packersdk.Hook, error) {
|
||||||
return &packersdk.DispatchHook{}, nil
|
return &packersdk.DispatchHook{}, nil
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
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.
|
// images.
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
config Config
|
config Config
|
||||||
|
|
|
@ -3,13 +3,13 @@ package clone
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCloneBuilder_ImplementsBuilder(t *testing.T) {
|
func TestCloneBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Builder{}
|
raw = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,12 @@ package yandex
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var raw interface{} = &Builder{}
|
var raw interface{} = &Builder{}
|
||||||
if _, ok := raw.(packer.Builder); !ok {
|
if _, ok := raw.(packersdk.Builder); !ok {
|
||||||
t.Fatalf("Builder should be a builder")
|
t.Fatalf("Builder should be a builder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,9 +69,9 @@ func testMetaParallel(t *testing.T, builder *ParallelTestBuilder, locked *Locked
|
||||||
CoreConfig: &packer.CoreConfig{
|
CoreConfig: &packer.CoreConfig{
|
||||||
Components: packer.ComponentFinder{
|
Components: packer.ComponentFinder{
|
||||||
BuilderStore: packer.MapOfBuilder{
|
BuilderStore: packer.MapOfBuilder{
|
||||||
"parallel-test": func() (packer.Builder, error) { return builder, nil },
|
"parallel-test": func() (packersdk.Builder, error) { return builder, nil },
|
||||||
"file": func() (packer.Builder, error) { return &file.Builder{}, nil },
|
"file": func() (packersdk.Builder, error) { return &file.Builder{}, nil },
|
||||||
"lock": func() (packer.Builder, error) { return locked, nil },
|
"lock": func() (packersdk.Builder, error) { return locked, nil },
|
||||||
},
|
},
|
||||||
ProvisionerStore: packer.MapOfProvisioner{
|
ProvisionerStore: packer.MapOfProvisioner{
|
||||||
"sleep": func() (packer.Provisioner, error) { return &sleep.Provisioner{}, nil },
|
"sleep": func() (packer.Provisioner, error) { return &sleep.Provisioner{}, nil },
|
||||||
|
|
|
@ -837,8 +837,8 @@ func fileExists(filename string) bool {
|
||||||
func testCoreConfigBuilder(t *testing.T) *packer.CoreConfig {
|
func testCoreConfigBuilder(t *testing.T) *packer.CoreConfig {
|
||||||
components := packer.ComponentFinder{
|
components := packer.ComponentFinder{
|
||||||
BuilderStore: packer.MapOfBuilder{
|
BuilderStore: packer.MapOfBuilder{
|
||||||
"file": func() (packer.Builder, error) { return &file.Builder{}, nil },
|
"file": func() (packersdk.Builder, error) { return &file.Builder{}, nil },
|
||||||
"null": func() (packer.Builder, error) { return &null.Builder{}, nil },
|
"null": func() (packersdk.Builder, error) { return &null.Builder{}, nil },
|
||||||
},
|
},
|
||||||
ProvisionerStore: packer.MapOfProvisioner{
|
ProvisionerStore: packer.MapOfProvisioner{
|
||||||
"shell-local": func() (packer.Provisioner, error) { return &shell_local.Provisioner{}, nil },
|
"shell-local": func() (packer.Provisioner, error) { return &shell_local.Provisioner{}, nil },
|
||||||
|
|
|
@ -17,7 +17,7 @@ import (
|
||||||
func testCoreConfigSleepBuilder(t *testing.T) *packer.CoreConfig {
|
func testCoreConfigSleepBuilder(t *testing.T) *packer.CoreConfig {
|
||||||
components := packer.ComponentFinder{
|
components := packer.ComponentFinder{
|
||||||
BuilderStore: packer.MapOfBuilder{
|
BuilderStore: packer.MapOfBuilder{
|
||||||
"file": func() (packer.Builder, error) { return &file.Builder{}, nil },
|
"file": func() (packersdk.Builder, error) { return &file.Builder{}, nil },
|
||||||
},
|
},
|
||||||
ProvisionerStore: packer.MapOfProvisioner{
|
ProvisionerStore: packer.MapOfProvisioner{
|
||||||
"sleep": func() (packer.Provisioner, error) { return &sleep.Provisioner{}, nil },
|
"sleep": func() (packer.Provisioner, error) { return &sleep.Provisioner{}, nil },
|
||||||
|
|
|
@ -119,9 +119,9 @@ func commandMeta() Meta {
|
||||||
func getBareComponentFinder() packer.ComponentFinder {
|
func getBareComponentFinder() packer.ComponentFinder {
|
||||||
return packer.ComponentFinder{
|
return packer.ComponentFinder{
|
||||||
BuilderStore: packer.MapOfBuilder{
|
BuilderStore: packer.MapOfBuilder{
|
||||||
"file": func() (packer.Builder, error) { return &file.Builder{}, nil },
|
"file": func() (packersdk.Builder, error) { return &file.Builder{}, nil },
|
||||||
"null": func() (packer.Builder, error) { return &null.Builder{}, nil },
|
"null": func() (packersdk.Builder, error) { return &null.Builder{}, nil },
|
||||||
"amazon-ebs": func() (packer.Builder, error) { return &ebs.Builder{}, nil },
|
"amazon-ebs": func() (packersdk.Builder, error) { return &ebs.Builder{}, nil },
|
||||||
},
|
},
|
||||||
ProvisionerStore: packer.MapOfProvisioner{
|
ProvisionerStore: packer.MapOfProvisioner{
|
||||||
"shell-local": func() (packer.Provisioner, error) { return &shell_local.Provisioner{}, nil },
|
"shell-local": func() (packer.Provisioner, error) { return &shell_local.Provisioner{}, nil },
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
"github.com/hashicorp/packer/packer/plugin"
|
"github.com/hashicorp/packer/packer/plugin"
|
||||||
|
|
||||||
alicloudecsbuilder "github.com/hashicorp/packer/builder/alicloud/ecs"
|
alicloudecsbuilder "github.com/hashicorp/packer/builder/alicloud/ecs"
|
||||||
|
@ -111,7 +112,7 @@ type PluginCommand struct {
|
||||||
Meta
|
Meta
|
||||||
}
|
}
|
||||||
|
|
||||||
var Builders = map[string]packer.Builder{
|
var Builders = map[string]packersdk.Builder{
|
||||||
"alicloud-ecs": new(alicloudecsbuilder.Builder),
|
"alicloud-ecs": new(alicloudecsbuilder.Builder),
|
||||||
"amazon-chroot": new(amazonchrootbuilder.Builder),
|
"amazon-chroot": new(amazonchrootbuilder.Builder),
|
||||||
"amazon-ebs": new(amazonebsbuilder.Builder),
|
"amazon-ebs": new(amazonebsbuilder.Builder),
|
||||||
|
|
10
config.go
10
config.go
|
@ -98,7 +98,7 @@ func (c *config) loadSingleComponent(path string) (string, error) {
|
||||||
switch {
|
switch {
|
||||||
case strings.HasPrefix(pluginName, "packer-builder-"):
|
case strings.HasPrefix(pluginName, "packer-builder-"):
|
||||||
pluginName = pluginName[len("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()
|
return c.pluginClient(path).Builder()
|
||||||
}
|
}
|
||||||
case strings.HasPrefix(pluginName, "packer-post-processor-"):
|
case strings.HasPrefix(pluginName, "packer-post-processor-"):
|
||||||
|
@ -180,9 +180,9 @@ func (c *config) Discover() error {
|
||||||
return nil
|
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.
|
// 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)
|
log.Printf("Loading builder: %s\n", name)
|
||||||
return c.Builders.Start(name)
|
return c.Builders.Start(name)
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ func (c *config) discoverExternalComponents(path string) error {
|
||||||
}
|
}
|
||||||
for pluginName, pluginPath := range pluginPaths {
|
for pluginName, pluginPath := range pluginPaths {
|
||||||
newPath := pluginPath // this needs to be stored in a new variable for the func below
|
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()
|
return c.pluginClient(newPath).Builder()
|
||||||
}
|
}
|
||||||
externallyUsed = append(externallyUsed, pluginName)
|
externallyUsed = append(externallyUsed, pluginName)
|
||||||
|
@ -321,7 +321,7 @@ func (c *config) discoverInternalComponents() error {
|
||||||
builder := builder
|
builder := builder
|
||||||
_, found := (c.Builders)[builder]
|
_, found := (c.Builders)[builder]
|
||||||
if !found {
|
if !found {
|
||||||
c.Builders[builder] = func() (packer.Builder, error) {
|
c.Builders[builder] = func() (packersdk.Builder, error) {
|
||||||
bin := fmt.Sprintf("%s%splugin%spacker-builder-%s",
|
bin := fmt.Sprintf("%s%splugin%spacker-builder-%s",
|
||||||
packerPath, PACKERSPACE, PACKERSPACE, builder)
|
packerPath, PACKERSPACE, PACKERSPACE, builder)
|
||||||
return c.pluginClient(bin).Builder()
|
return c.pluginClient(bin).Builder()
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"github.com/hashicorp/packer/builder/null"
|
"github.com/hashicorp/packer/builder/null"
|
||||||
. "github.com/hashicorp/packer/hcl2template/internal"
|
. "github.com/hashicorp/packer/hcl2template/internal"
|
||||||
"github.com/hashicorp/packer/packer"
|
"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/hashicorp/packer/packer-plugin-sdk/template/config"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
|
@ -20,9 +21,9 @@ func getBasicParser() *Parser {
|
||||||
return &Parser{
|
return &Parser{
|
||||||
Parser: hclparse.NewParser(),
|
Parser: hclparse.NewParser(),
|
||||||
BuilderSchemas: packer.MapOfBuilder{
|
BuilderSchemas: packer.MapOfBuilder{
|
||||||
"amazon-ebs": func() (packer.Builder, error) { return &MockBuilder{}, nil },
|
"amazon-ebs": func() (packersdk.Builder, error) { return &MockBuilder{}, nil },
|
||||||
"virtualbox-iso": func() (packer.Builder, error) { return &MockBuilder{}, nil },
|
"virtualbox-iso": func() (packersdk.Builder, error) { return &MockBuilder{}, nil },
|
||||||
"null": func() (packer.Builder, error) { return &null.Builder{}, nil },
|
"null": func() (packersdk.Builder, error) { return &null.Builder{}, nil },
|
||||||
},
|
},
|
||||||
ProvisionersSchemas: packer.MapOfProvisioner{
|
ProvisionersSchemas: packer.MapOfProvisioner{
|
||||||
"shell": func() (packer.Provisioner, error) { return &MockProvisioner{}, nil },
|
"shell": func() (packer.Provisioner, error) { return &MockProvisioner{}, nil },
|
||||||
|
|
|
@ -70,7 +70,7 @@ type MockBuilder struct {
|
||||||
Config MockConfig
|
Config MockConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ packer.Builder = new(MockBuilder)
|
var _ packersdk.Builder = new(MockBuilder)
|
||||||
|
|
||||||
func (b *MockBuilder) ConfigSpec() hcldec.ObjectSpec { return b.Config.FlatMapstructure().HCL2Spec() }
|
func (b *MockBuilder) ConfigSpec() hcldec.ObjectSpec { return b.Config.FlatMapstructure().HCL2Spec() }
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"github.com/hashicorp/hcl/v2"
|
"github.com/hashicorp/hcl/v2"
|
||||||
"github.com/hashicorp/hcl/v2/gohcl"
|
"github.com/hashicorp/hcl/v2/gohcl"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
"github.com/zclconf/go-cty/cty"
|
"github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -88,7 +89,7 @@ func (p *Parser) decodeSource(block *hcl.Block) (SourceBlock, hcl.Diagnostics) {
|
||||||
return source, diags
|
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
|
var diags hcl.Diagnostics
|
||||||
|
|
||||||
builder, err := cfg.builderSchemas.Start(source.Type)
|
builder, err := cfg.builderSchemas.Start(source.Type)
|
||||||
|
|
|
@ -28,7 +28,7 @@ type TestCase struct {
|
||||||
|
|
||||||
// Builder is the Builder that will be tested. It will be available
|
// Builder is the Builder that will be tested. It will be available
|
||||||
// as the "test" builder in the template.
|
// as the "test" builder in the template.
|
||||||
Builder packer.Builder
|
Builder packersdk.Builder
|
||||||
|
|
||||||
// Template is the template contents to use.
|
// Template is the template contents to use.
|
||||||
Template string
|
Template string
|
||||||
|
@ -66,10 +66,10 @@ type TestT interface {
|
||||||
|
|
||||||
type TestBuilderStore struct {
|
type TestBuilderStore struct {
|
||||||
packer.BuilderStore
|
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.
|
// 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{
|
core := packer.NewCore(&packer.CoreConfig{
|
||||||
Components: packer.ComponentFinder{
|
Components: packer.ComponentFinder{
|
||||||
BuilderStore: TestBuilderStore{
|
BuilderStore: TestBuilderStore{
|
||||||
StartFn: func(n string) (packer.Builder, error) {
|
StartFn: func(n string) (packersdk.Builder, error) {
|
||||||
if n == "test" {
|
if n == "test" {
|
||||||
return c.Builder, nil
|
return c.Builder, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ func FileExists(filename string) bool {
|
||||||
func testCoreConfigBuilder(t *testing.T) *packer.CoreConfig {
|
func testCoreConfigBuilder(t *testing.T) *packer.CoreConfig {
|
||||||
components := packer.ComponentFinder{
|
components := packer.ComponentFinder{
|
||||||
BuilderStore: packer.MapOfBuilder{
|
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{
|
ProvisionerStore: packer.MapOfProvisioner{
|
||||||
"shell": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil },
|
"shell": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil },
|
||||||
|
|
|
@ -2,8 +2,6 @@ package packer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Implementers of Builder are responsible for actually building images
|
// 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
|
// parallelism is strictly disabled, so it is safe to request input from
|
||||||
// stdin and so on.
|
// stdin and so on.
|
||||||
type Builder interface {
|
type Builder interface {
|
||||||
packersdk.HCL2Speccer
|
HCL2Speccer
|
||||||
|
|
||||||
// Prepare is responsible for configuring the builder and validating
|
// Prepare is responsible for configuring the builder and validating
|
||||||
// that configuration. Any setup should be done in this method. Note that
|
// that configuration. Any setup should be done in this method. Note that
|
||||||
|
@ -37,5 +35,5 @@ type Builder interface {
|
||||||
Prepare(...interface{}) ([]string, []string, error)
|
Prepare(...interface{}) ([]string, []string, error)
|
||||||
|
|
||||||
// Run is where the actual build should take place. It takes a Build and a Ui.
|
// 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)
|
||||||
}
|
}
|
|
@ -95,7 +95,7 @@ type Build interface {
|
||||||
type CoreBuild struct {
|
type CoreBuild struct {
|
||||||
BuildName string
|
BuildName string
|
||||||
Type string
|
Type string
|
||||||
Builder Builder
|
Builder packersdk.Builder
|
||||||
BuilderConfig interface{}
|
BuilderConfig interface{}
|
||||||
BuilderType string
|
BuilderType string
|
||||||
hooks map[string][]packersdk.Hook
|
hooks map[string][]packersdk.Hook
|
||||||
|
|
|
@ -50,7 +50,7 @@ type CoreConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The function type used to lookup Builder implementations.
|
// 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.
|
// The function type used to lookup Hook implementations.
|
||||||
type HookFunc func(name string) (packersdk.Hook, error)
|
type HookFunc func(name string) (packersdk.Hook, error)
|
||||||
|
@ -68,7 +68,7 @@ type BasicStore interface {
|
||||||
|
|
||||||
type BuilderStore interface {
|
type BuilderStore interface {
|
||||||
BasicStore
|
BasicStore
|
||||||
Start(name string) (Builder, error)
|
Start(name string) (packersdk.Builder, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProvisionerStore interface {
|
type ProvisionerStore interface {
|
||||||
|
|
|
@ -2,6 +2,8 @@ package packer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MapOfProvisioner map[string]func() (Provisioner, error)
|
type MapOfProvisioner map[string]func() (Provisioner, error)
|
||||||
|
@ -50,14 +52,14 @@ func (mopp MapOfPostProcessor) List() []string {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
type MapOfBuilder map[string]func() (Builder, error)
|
type MapOfBuilder map[string]func() (packersdk.Builder, error)
|
||||||
|
|
||||||
func (mob MapOfBuilder) Has(builder string) bool {
|
func (mob MapOfBuilder) Has(builder string) bool {
|
||||||
_, res := mob[builder]
|
_, res := mob[builder]
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mob MapOfBuilder) Start(builder string) (Builder, error) {
|
func (mob MapOfBuilder) Start(builder string) (packersdk.Builder, error) {
|
||||||
d, found := mob[builder]
|
d, found := mob[builder]
|
||||||
if !found {
|
if !found {
|
||||||
return nil, fmt.Errorf("Unknown builder %s", builder)
|
return nil, fmt.Errorf("Unknown builder %s", builder)
|
||||||
|
|
|
@ -5,12 +5,11 @@ import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/hashicorp/hcl/v2/hcldec"
|
"github.com/hashicorp/hcl/v2/hcldec"
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type cmdBuilder struct {
|
type cmdBuilder struct {
|
||||||
builder packer.Builder
|
builder packersdk.Builder
|
||||||
client *Client
|
client *Client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ func (c *Client) Exited() bool {
|
||||||
|
|
||||||
// Returns a builder implementation that is communicating over this
|
// Returns a builder implementation that is communicating over this
|
||||||
// client. If the client hasn't been started, this will start it.
|
// 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()
|
client, err := c.packrpcClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -4,24 +4,23 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
|
||||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/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.
|
// over an RPC connection.
|
||||||
type builder struct {
|
type builder struct {
|
||||||
commonClient
|
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.
|
// as part of a Golang RPC server.
|
||||||
type BuilderServer struct {
|
type BuilderServer struct {
|
||||||
context context.Context
|
context context.Context
|
||||||
contextCancel func()
|
contextCancel func()
|
||||||
|
|
||||||
commonServer
|
commonServer
|
||||||
builder packer.Builder
|
builder packersdk.Builder
|
||||||
}
|
}
|
||||||
|
|
||||||
type BuilderPrepareArgs struct {
|
type BuilderPrepareArgs struct {
|
||||||
|
|
|
@ -155,5 +155,5 @@ func TestBuilderCancel(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
func TestBuilder_ImplementsBuilder(t *testing.T) {
|
||||||
var _ packer.Builder = new(builder)
|
var _ packersdk.Builder = new(builder)
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ func (c *Client) Build() packer.Build {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Builder() packer.Builder {
|
func (c *Client) Builder() packersdk.Builder {
|
||||||
return &builder{
|
return &builder{
|
||||||
commonClient: commonClient{
|
commonClient: commonClient{
|
||||||
endpoint: DefaultBuilderEndpoint,
|
endpoint: DefaultBuilderEndpoint,
|
||||||
|
|
|
@ -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{
|
return s.server.RegisterName(DefaultBuilderEndpoint, &BuilderServer{
|
||||||
commonServer: commonServer{
|
commonServer: commonServer{
|
||||||
selfConfigurable: b,
|
selfConfigurable: b,
|
||||||
|
|
|
@ -12,7 +12,7 @@ func TestCoreConfig(t *testing.T) *CoreConfig {
|
||||||
// Create some test components
|
// Create some test components
|
||||||
components := ComponentFinder{
|
components := ComponentFinder{
|
||||||
BuilderStore: MapOfBuilder{
|
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
|
var b MockBuilder
|
||||||
|
|
||||||
c.Components.BuilderStore = MapOfBuilder{
|
c.Components.BuilderStore = MapOfBuilder{
|
||||||
n: func() (Builder, error) { return &b, nil },
|
n: func() (packersdk.Builder, error) { return &b, nil },
|
||||||
}
|
}
|
||||||
|
|
||||||
return &b
|
return &b
|
||||||
|
|
|
@ -90,7 +90,7 @@ type plugin struct {
|
||||||
// makeMap creates a map named Name with type packer.Name that looks something
|
// makeMap creates a map named Name with type packer.Name that looks something
|
||||||
// like this:
|
// like this:
|
||||||
//
|
//
|
||||||
// var Builders = map[string]packer.Builder{
|
// var Builders = map[string]packersdk.Builder{
|
||||||
// "amazon-chroot": new(chroot.Builder),
|
// "amazon-chroot": new(chroot.Builder),
|
||||||
// "amazon-ebs": new(ebs.Builder),
|
// "amazon-ebs": new(ebs.Builder),
|
||||||
// "amazon-instance": new(instance.Builder),
|
// "amazon-instance": new(instance.Builder),
|
||||||
|
@ -254,6 +254,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
"github.com/hashicorp/packer/packer/plugin"
|
"github.com/hashicorp/packer/packer/plugin"
|
||||||
|
|
||||||
IMPORTS
|
IMPORTS
|
||||||
|
|
Loading…
Reference in New Issue