move Artifact and artifact mock to the sdk
This commit is contained in:
parent
c70870cb83
commit
14bdb9516c
|
@ -4,11 +4,11 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_Impl(t *testing.T) {
|
func TestArtifact_Impl(t *testing.T) {
|
||||||
var _ packer.Artifact = new(Artifact)
|
var _ packersdk.Artifact = new(Artifact)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestArtifactId(t *testing.T) {
|
func TestArtifactId(t *testing.T) {
|
||||||
|
|
|
@ -81,7 +81,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
|
|
||||||
client, err := b.config.Client()
|
client, err := b.config.Client()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
|
||||||
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"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultTestRegion = "cn-beijing"
|
const defaultTestRegion = "cn-beijing"
|
||||||
|
@ -104,7 +104,7 @@ const testBuilderAccWithDiskSettings = `
|
||||||
}`
|
}`
|
||||||
|
|
||||||
func checkImageDisksSettings() builderT.TestCheckFunc {
|
func checkImageDisksSettings() builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
if len(artifacts) > 1 {
|
if len(artifacts) > 1 {
|
||||||
return fmt.Errorf("more than 1 artifact")
|
return fmt.Errorf("more than 1 artifact")
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ const testBuilderAccIgnoreDataDisks = `
|
||||||
}`
|
}`
|
||||||
|
|
||||||
func checkIgnoreDataDisks() builderT.TestCheckFunc {
|
func checkIgnoreDataDisks() builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
if len(artifacts) > 1 {
|
if len(artifacts) > 1 {
|
||||||
return fmt.Errorf("more than 1 artifact")
|
return fmt.Errorf("more than 1 artifact")
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ const testBuilderAccRegionCopy = `
|
||||||
`
|
`
|
||||||
|
|
||||||
func checkRegionCopy(regions []string) builderT.TestCheckFunc {
|
func checkRegionCopy(regions []string) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
if len(artifacts) > 1 {
|
if len(artifacts) > 1 {
|
||||||
return fmt.Errorf("more than 1 artifact")
|
return fmt.Errorf("more than 1 artifact")
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ const testBuilderAccSharing = `
|
||||||
`
|
`
|
||||||
|
|
||||||
func checkECSImageSharing(uid string) builderT.TestCheckFunc {
|
func checkECSImageSharing(uid string) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
if len(artifacts) > 1 {
|
if len(artifacts) > 1 {
|
||||||
return fmt.Errorf("more than 1 artifact")
|
return fmt.Errorf("more than 1 artifact")
|
||||||
}
|
}
|
||||||
|
@ -534,7 +534,7 @@ const testBuilderAccForceDeleteSnapshot = `
|
||||||
`
|
`
|
||||||
|
|
||||||
func checkSnapshotsDeleted(snapshotIds []string) builderT.TestCheckFunc {
|
func checkSnapshotsDeleted(snapshotIds []string) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
// Verify the snapshots are gone
|
// Verify the snapshots are gone
|
||||||
client, _ := testAliyunClient()
|
client, _ := testAliyunClient()
|
||||||
data, err := json.Marshal(snapshotIds)
|
data, err := json.Marshal(snapshotIds)
|
||||||
|
@ -587,7 +587,7 @@ const testBuilderAccImageTags = `
|
||||||
}`
|
}`
|
||||||
|
|
||||||
func checkImageTags() builderT.TestCheckFunc {
|
func checkImageTags() builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
if len(artifacts) > 1 {
|
if len(artifacts) > 1 {
|
||||||
return fmt.Errorf("more than 1 artifact")
|
return fmt.Errorf("more than 1 artifact")
|
||||||
}
|
}
|
||||||
|
@ -716,7 +716,7 @@ const testBuilderAccDataDiskEncrypted = `
|
||||||
}`
|
}`
|
||||||
|
|
||||||
func checkDataDiskEncrypted() builderT.TestCheckFunc {
|
func checkDataDiskEncrypted() builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
if len(artifacts) > 1 {
|
if len(artifacts) > 1 {
|
||||||
return fmt.Errorf("more than 1 artifact")
|
return fmt.Errorf("more than 1 artifact")
|
||||||
}
|
}
|
||||||
|
@ -815,7 +815,7 @@ const testBuilderAccSystemDiskEncrypted = `
|
||||||
}`
|
}`
|
||||||
|
|
||||||
func checkSystemDiskEncrypted() builderT.TestCheckFunc {
|
func checkSystemDiskEncrypted() builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
if len(artifacts) > 1 {
|
if len(artifacts) > 1 {
|
||||||
return fmt.Errorf("more than 1 artifact")
|
return fmt.Errorf("more than 1 artifact")
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,7 +346,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return generatedData, warns, nil
|
return generatedData, warns, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
if runtime.GOOS != "linux" {
|
if runtime.GOOS != "linux" {
|
||||||
return nil, errors.New("The amazon-chroot builder only works on Linux environments.")
|
return nil, errors.New("The amazon-chroot builder only works on Linux environments.")
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,11 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_Impl(t *testing.T) {
|
func TestArtifact_Impl(t *testing.T) {
|
||||||
var _ packer.Artifact = new(Artifact)
|
var _ packersdk.Artifact = new(Artifact)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestArtifactId(t *testing.T) {
|
func TestArtifactId(t *testing.T) {
|
||||||
|
|
|
@ -151,7 +151,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return generatedData, warns, nil
|
return generatedData, warns, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
|
|
||||||
session, err := b.config.Session()
|
session, err := b.config.Session()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/builder/amazon/common"
|
"github.com/hashicorp/packer/builder/amazon/common"
|
||||||
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"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuilderAcc_basic(t *testing.T) {
|
func TestBuilderAcc_basic(t *testing.T) {
|
||||||
|
@ -89,7 +89,7 @@ func TestBuilderAcc_forceDeleteSnapshot(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkSnapshotsDeleted(snapshotIds []*string) builderT.TestCheckFunc {
|
func checkSnapshotsDeleted(snapshotIds []*string) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
// Verify the snapshots are gone
|
// Verify the snapshots are gone
|
||||||
ec2conn, _ := testEC2Conn()
|
ec2conn, _ := testEC2Conn()
|
||||||
snapshotResp, _ := ec2conn.DescribeSnapshots(
|
snapshotResp, _ := ec2conn.DescribeSnapshots(
|
||||||
|
@ -122,7 +122,7 @@ func TestBuilderAcc_encryptedBoot(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkAMISharing(count int, uid, group string) builderT.TestCheckFunc {
|
func checkAMISharing(count int, uid, group string) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
if len(artifacts) > 1 {
|
if len(artifacts) > 1 {
|
||||||
return fmt.Errorf("more than 1 artifact")
|
return fmt.Errorf("more than 1 artifact")
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ func checkAMISharing(count int, uid, group string) builderT.TestCheckFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkRegionCopy(regions []string) builderT.TestCheckFunc {
|
func checkRegionCopy(regions []string) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
if len(artifacts) > 1 {
|
if len(artifacts) > 1 {
|
||||||
return fmt.Errorf("more than 1 artifact")
|
return fmt.Errorf("more than 1 artifact")
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ func checkRegionCopy(regions []string) builderT.TestCheckFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkBootEncrypted() builderT.TestCheckFunc {
|
func checkBootEncrypted() builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
|
|
||||||
// Get the actual *Artifact pointer so we can access the AMIs directly
|
// Get the actual *Artifact pointer so we can access the AMIs directly
|
||||||
artifactRaw := artifacts[0]
|
artifactRaw := artifacts[0]
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/hashicorp/packer/builder/amazon/common"
|
"github.com/hashicorp/packer/builder/amazon/common"
|
||||||
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"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TFBuilder struct {
|
type TFBuilder struct {
|
||||||
|
@ -37,7 +37,7 @@ func TestBuilderTagsAcc_basic(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkTags() builderT.TestCheckFunc {
|
func checkTags() builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
if len(artifacts) > 1 {
|
if len(artifacts) > 1 {
|
||||||
return fmt.Errorf("more than 1 artifact")
|
return fmt.Errorf("more than 1 artifact")
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return generatedData, warns, nil
|
return generatedData, warns, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
session, err := b.config.Session()
|
session, err := b.config.Session()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -165,7 +165,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return generatedData, warns, nil
|
return generatedData, warns, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
session, err := b.config.Session()
|
session, err := b.config.Session()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -234,7 +234,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return generatedData, warns, nil
|
return generatedData, warns, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
session, err := b.config.Session()
|
session, err := b.config.Session()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -52,7 +52,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, errs
|
return nil, warnings, errs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
|
|
||||||
ui.Say("Running builder ...")
|
ui.Say("Running builder ...")
|
||||||
|
|
||||||
|
|
|
@ -393,7 +393,7 @@ func checkHyperVGeneration(s string) interface{} {
|
||||||
s, compute.PossibleHyperVGenerationValues())
|
s, compute.PossibleHyperVGenerationValues())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "linux", "freebsd":
|
case "linux", "freebsd":
|
||||||
break
|
break
|
||||||
|
|
|
@ -52,7 +52,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, errs
|
return nil, warnings, errs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
|
|
||||||
ui.Say("Running builder ...")
|
ui.Say("Running builder ...")
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package cloudstack
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
"github.com/xanzy/go-cloudstack/cloudstack"
|
"github.com/xanzy/go-cloudstack/cloudstack"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ const templateID = "286dd44a-ec6b-4789-b192-804f08f04b4c"
|
||||||
func TestArtifact_Impl(t *testing.T) {
|
func TestArtifact_Impl(t *testing.T) {
|
||||||
var raw interface{} = &Artifact{}
|
var raw interface{} = &Artifact{}
|
||||||
|
|
||||||
if _, ok := raw.(packer.Artifact); !ok {
|
if _, ok := raw.(packersdk.Artifact); !ok {
|
||||||
t.Fatalf("Artifact does not implement packer.Artifact")
|
t.Fatalf("Artifact does not implement packersdk.Artifact")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run implements the packer.Builder interface.
|
// Run implements the packer.Builder interface.
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
b.ui = ui
|
b.ui = ui
|
||||||
|
|
||||||
// Create a CloudStack API client.
|
// Create a CloudStack API client.
|
||||||
|
|
|
@ -3,7 +3,7 @@ package digitalocean
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func generatedData() map[string]interface{} {
|
func generatedData() map[string]interface{} {
|
||||||
|
@ -13,7 +13,7 @@ func generatedData() map[string]interface{} {
|
||||||
func TestArtifact_Impl(t *testing.T) {
|
func TestArtifact_Impl(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Artifact{}
|
raw = &Artifact{}
|
||||||
if _, ok := raw.(packer.Artifact); !ok {
|
if _, ok := raw.(packersdk.Artifact); !ok {
|
||||||
t.Fatalf("Artifact should be artifact")
|
t.Fatalf("Artifact should be artifact")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
client := godo.NewClient(oauth2.NewClient(context.TODO(), &apiTokenSource{
|
client := godo.NewClient(oauth2.NewClient(context.TODO(), &apiTokenSource{
|
||||||
AccessToken: b.config.APIToken,
|
AccessToken: b.config.APIToken,
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -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 TestExportArtifact_impl(t *testing.T) {
|
func TestExportArtifact_impl(t *testing.T) {
|
||||||
var _ packer.Artifact = new(ExportArtifact)
|
var _ packersdk.Artifact = new(ExportArtifact)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,11 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestImportArtifact_impl(t *testing.T) {
|
func TestImportArtifact_impl(t *testing.T) {
|
||||||
var _ packer.Artifact = new(ImportArtifact)
|
var _ packersdk.Artifact = new(ImportArtifact)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestImportArtifactBuilderId(t *testing.T) {
|
func TestImportArtifactBuilderId(t *testing.T) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
}, warnings, nil
|
}, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
driver := &DockerDriver{Ctx: &b.config.ctx, Ui: ui}
|
driver := &DockerDriver{Ctx: &b.config.ctx, Ui: ui}
|
||||||
if err := driver.Verify(); err != nil {
|
if err := driver.Verify(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -108,7 +108,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (p
|
||||||
}
|
}
|
||||||
|
|
||||||
// No errors, must've worked
|
// No errors, must've worked
|
||||||
var artifact packer.Artifact
|
var artifact packersdk.Artifact
|
||||||
if b.config.Commit {
|
if b.config.Commit {
|
||||||
artifact = &ImportArtifact{
|
artifact = &ImportArtifact{
|
||||||
IdValue: state.Get("image_id").(string),
|
IdValue: state.Get("image_id").(string),
|
||||||
|
|
|
@ -3,9 +3,9 @@ package file
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNullArtifact(t *testing.T) {
|
func TestNullArtifact(t *testing.T) {
|
||||||
var _ packer.Artifact = new(FileArtifact)
|
var _ packersdk.Artifact = new(FileArtifact)
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ func (b *Builder) Prepare(raws ...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.
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
artifact := new(FileArtifact)
|
artifact := new(FileArtifact)
|
||||||
|
|
||||||
// Create all directories leading to target
|
// Create all directories leading to target
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
builderT "github.com/hashicorp/packer/helper/builder/testing"
|
builderT "github.com/hashicorp/packer/helper/builder/testing"
|
||||||
"github.com/hashicorp/packer/packer"
|
"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) {
|
||||||
|
@ -29,7 +30,7 @@ func TestBuilderFileAcc_copy(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkContent(artifacts []packer.Artifact) error {
|
func checkContent(artifacts []packersdk.Artifact) error {
|
||||||
content, err := ioutil.ReadFile("contentTest.txt")
|
content, err := ioutil.ReadFile("contentTest.txt")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -41,7 +42,7 @@ func checkContent(artifacts []packer.Artifact) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkCopy(artifacts []packer.Artifact) error {
|
func checkCopy(artifacts []packersdk.Artifact) error {
|
||||||
content, err := ioutil.ReadFile("copyTest.txt")
|
content, err := ioutil.ReadFile("copyTest.txt")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -3,11 +3,11 @@ package googlecompute
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_impl(t *testing.T) {
|
func TestArtifact_impl(t *testing.T) {
|
||||||
var _ packer.Artifact = new(Artifact)
|
var _ packersdk.Artifact = new(Artifact)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestArtifactState_StateData(t *testing.T) {
|
func TestArtifactState_StateData(t *testing.T) {
|
||||||
|
|
|
@ -34,9 +34,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes a googlecompute Packer build and returns a packer.Artifact
|
// Run executes a googlecompute Packer build and returns a packersdk.Artifact
|
||||||
// representing a GCE machine image.
|
// representing a GCE machine image.
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
cfg := GCEDriverConfig{
|
cfg := GCEDriverConfig{
|
||||||
Ui: ui,
|
Ui: ui,
|
||||||
ProjectId: b.config.ProjectId,
|
ProjectId: b.config.ProjectId,
|
||||||
|
|
|
@ -3,11 +3,11 @@ package hcloud
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_Impl(t *testing.T) {
|
func TestArtifact_Impl(t *testing.T) {
|
||||||
var _ packer.Artifact = (*Artifact)(nil)
|
var _ packersdk.Artifact = (*Artifact)(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestArtifactId(t *testing.T) {
|
func TestArtifactId(t *testing.T) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
opts := []hcloud.ClientOption{
|
opts := []hcloud.ClientOption{
|
||||||
hcloud.WithToken(b.config.HCloudToken),
|
hcloud.WithToken(b.config.HCloudToken),
|
||||||
hcloud.WithEndpoint(b.config.Endpoint),
|
hcloud.WithEndpoint(b.config.Endpoint),
|
||||||
|
|
|
@ -52,7 +52,7 @@ type wrappedCommandTemplate struct {
|
||||||
Command string
|
Command string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
wrappedCommand := func(command string) (string, error) {
|
wrappedCommand := func(command string) (string, error) {
|
||||||
ictx := b.config.ctx
|
ictx := b.config.ctx
|
||||||
ictx.Data = &wrappedCommandTemplate{Command: command}
|
ictx.Data = &wrappedCommandTemplate{Command: command}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This is the common builder ID to all of these artifacts.
|
// This is the common builder ID to all of these artifacts.
|
||||||
|
@ -24,7 +24,7 @@ type artifact struct {
|
||||||
|
|
||||||
// NewArtifact returns a hyperv artifact containing the files
|
// NewArtifact returns a hyperv artifact containing the files
|
||||||
// in the given directory.
|
// in the given directory.
|
||||||
func NewArtifact(dir string, generatedData map[string]interface{}) (packer.Artifact, error) {
|
func NewArtifact(dir string, generatedData map[string]interface{}) (packersdk.Artifact, error) {
|
||||||
files := make([]string, 0, 5)
|
files := make([]string, 0, 5)
|
||||||
visit := func(path string, info os.FileInfo, err error) error {
|
visit := func(path string, info os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -6,11 +6,11 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_impl(t *testing.T) {
|
func TestArtifact_impl(t *testing.T) {
|
||||||
var _ packer.Artifact = new(artifact)
|
var _ packersdk.Artifact = new(artifact)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewArtifact(t *testing.T) {
|
func TestNewArtifact(t *testing.T) {
|
||||||
|
|
|
@ -175,9 +175,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes a Packer build and returns a packer.Artifact representing
|
// Run executes a Packer build and returns a packersdk.Artifact representing
|
||||||
// a Hyperv appliance.
|
// a Hyperv appliance.
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
// Create the driver that we'll use to communicate with Hyperv
|
// Create the driver that we'll use to communicate with Hyperv
|
||||||
driver, err := hypervcommon.NewHypervPS4Driver()
|
driver, err := hypervcommon.NewHypervPS4Driver()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -215,9 +215,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes a Packer build and returns a packer.Artifact representing
|
// Run executes a Packer build and returns a packersdk.Artifact representing
|
||||||
// a Hyperv appliance.
|
// a Hyperv appliance.
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
// Create the driver that we'll use to communicate with Hyperv
|
// Create the driver that we'll use to communicate with Hyperv
|
||||||
driver, err := hypervcommon.NewHypervPS4Driver()
|
driver, err := hypervcommon.NewHypervPS4Driver()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -43,7 +43,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
|
|
||||||
state := new(multistep.BasicStateBag)
|
state := new(multistep.BasicStateBag)
|
||||||
state.Put("hook", hook)
|
state.Put("hook", hook)
|
||||||
|
|
|
@ -3,13 +3,13 @@ package linode
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_Impl(t *testing.T) {
|
func TestArtifact_Impl(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Artifact{}
|
raw = &Artifact{}
|
||||||
if _, ok := raw.(packer.Artifact); !ok {
|
if _, ok := raw.(packersdk.Artifact); !ok {
|
||||||
t.Fatalf("Artifact should be artifact")
|
t.Fatalf("Artifact should be artifact")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (ret packer.Artifact, err error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (ret packersdk.Artifact, err error) {
|
||||||
ui.Say("Running builder ...")
|
ui.Say("Running builder ...")
|
||||||
|
|
||||||
client := newLinodeClient(b.config.PersonalAccessToken)
|
client := newLinodeClient(b.config.PersonalAccessToken)
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
wrappedCommand := func(command string) (string, error) {
|
wrappedCommand := func(command string) (string, error) {
|
||||||
b.config.ctx.Data = &wrappedCommandTemplate{Command: command}
|
b.config.ctx.Data = &wrappedCommandTemplate{Command: command}
|
||||||
return interpolate.Render(b.config.CommandWrapper, &b.config.ctx)
|
return interpolate.Render(b.config.CommandWrapper, &b.config.ctx)
|
||||||
|
|
|
@ -34,7 +34,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
wrappedCommand := func(command string) (string, error) {
|
wrappedCommand := func(command string) (string, error) {
|
||||||
b.config.ctx.Data = &wrappedCommandTemplate{Command: command}
|
b.config.ctx.Data = &wrappedCommandTemplate{Command: command}
|
||||||
return interpolate.Render(b.config.CommandWrapper, &b.config.ctx)
|
return interpolate.Render(b.config.CommandWrapper, &b.config.ctx)
|
||||||
|
|
|
@ -32,7 +32,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
ui.Message("Creating Naver Cloud Platform Connection ...")
|
ui.Message("Creating Naver Cloud Platform Connection ...")
|
||||||
config := Config{
|
config := Config{
|
||||||
AccessKey: b.config.AccessKey,
|
AccessKey: b.config.AccessKey,
|
||||||
|
|
|
@ -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 TestNullArtifact(t *testing.T) {
|
func TestNullArtifact(t *testing.T) {
|
||||||
var _ packer.Artifact = new(NullArtifact)
|
var _ packersdk.Artifact = new(NullArtifact)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
steps := []multistep.Step{}
|
steps := []multistep.Step{}
|
||||||
|
|
||||||
steps = append(steps,
|
steps = append(steps,
|
||||||
|
|
|
@ -31,7 +31,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
|
|
||||||
state := new(multistep.BasicStateBag)
|
state := new(multistep.BasicStateBag)
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@ package openstack
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_Impl(t *testing.T) {
|
func TestArtifact_Impl(t *testing.T) {
|
||||||
var _ packer.Artifact = new(Artifact)
|
var _ packersdk.Artifact = new(Artifact)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestArtifactId(t *testing.T) {
|
func TestArtifactId(t *testing.T) {
|
||||||
|
|
|
@ -73,7 +73,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
if b.config.PackerDebug {
|
if b.config.PackerDebug {
|
||||||
b.config.enableDebug(ui)
|
b.config.enableDebug(ui)
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
loggingEnabled := os.Getenv("PACKER_OCI_CLASSIC_LOGGING") != ""
|
loggingEnabled := os.Getenv("PACKER_OCI_CLASSIC_LOGGING") != ""
|
||||||
httpClient := cleanhttp.DefaultClient()
|
httpClient := cleanhttp.DefaultClient()
|
||||||
config := &opc.Config{
|
config := &opc.Config{
|
||||||
|
|
|
@ -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 TestArtifactImpl(t *testing.T) {
|
func TestArtifactImpl(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Artifact{}
|
raw = &Artifact{}
|
||||||
if _, ok := raw.(packer.Artifact); !ok {
|
if _, ok := raw.(packersdk.Artifact); !ok {
|
||||||
t.Fatalf("Artifact should be artifact")
|
t.Fatalf("Artifact should be artifact")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
driver, err := NewDriverOCI(&b.config)
|
driver, err := NewDriverOCI(&b.config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -85,7 +85,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
oscConn := b.config.NewOSCClient()
|
oscConn := b.config.NewOSCClient()
|
||||||
|
|
||||||
// Setup the state bag and initial state for the steps
|
// Setup the state bag and initial state for the steps
|
||||||
|
|
|
@ -103,7 +103,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
oscConn := b.config.NewOSCClient()
|
oscConn := b.config.NewOSCClient()
|
||||||
|
|
||||||
// Setup the state bag and initial state for the steps
|
// Setup the state bag and initial state for the steps
|
||||||
|
|
|
@ -88,7 +88,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
// clientConfig, err := b.config.Config()
|
// clientConfig, err := b.config.Config()
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// return nil, err
|
// return nil, err
|
||||||
|
|
|
@ -188,7 +188,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warns, nil
|
return nil, warns, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
if runtime.GOOS != "linux" {
|
if runtime.GOOS != "linux" {
|
||||||
return nil, errors.New("The outscale-chroot builder only works on Linux environments.")
|
return nil, errors.New("The outscale-chroot builder only works on Linux environments.")
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BuilderId is the common builder ID to all of these artifacts.
|
// BuilderId is the common builder ID to all of these artifacts.
|
||||||
|
@ -29,7 +29,7 @@ type artifact struct {
|
||||||
|
|
||||||
// NewArtifact returns a Parallels artifact containing the files
|
// NewArtifact returns a Parallels artifact containing the files
|
||||||
// in the given directory.
|
// in the given directory.
|
||||||
func NewArtifact(dir string, generatedData map[string]interface{}) (packer.Artifact, error) {
|
func NewArtifact(dir string, generatedData map[string]interface{}) (packersdk.Artifact, error) {
|
||||||
files := make([]string, 0, 5)
|
files := make([]string, 0, 5)
|
||||||
visit := func(path string, info os.FileInfo, err error) error {
|
visit := func(path string, info os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -6,11 +6,11 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_impl(t *testing.T) {
|
func TestArtifact_impl(t *testing.T) {
|
||||||
var _ packer.Artifact = new(artifact)
|
var _ packersdk.Artifact = new(artifact)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewArtifact(t *testing.T) {
|
func TestNewArtifact(t *testing.T) {
|
||||||
|
|
|
@ -181,7 +181,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
// Create the driver that we'll use to communicate with Parallels
|
// Create the driver that we'll use to communicate with Parallels
|
||||||
driver, err := parallelscommon.NewDriver()
|
driver, err := parallelscommon.NewDriver()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -32,9 +32,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes a Packer build and returns a packer.Artifact representing
|
// Run executes a Packer build and returns a packersdk.Artifact representing
|
||||||
// a Parallels appliance.
|
// a Parallels appliance.
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
// Create the driver that we'll use to communicate with Parallels
|
// Create the driver that we'll use to communicate with Parallels
|
||||||
driver, err := parallelscommon.NewDriver()
|
driver, err := parallelscommon.NewDriver()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -3,13 +3,13 @@ package profitbricks
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_Impl(t *testing.T) {
|
func TestArtifact_Impl(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Artifact{}
|
raw = &Artifact{}
|
||||||
if _, ok := raw.(packer.Artifact); !ok {
|
if _, ok := raw.(packersdk.Artifact); !ok {
|
||||||
t.Fatalf("Artifact should be artifact")
|
t.Fatalf("Artifact should be artifact")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
state := new(multistep.BasicStateBag)
|
state := new(multistep.BasicStateBag)
|
||||||
|
|
||||||
state.Put("config", &b.config)
|
state.Put("config", &b.config)
|
||||||
|
|
|
@ -28,7 +28,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return b.config.Prepare(raws...)
|
return b.config.Prepare(raws...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
state := new(multistep.BasicStateBag)
|
state := new(multistep.BasicStateBag)
|
||||||
state.Put("clone-config", &b.config)
|
state.Put("clone-config", &b.config)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/Telmate/proxmox-api-go/proxmox"
|
"github.com/Telmate/proxmox-api-go/proxmox"
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Artifact struct {
|
type Artifact struct {
|
||||||
|
@ -19,8 +19,8 @@ type Artifact struct {
|
||||||
StateData map[string]interface{}
|
StateData map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Artifact implements packer.Artifact
|
// Artifact implements packersdk.Artifact
|
||||||
var _ packer.Artifact = &Artifact{}
|
var _ packersdk.Artifact = &Artifact{}
|
||||||
|
|
||||||
func (a *Artifact) BuilderId() string {
|
func (a *Artifact) BuilderId() string {
|
||||||
return a.builderID
|
return a.builderID
|
||||||
|
|
|
@ -34,7 +34,7 @@ type Builder struct {
|
||||||
vmCreator ProxmoxVMCreator
|
vmCreator ProxmoxVMCreator
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook, state multistep.StateBag) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook, state multistep.StateBag) (packersdk.Artifact, error) {
|
||||||
var err error
|
var err error
|
||||||
tlsConfig := &tls.Config{
|
tlsConfig := &tls.Config{
|
||||||
InsecureSkipVerify: b.config.SkipCertValidation,
|
InsecureSkipVerify: b.config.SkipCertValidation,
|
||||||
|
|
|
@ -30,7 +30,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
|
|
||||||
const downloadPathKey = "downloaded_iso_path"
|
const downloadPathKey = "downloaded_iso_path"
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
state := new(multistep.BasicStateBag)
|
state := new(multistep.BasicStateBag)
|
||||||
state.Put("iso-config", &b.config)
|
state.Put("iso-config", &b.config)
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
// Create the driver that we'll use to communicate with Qemu
|
// Create the driver that we'll use to communicate with Qemu
|
||||||
driver, err := b.newDriver(b.config.QemuBinary)
|
driver, err := b.newDriver(b.config.QemuBinary)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -3,13 +3,13 @@ package scaleway
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_Impl(t *testing.T) {
|
func TestArtifact_Impl(t *testing.T) {
|
||||||
var raw interface{}
|
var raw interface{}
|
||||||
raw = &Artifact{}
|
raw = &Artifact{}
|
||||||
if _, ok := raw.(packer.Artifact); !ok {
|
if _, ok := raw.(packersdk.Artifact); !ok {
|
||||||
t.Fatalf("Artifact should be artifact")
|
t.Fatalf("Artifact should be artifact")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
scwZone, err := scw.ParseZone(b.config.Zone)
|
scwZone, err := scw.ParseZone(b.config.Zone)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
|
|
|
@ -65,7 +65,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
cvmClient, vpcClient, err := b.config.Client()
|
cvmClient, vpcClient, err := b.config.Client()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -50,7 +50,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, errs.ErrorOrNil()
|
return nil, nil, errs.ErrorOrNil()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
config := b.config
|
config := b.config
|
||||||
|
|
||||||
driver, err := NewDriverTriton(ui, config)
|
driver, err := NewDriverTriton(ui, config)
|
||||||
|
|
|
@ -4,11 +4,11 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_Impl(t *testing.T) {
|
func TestArtifact_Impl(t *testing.T) {
|
||||||
var _ packer.Artifact = new(Artifact)
|
var _ packersdk.Artifact = new(Artifact)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestArtifactId(t *testing.T) {
|
func TestArtifactId(t *testing.T) {
|
||||||
|
|
|
@ -68,7 +68,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
|
|
||||||
client, err := b.config.Client()
|
client, err := b.config.Client()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -6,7 +6,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"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
builderT "github.com/hashicorp/packer/helper/builder/testing"
|
builderT "github.com/hashicorp/packer/helper/builder/testing"
|
||||||
|
@ -124,7 +124,7 @@ func testBuilderAccRegionCopy(projectId string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkRegionCopy(projectId string, imageDst []ucloudcommon.ImageDestination) builderT.TestCheckFunc {
|
func checkRegionCopy(projectId string, imageDst []ucloudcommon.ImageDestination) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
if len(artifacts) > 1 {
|
if len(artifacts) > 1 {
|
||||||
return fmt.Errorf("more than 1 artifact")
|
return fmt.Errorf("more than 1 artifact")
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This is the common builder ID to all of these artifacts.
|
// This is the common builder ID to all of these artifacts.
|
||||||
|
@ -23,7 +23,7 @@ type artifact struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewArtifact returns a vagrant artifact containing the .box file
|
// NewArtifact returns a vagrant artifact containing the .box file
|
||||||
func NewArtifact(provider, dir string, generatedData map[string]interface{}) packer.Artifact {
|
func NewArtifact(provider, dir string, generatedData map[string]interface{}) packersdk.Artifact {
|
||||||
return &artifact{
|
return &artifact{
|
||||||
OutputDir: dir,
|
OutputDir: dir,
|
||||||
BoxName: "package.box",
|
BoxName: "package.box",
|
||||||
|
|
|
@ -5,14 +5,14 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_Impl(t *testing.T) {
|
func TestArtifact_Impl(t *testing.T) {
|
||||||
var raw interface{} = &artifact{}
|
var raw interface{} = &artifact{}
|
||||||
|
|
||||||
if _, ok := raw.(packer.Artifact); !ok {
|
if _, ok := raw.(packersdk.Artifact); !ok {
|
||||||
t.Fatalf("Artifact does not implement packer.Artifact")
|
t.Fatalf("Artifact does not implement packersdk.Artifact")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -272,9 +272,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes a Packer build and returns a packer.Artifact representing
|
// Run executes a Packer build and returns a packersdk.Artifact representing
|
||||||
// a VirtualBox appliance.
|
// a VirtualBox appliance.
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
// Create the driver that we'll use to communicate with VirtualBox
|
// Create the driver that we'll use to communicate with VirtualBox
|
||||||
VagrantCWD, err := filepath.Abs(b.config.OutputDir)
|
VagrantCWD, err := filepath.Abs(b.config.OutputDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This is the common builder ID to all of these artifacts.
|
// This is the common builder ID to all of these artifacts.
|
||||||
|
@ -24,7 +24,7 @@ type artifact struct {
|
||||||
|
|
||||||
// NewArtifact returns a VirtualBox artifact containing the files
|
// NewArtifact returns a VirtualBox artifact containing the files
|
||||||
// in the given directory.
|
// in the given directory.
|
||||||
func NewArtifact(dir string, generatedData map[string]interface{}) (packer.Artifact, error) {
|
func NewArtifact(dir string, generatedData map[string]interface{}) (packersdk.Artifact, error) {
|
||||||
files := make([]string, 0, 5)
|
files := make([]string, 0, 5)
|
||||||
visit := func(path string, info os.FileInfo, err error) error {
|
visit := func(path string, info os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -6,11 +6,11 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_impl(t *testing.T) {
|
func TestArtifact_impl(t *testing.T) {
|
||||||
var _ packer.Artifact = new(artifact)
|
var _ packersdk.Artifact = new(artifact)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewArtifact(t *testing.T) {
|
func TestNewArtifact(t *testing.T) {
|
||||||
|
|
|
@ -231,7 +231,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
// Create the driver that we'll use to communicate with VirtualBox
|
// Create the driver that we'll use to communicate with VirtualBox
|
||||||
driver, err := vboxcommon.NewDriver()
|
driver, err := vboxcommon.NewDriver()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -32,9 +32,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes a Packer build and returns a packer.Artifact representing
|
// Run executes a Packer build and returns a packersdk.Artifact representing
|
||||||
// a VirtualBox appliance.
|
// a VirtualBox appliance.
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
// Create the driver that we'll use to communicate with VirtualBox
|
// Create the driver that we'll use to communicate with VirtualBox
|
||||||
driver, err := vboxcommon.NewDriver()
|
driver, err := vboxcommon.NewDriver()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -32,9 +32,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes a Packer build and returns a packer.Artifact representing
|
// Run executes a Packer build and returns a packersdk.Artifact representing
|
||||||
// a VirtualBox appliance.
|
// a VirtualBox appliance.
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
// Create the driver that we'll use to communicate with VirtualBox
|
// Create the driver that we'll use to communicate with VirtualBox
|
||||||
driver, err := vboxcommon.NewDriver()
|
driver, err := vboxcommon.NewDriver()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"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"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -62,7 +62,7 @@ func (a *artifact) Destroy() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewArtifact(remoteType string, format string, exportOutputPath string, vmName string, skipExport bool, keepRegistered bool, state multistep.StateBag) (packer.Artifact, error) {
|
func NewArtifact(remoteType string, format string, exportOutputPath string, vmName string, skipExport bool, keepRegistered bool, state multistep.StateBag) (packersdk.Artifact, error) {
|
||||||
var files []string
|
var files []string
|
||||||
var dir OutputDir
|
var dir OutputDir
|
||||||
var err error
|
var err error
|
||||||
|
|
|
@ -3,9 +3,9 @@ package common
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLocalArtifact_impl(t *testing.T) {
|
func TestLocalArtifact_impl(t *testing.T) {
|
||||||
var _ packer.Artifact = new(artifact)
|
var _ packersdk.Artifact = new(artifact)
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
driver, err := vmwcommon.NewDriver(&b.config.DriverConfig, &b.config.SSHConfig, b.config.VMName)
|
driver, err := vmwcommon.NewDriver(&b.config.DriverConfig, &b.config.SSHConfig, b.config.VMName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Failed creating VMware driver: %s", err)
|
return nil, fmt.Errorf("Failed creating VMware driver: %s", err)
|
||||||
|
|
|
@ -34,9 +34,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes a Packer build and returns a packer.Artifact representing
|
// Run executes a Packer build and returns a packersdk.Artifact representing
|
||||||
// a VMware image.
|
// a VMware image.
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
driver, err := vmwcommon.NewDriver(&b.config.DriverConfig, &b.config.SSHConfig, b.config.VMName)
|
driver, err := vmwcommon.NewDriver(&b.config.DriverConfig, &b.config.SSHConfig, b.config.VMName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Failed creating VMware driver: %s", err)
|
return nil, fmt.Errorf("Failed creating VMware driver: %s", err)
|
||||||
|
|
|
@ -30,7 +30,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
state := new(multistep.BasicStateBag)
|
state := new(multistep.BasicStateBag)
|
||||||
state.Put("debug", b.config.PackerDebug)
|
state.Put("debug", b.config.PackerDebug)
|
||||||
state.Put("hook", hook)
|
state.Put("hook", hook)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/hashicorp/packer/builder/vsphere/common"
|
"github.com/hashicorp/packer/builder/vsphere/common"
|
||||||
commonT "github.com/hashicorp/packer/builder/vsphere/common/testing"
|
commonT "github.com/hashicorp/packer/builder/vsphere/common/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"
|
||||||
"github.com/vmware/govmomi/vim25/types"
|
"github.com/vmware/govmomi/vim25/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ func defaultConfig() map[string]interface{} {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkDefault(t *testing.T, name string, host string, datastore string) builderT.TestCheckFunc {
|
func checkDefault(t *testing.T, name string, host string, datastore string) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ func TestCloneBuilderAcc_artifact(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkArtifact(t *testing.T) builderT.TestCheckFunc {
|
func checkArtifact(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
if len(artifacts) > 1 {
|
if len(artifacts) > 1 {
|
||||||
t.Fatal("more than 1 artifact")
|
t.Fatal("more than 1 artifact")
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ func folderConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkFolder(t *testing.T, folder string) builderT.TestCheckFunc {
|
func checkFolder(t *testing.T, folder string) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ func resourcePoolConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc {
|
func checkResourcePool(t *testing.T, pool string) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ func datastoreConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkDatastore(t *testing.T, name string) builderT.TestCheckFunc {
|
func checkDatastore(t *testing.T, name string) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ func fullCloneConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkFullClone(t *testing.T) builderT.TestCheckFunc {
|
func checkFullClone(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ func linkedCloneConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkLinkedClone(t *testing.T) builderT.TestCheckFunc {
|
func checkLinkedClone(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ func networkConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkNetwork(t *testing.T, name string) builderT.TestCheckFunc {
|
func checkNetwork(t *testing.T, name string) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ func hardwareConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkHardware(t *testing.T) builderT.TestCheckFunc {
|
func checkHardware(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
|
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
@ -483,7 +483,7 @@ func RAMReservationConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkRAMReservation(t *testing.T) builderT.TestCheckFunc {
|
func checkRAMReservation(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
|
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
@ -518,7 +518,7 @@ func sshPasswordConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkDefaultBootOrder(t *testing.T) builderT.TestCheckFunc {
|
func checkDefaultBootOrder(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ func snapshotConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkSnapshot(t *testing.T) builderT.TestCheckFunc {
|
func checkSnapshot(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
|
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
@ -603,7 +603,7 @@ func templateConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkTemplate(t *testing.T) builderT.TestCheckFunc {
|
func checkTemplate(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
|
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
@ -641,7 +641,7 @@ func bootOrderConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkBootOrder(t *testing.T) builderT.TestCheckFunc {
|
func checkBootOrder(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
@ -676,7 +676,7 @@ func notesConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkNotes(t *testing.T) builderT.TestCheckFunc {
|
func checkNotes(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/vsphere/common"
|
"github.com/hashicorp/packer/builder/vsphere/common"
|
||||||
"github.com/hashicorp/packer/builder/vsphere/driver"
|
"github.com/hashicorp/packer/builder/vsphere/driver"
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewVMName() string {
|
func NewVMName() string {
|
||||||
|
@ -56,7 +56,7 @@ func TestConn(t *testing.T) driver.Driver {
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetVM(t *testing.T, d driver.Driver, artifacts []packer.Artifact) driver.VirtualMachine {
|
func GetVM(t *testing.T, d driver.Driver, artifacts []packersdk.Artifact) driver.VirtualMachine {
|
||||||
artifactRaw := artifacts[0]
|
artifactRaw := artifacts[0]
|
||||||
artifact, _ := artifactRaw.(*common.Artifact)
|
artifact, _ := artifactRaw.(*common.Artifact)
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return nil, warnings, nil
|
return nil, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
state := new(multistep.BasicStateBag)
|
state := new(multistep.BasicStateBag)
|
||||||
state.Put("debug", b.config.PackerDebug)
|
state.Put("debug", b.config.PackerDebug)
|
||||||
state.Put("hook", hook)
|
state.Put("hook", hook)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
|
|
||||||
commonT "github.com/hashicorp/packer/builder/vsphere/common/testing"
|
commonT "github.com/hashicorp/packer/builder/vsphere/common/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"
|
||||||
"github.com/vmware/govmomi/vim25/types"
|
"github.com/vmware/govmomi/vim25/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ func defaultConfig() map[string]interface{} {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkDefault(t *testing.T, name string, host string, datastore string) builderT.TestCheckFunc {
|
func checkDefault(t *testing.T, name string, host string, datastore string) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ func notesConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkNotes(t *testing.T) builderT.TestCheckFunc {
|
func checkNotes(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ func hardwareConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkHardware(t *testing.T) builderT.TestCheckFunc {
|
func checkHardware(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
|
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
@ -261,7 +261,7 @@ func limitConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkLimit(t *testing.T) builderT.TestCheckFunc {
|
func checkLimit(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
|
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
@ -295,7 +295,7 @@ func sataConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkSata(t *testing.T) builderT.TestCheckFunc {
|
func checkSata(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
|
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
@ -347,7 +347,7 @@ func networkCardConfig() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkNetworkCard(t *testing.T) builderT.TestCheckFunc {
|
func checkNetworkCard(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
|
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
@ -473,7 +473,7 @@ func fullConfig() map[string]interface{} {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkFull(t *testing.T) builderT.TestCheckFunc {
|
func checkFull(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
@ -515,7 +515,7 @@ func TestISOBuilderAcc_bootOrder(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkBootOrder(t *testing.T) builderT.TestCheckFunc {
|
func checkBootOrder(t *testing.T) builderT.TestCheckFunc {
|
||||||
return func(artifacts []packer.Artifact) error {
|
return func(artifacts []packersdk.Artifact) error {
|
||||||
d := commonT.TestConn(t)
|
d := commonT.TestConn(t)
|
||||||
vm := commonT.GetVM(t, d, artifacts)
|
vm := commonT.GetVM(t, d, artifacts)
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,13 @@ package yandex
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/packer"
|
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||||
|
|
||||||
"github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1"
|
"github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestArtifact_impl(t *testing.T) {
|
func TestArtifact_impl(t *testing.T) {
|
||||||
var _ packer.Artifact = new(Artifact)
|
var _ packersdk.Artifact = new(Artifact)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestArtifact_Id(t *testing.T) {
|
func TestArtifact_Id(t *testing.T) {
|
||||||
|
|
|
@ -48,9 +48,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return generatedData, warnings, nil
|
return generatedData, warnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes a yandex Packer build and returns a packer.Artifact
|
// Run executes a yandex Packer build and returns a packersdk.Artifact
|
||||||
// representing a Yandex.Cloud compute image.
|
// representing a Yandex.Cloud compute image.
|
||||||
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
driver, err := NewDriverYC(ui, &b.config.AccessConfig)
|
driver, err := NewDriverYC(ui, &b.config.AccessConfig)
|
||||||
ctx = requestid.ContextWithClientTraceID(ctx, uuid.New().String())
|
ctx = requestid.ContextWithClientTraceID(ctx, uuid.New().String())
|
||||||
|
|
||||||
|
|
|
@ -215,8 +215,8 @@ func (c *BuildCommand) RunContext(buildCtx context.Context, cla *BuildArgs) int
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
var artifacts = struct {
|
var artifacts = struct {
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
m map[string][]packer.Artifact
|
m map[string][]packersdk.Artifact
|
||||||
}{m: make(map[string][]packer.Artifact)}
|
}{m: make(map[string][]packersdk.Artifact)}
|
||||||
// Get the builds we care about
|
// Get the builds we care about
|
||||||
var errors = struct {
|
var errors = struct {
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
|
|
|
@ -37,7 +37,7 @@ func (b *ParallelTestBuilder) Prepare(raws ...interface{}) ([]string, []string,
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *ParallelTestBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *ParallelTestBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
ui.Say("building")
|
ui.Say("building")
|
||||||
b.wg.Done()
|
b.wg.Done()
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
@ -52,7 +52,7 @@ func (b *LockedBuilder) Prepare(raws ...interface{}) ([]string, []string, error)
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *LockedBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *LockedBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
ui.Say("locking build")
|
ui.Say("locking build")
|
||||||
select {
|
select {
|
||||||
case <-b.unlock:
|
case <-b.unlock:
|
||||||
|
|
|
@ -78,7 +78,7 @@ func (b *MockBuilder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
return []string{"ID"}, nil, b.Config.Prepare(raws...)
|
return []string{"ID"}, nil, b.Config.Prepare(raws...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *MockBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packer.Artifact, error) {
|
func (b *MockBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ func (b *MockPostProcessor) Configure(raws ...interface{}) error {
|
||||||
return b.Config.Prepare(raws...)
|
return b.Config.Prepare(raws...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *MockPostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, a packer.Artifact) (packer.Artifact, bool, bool, error) {
|
func (b *MockPostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, a packersdk.Artifact) (packersdk.Artifact, bool, bool, error) {
|
||||||
return nil, false, false, nil
|
return nil, false, false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ func (p *HCL2PostProcessor) Configure(args ...interface{}) error {
|
||||||
return p.PostProcessor.Configure(args...)
|
return p.PostProcessor.Configure(args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *HCL2PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) {
|
func (p *HCL2PostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, artifact packersdk.Artifact) (packersdk.Artifact, bool, bool, error) {
|
||||||
generatedData := make(map[string]interface{})
|
generatedData := make(map[string]interface{})
|
||||||
if artifactStateData, ok := artifact.State("generated_data").(map[interface{}]interface{}); ok {
|
if artifactStateData, ok := artifact.State("generated_data").(map[interface{}]interface{}); ok {
|
||||||
for k, v := range artifactStateData {
|
for k, v := range artifactStateData {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"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"
|
"github.com/hashicorp/packer/packer-plugin-sdk/template"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ type TestCase struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestCheckFunc is the callback used for Check in TestStep.
|
// TestCheckFunc is the callback used for Check in TestStep.
|
||||||
type TestCheckFunc func([]packer.Artifact) error
|
type TestCheckFunc func([]packersdk.Artifact) error
|
||||||
|
|
||||||
// TestTeardownFunc is the callback used for Teardown in TestCase.
|
// TestTeardownFunc is the callback used for Teardown in TestCase.
|
||||||
type TestTeardownFunc func() error
|
type TestTeardownFunc func() error
|
||||||
|
|
|
@ -64,7 +64,7 @@ type Build interface {
|
||||||
// Run runs the actual builder, returning an artifact implementation
|
// Run runs the actual builder, returning an artifact implementation
|
||||||
// of what is built. If anything goes wrong, an error is returned.
|
// of what is built. If anything goes wrong, an error is returned.
|
||||||
// Run can be context cancelled.
|
// Run can be context cancelled.
|
||||||
Run(context.Context, packersdk.Ui) ([]Artifact, error)
|
Run(context.Context, packersdk.Ui) ([]packersdk.Artifact, error)
|
||||||
|
|
||||||
// SetDebug will enable/disable debug mode. Debug mode is always
|
// SetDebug will enable/disable debug mode. Debug mode is always
|
||||||
// enabled by adding the additional key "packer_debug" to boolean
|
// enabled by adding the additional key "packer_debug" to boolean
|
||||||
|
@ -232,7 +232,7 @@ func (b *CoreBuild) Prepare() (warn []string, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runs the actual build. Prepare must be called prior to running this.
|
// Runs the actual build. Prepare must be called prior to running this.
|
||||||
func (b *CoreBuild) Run(ctx context.Context, originalUi packersdk.Ui) ([]Artifact, error) {
|
func (b *CoreBuild) Run(ctx context.Context, originalUi packersdk.Ui) ([]packersdk.Artifact, error) {
|
||||||
if !b.prepareCalled {
|
if !b.prepareCalled {
|
||||||
panic("Prepare must be called first")
|
panic("Prepare must be called first")
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ func (b *CoreBuild) Run(ctx context.Context, originalUi packersdk.Ui) ([]Artifac
|
||||||
}
|
}
|
||||||
|
|
||||||
hook := &DispatchHook{Mapping: hooks}
|
hook := &DispatchHook{Mapping: hooks}
|
||||||
artifacts := make([]Artifact, 0, 1)
|
artifacts := make([]packersdk.Artifact, 0, 1)
|
||||||
|
|
||||||
// The builder just has a normal Ui, but targeted
|
// The builder just has a normal Ui, but targeted
|
||||||
builderUi := &TargetedUI{
|
builderUi := &TargetedUI{
|
||||||
|
|
|
@ -37,5 +37,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, Hook) (Artifact, error)
|
Run(context.Context, packersdk.Ui, Hook) (packersdk.Artifact, error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ func (tb *MockBuilder) Prepare(config ...interface{}) ([]string, []string, error
|
||||||
return tb.GeneratedVars, tb.PrepareWarnings, nil
|
return tb.GeneratedVars, tb.PrepareWarnings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tb *MockBuilder) Run(ctx context.Context, ui packersdk.Ui, h Hook) (Artifact, error) {
|
func (tb *MockBuilder) Run(ctx context.Context, ui packersdk.Ui, h Hook) (packersdk.Artifact, error) {
|
||||||
tb.RunCalled = true
|
tb.RunCalled = true
|
||||||
tb.RunHook = h
|
tb.RunHook = h
|
||||||
tb.RunUi = ui
|
tb.RunUi = ui
|
||||||
|
@ -62,7 +62,7 @@ func (tb *MockBuilder) Run(ctx context.Context, ui packersdk.Ui, h Hook) (Artifa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &MockArtifact{
|
return &packersdk.MockArtifact{
|
||||||
IdValue: tb.ArtifactId,
|
IdValue: tb.ArtifactId,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,16 +112,16 @@ func (*FlatMockCommunicator) HCL2Spec() map[string]hcldec.Spec {
|
||||||
// FlatMockPostProcessor is an auto-generated flat version of MockPostProcessor.
|
// FlatMockPostProcessor is an auto-generated flat version of MockPostProcessor.
|
||||||
// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
|
// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
|
||||||
type FlatMockPostProcessor struct {
|
type FlatMockPostProcessor struct {
|
||||||
ArtifactId *string `cty:"artifact_id" hcl:"artifact_id"`
|
ArtifactId *string `cty:"artifact_id" hcl:"artifact_id"`
|
||||||
Keep *bool `cty:"keep" hcl:"keep"`
|
Keep *bool `cty:"keep" hcl:"keep"`
|
||||||
ForceOverride *bool `cty:"force_override" hcl:"force_override"`
|
ForceOverride *bool `cty:"force_override" hcl:"force_override"`
|
||||||
Error error `cty:"error" hcl:"error"`
|
Error error `cty:"error" hcl:"error"`
|
||||||
ConfigureCalled *bool `cty:"configure_called" hcl:"configure_called"`
|
ConfigureCalled *bool `cty:"configure_called" hcl:"configure_called"`
|
||||||
ConfigureConfigs []interface{} `cty:"configure_configs" hcl:"configure_configs"`
|
ConfigureConfigs []interface{} `cty:"configure_configs" hcl:"configure_configs"`
|
||||||
ConfigureError error `cty:"configure_error" hcl:"configure_error"`
|
ConfigureError error `cty:"configure_error" hcl:"configure_error"`
|
||||||
PostProcessCalled *bool `cty:"post_process_called" hcl:"post_process_called"`
|
PostProcessCalled *bool `cty:"post_process_called" hcl:"post_process_called"`
|
||||||
PostProcessArtifact Artifact `cty:"post_process_artifact" hcl:"post_process_artifact"`
|
PostProcessArtifact packersdk.Artifact `cty:"post_process_artifact" hcl:"post_process_artifact"`
|
||||||
PostProcessUi packersdk.Ui `cty:"post_process_ui" hcl:"post_process_ui"`
|
PostProcessUi packersdk.Ui `cty:"post_process_ui" hcl:"post_process_ui"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlatMapstructure returns a new FlatMockPostProcessor.
|
// FlatMapstructure returns a new FlatMockPostProcessor.
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue