move Artifact and artifact mock to the sdk

This commit is contained in:
Megan Marsh 2020-11-19 12:17:11 -08:00
parent c70870cb83
commit 14bdb9516c
161 changed files with 287 additions and 311 deletions

View File

@ -4,11 +4,11 @@ import (
"reflect"
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifact_Impl(t *testing.T) {
var _ packer.Artifact = new(Artifact)
var _ packersdk.Artifact = new(Artifact)
}
func TestArtifactId(t *testing.T) {

View File

@ -81,7 +81,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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()
if err != nil {

View File

@ -9,7 +9,7 @@ import (
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
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"
@ -104,7 +104,7 @@ const testBuilderAccWithDiskSettings = `
}`
func checkImageDisksSettings() builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
if len(artifacts) > 1 {
return fmt.Errorf("more than 1 artifact")
}
@ -215,7 +215,7 @@ const testBuilderAccIgnoreDataDisks = `
}`
func checkIgnoreDataDisks() builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
if len(artifacts) > 1 {
return fmt.Errorf("more than 1 artifact")
}
@ -308,7 +308,7 @@ const testBuilderAccRegionCopy = `
`
func checkRegionCopy(regions []string) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
if len(artifacts) > 1 {
return fmt.Errorf("more than 1 artifact")
}
@ -438,7 +438,7 @@ const testBuilderAccSharing = `
`
func checkECSImageSharing(uid string) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
if len(artifacts) > 1 {
return fmt.Errorf("more than 1 artifact")
}
@ -534,7 +534,7 @@ const testBuilderAccForceDeleteSnapshot = `
`
func checkSnapshotsDeleted(snapshotIds []string) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
// Verify the snapshots are gone
client, _ := testAliyunClient()
data, err := json.Marshal(snapshotIds)
@ -587,7 +587,7 @@ const testBuilderAccImageTags = `
}`
func checkImageTags() builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
if len(artifacts) > 1 {
return fmt.Errorf("more than 1 artifact")
}
@ -716,7 +716,7 @@ const testBuilderAccDataDiskEncrypted = `
}`
func checkDataDiskEncrypted() builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
if len(artifacts) > 1 {
return fmt.Errorf("more than 1 artifact")
}
@ -815,7 +815,7 @@ const testBuilderAccSystemDiskEncrypted = `
}`
func checkSystemDiskEncrypted() builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
if len(artifacts) > 1 {
return fmt.Errorf("more than 1 artifact")
}

View File

@ -346,7 +346,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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" {
return nil, errors.New("The amazon-chroot builder only works on Linux environments.")
}

View File

@ -4,11 +4,11 @@ import (
"reflect"
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifact_Impl(t *testing.T) {
var _ packer.Artifact = new(Artifact)
var _ packersdk.Artifact = new(Artifact)
}
func TestArtifactId(t *testing.T) {

View File

@ -151,7 +151,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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()
if err != nil {

View File

@ -13,7 +13,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/hashicorp/packer/builder/amazon/common"
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) {
@ -89,7 +89,7 @@ func TestBuilderAcc_forceDeleteSnapshot(t *testing.T) {
}
func checkSnapshotsDeleted(snapshotIds []*string) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
// Verify the snapshots are gone
ec2conn, _ := testEC2Conn()
snapshotResp, _ := ec2conn.DescribeSnapshots(
@ -122,7 +122,7 @@ func TestBuilderAcc_encryptedBoot(t *testing.T) {
}
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 {
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 {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
if len(artifacts) > 1 {
return fmt.Errorf("more than 1 artifact")
}
@ -211,7 +211,7 @@ func checkRegionCopy(regions []string) 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
artifactRaw := artifacts[0]

View File

@ -9,7 +9,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/hashicorp/packer/builder/amazon/common"
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 {
@ -37,7 +37,7 @@ func TestBuilderTagsAcc_basic(t *testing.T) {
}
func checkTags() builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
if len(artifacts) > 1 {
return fmt.Errorf("more than 1 artifact")
}

View File

@ -174,7 +174,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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()
if err != nil {
return nil, err

View File

@ -165,7 +165,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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()
if err != nil {
return nil, err

View File

@ -234,7 +234,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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()
if err != nil {
return nil, err

View File

@ -52,7 +52,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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 ...")

View File

@ -393,7 +393,7 @@ func checkHyperVGeneration(s string) interface{} {
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 {
case "linux", "freebsd":
break

View File

@ -52,7 +52,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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 ...")

View File

@ -3,7 +3,7 @@ package cloudstack
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/xanzy/go-cloudstack/cloudstack"
)
@ -12,8 +12,8 @@ const templateID = "286dd44a-ec6b-4789-b192-804f08f04b4c"
func TestArtifact_Impl(t *testing.T) {
var raw interface{} = &Artifact{}
if _, ok := raw.(packer.Artifact); !ok {
t.Fatalf("Artifact does not implement packer.Artifact")
if _, ok := raw.(packersdk.Artifact); !ok {
t.Fatalf("Artifact does not implement packersdk.Artifact")
}
}

View File

@ -34,7 +34,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
}
// 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
// Create a CloudStack API client.

View File

@ -3,7 +3,7 @@ package digitalocean
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func generatedData() map[string]interface{} {
@ -13,7 +13,7 @@ func generatedData() map[string]interface{} {
func TestArtifact_Impl(t *testing.T) {
var raw interface{}
raw = &Artifact{}
if _, ok := raw.(packer.Artifact); !ok {
if _, ok := raw.(packersdk.Artifact); !ok {
t.Fatalf("Artifact should be artifact")
}
}

View File

@ -38,7 +38,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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{
AccessToken: b.config.APIToken,
}))

View File

@ -3,9 +3,9 @@ package docker
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestExportArtifact_impl(t *testing.T) {
var _ packer.Artifact = new(ExportArtifact)
var _ packersdk.Artifact = new(ExportArtifact)
}

View File

@ -4,11 +4,11 @@ import (
"errors"
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestImportArtifact_impl(t *testing.T) {
var _ packer.Artifact = new(ImportArtifact)
var _ packersdk.Artifact = new(ImportArtifact)
}
func TestImportArtifactBuilderId(t *testing.T) {

View File

@ -36,7 +36,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
}, 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}
if err := driver.Verify(); err != nil {
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
var artifact packer.Artifact
var artifact packersdk.Artifact
if b.config.Commit {
artifact = &ImportArtifact{
IdValue: state.Get("image_id").(string),

View File

@ -3,9 +3,9 @@ package file
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestNullArtifact(t *testing.T) {
var _ packer.Artifact = new(FileArtifact)
var _ packersdk.Artifact = new(FileArtifact)
}

View File

@ -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.
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)
// Create all directories leading to target

View File

@ -7,6 +7,7 @@ import (
builderT "github.com/hashicorp/packer/helper/builder/testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestBuilder_implBuilder(t *testing.T) {
@ -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")
if err != nil {
return err
@ -41,7 +42,7 @@ func checkContent(artifacts []packer.Artifact) error {
return nil
}
func checkCopy(artifacts []packer.Artifact) error {
func checkCopy(artifacts []packersdk.Artifact) error {
content, err := ioutil.ReadFile("copyTest.txt")
if err != nil {
return err

View File

@ -3,11 +3,11 @@ package googlecompute
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifact_impl(t *testing.T) {
var _ packer.Artifact = new(Artifact)
var _ packersdk.Artifact = new(Artifact)
}
func TestArtifactState_StateData(t *testing.T) {

View File

@ -34,9 +34,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.
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{
Ui: ui,
ProjectId: b.config.ProjectId,

View File

@ -3,11 +3,11 @@ package hcloud
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifact_Impl(t *testing.T) {
var _ packer.Artifact = (*Artifact)(nil)
var _ packersdk.Artifact = (*Artifact)(nil)
}
func TestArtifactId(t *testing.T) {

View File

@ -35,7 +35,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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{
hcloud.WithToken(b.config.HCloudToken),
hcloud.WithEndpoint(b.config.Endpoint),

View File

@ -52,7 +52,7 @@ type wrappedCommandTemplate struct {
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) {
ictx := b.config.ctx
ictx.Data = &wrappedCommandTemplate{Command: command}

View File

@ -5,7 +5,7 @@ import (
"os"
"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.
@ -24,7 +24,7 @@ type artifact struct {
// NewArtifact returns a hyperv artifact containing the files
// 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)
visit := func(path string, info os.FileInfo, err error) error {
if err != nil {

View File

@ -6,11 +6,11 @@ import (
"path/filepath"
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifact_impl(t *testing.T) {
var _ packer.Artifact = new(artifact)
var _ packersdk.Artifact = new(artifact)
}
func TestNewArtifact(t *testing.T) {

View File

@ -175,9 +175,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.
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
driver, err := hypervcommon.NewHypervPS4Driver()
if err != nil {

View File

@ -215,9 +215,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.
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
driver, err := hypervcommon.NewHypervPS4Driver()
if err != nil {

View File

@ -43,7 +43,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.Put("hook", hook)

View File

@ -3,13 +3,13 @@ package linode
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifact_Impl(t *testing.T) {
var raw interface{}
raw = &Artifact{}
if _, ok := raw.(packer.Artifact); !ok {
if _, ok := raw.(packersdk.Artifact); !ok {
t.Fatalf("Artifact should be artifact")
}
}

View File

@ -37,7 +37,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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 ...")
client := newLinodeClient(b.config.PersonalAccessToken)

View File

@ -36,7 +36,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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) {
b.config.ctx.Data = &wrappedCommandTemplate{Command: command}
return interpolate.Render(b.config.CommandWrapper, &b.config.ctx)

View File

@ -34,7 +34,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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) {
b.config.ctx.Data = &wrappedCommandTemplate{Command: command}
return interpolate.Render(b.config.CommandWrapper, &b.config.ctx)

View File

@ -32,7 +32,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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 ...")
config := Config{
AccessKey: b.config.AccessKey,

View File

@ -3,9 +3,9 @@ package null
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestNullArtifact(t *testing.T) {
var _ packer.Artifact = new(NullArtifact)
var _ packersdk.Artifact = new(NullArtifact)
}

View File

@ -29,7 +29,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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 = append(steps,

View File

@ -31,7 +31,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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)

View File

@ -3,11 +3,11 @@ package openstack
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifact_Impl(t *testing.T) {
var _ packer.Artifact = new(Artifact)
var _ packersdk.Artifact = new(Artifact)
}
func TestArtifactId(t *testing.T) {

View File

@ -73,7 +73,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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 {
b.config.enableDebug(ui)
}

View File

@ -46,7 +46,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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") != ""
httpClient := cleanhttp.DefaultClient()
config := &opc.Config{

View File

@ -3,13 +3,13 @@ package oci
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifactImpl(t *testing.T) {
var raw interface{}
raw = &Artifact{}
if _, ok := raw.(packer.Artifact); !ok {
if _, ok := raw.(packersdk.Artifact); !ok {
t.Fatalf("Artifact should be artifact")
}
}

View File

@ -39,7 +39,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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)
if err != nil {
return nil, err

View File

@ -85,7 +85,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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()
// Setup the state bag and initial state for the steps

View File

@ -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()
// Setup the state bag and initial state for the steps

View File

@ -88,7 +88,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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()
// if err != nil {
// return nil, err

View File

@ -188,7 +188,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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" {
return nil, errors.New("The outscale-chroot builder only works on Linux environments.")
}

View File

@ -6,7 +6,7 @@ import (
"path/filepath"
"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.
@ -29,7 +29,7 @@ type artifact struct {
// NewArtifact returns a Parallels artifact containing the files
// 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)
visit := func(path string, info os.FileInfo, err error) error {
if err != nil {

View File

@ -6,11 +6,11 @@ import (
"path/filepath"
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifact_impl(t *testing.T) {
var _ packer.Artifact = new(artifact)
var _ packersdk.Artifact = new(artifact)
}
func TestNewArtifact(t *testing.T) {

View File

@ -181,7 +181,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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
driver, err := parallelscommon.NewDriver()
if err != nil {

View File

@ -32,9 +32,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.
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
driver, err := parallelscommon.NewDriver()
if err != nil {

View File

@ -3,13 +3,13 @@ package profitbricks
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifact_Impl(t *testing.T) {
var raw interface{}
raw = &Artifact{}
if _, ok := raw.(packer.Artifact); !ok {
if _, ok := raw.(packersdk.Artifact); !ok {
t.Fatalf("Artifact should be artifact")
}
}

View File

@ -30,7 +30,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.Put("config", &b.config)

View File

@ -28,7 +28,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.Put("clone-config", &b.config)

View File

@ -6,7 +6,7 @@ import (
"strconv"
"github.com/Telmate/proxmox-api-go/proxmox"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
type Artifact struct {
@ -19,8 +19,8 @@ type Artifact struct {
StateData map[string]interface{}
}
// Artifact implements packer.Artifact
var _ packer.Artifact = &Artifact{}
// Artifact implements packersdk.Artifact
var _ packersdk.Artifact = &Artifact{}
func (a *Artifact) BuilderId() string {
return a.builderID

View File

@ -34,7 +34,7 @@ type Builder struct {
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
tlsConfig := &tls.Config{
InsecureSkipVerify: b.config.SkipCertValidation,

View File

@ -30,7 +30,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.Put("iso-config", &b.config)

View File

@ -35,7 +35,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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
driver, err := b.newDriver(b.config.QemuBinary)
if err != nil {

View File

@ -3,13 +3,13 @@ package scaleway
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifact_Impl(t *testing.T) {
var raw interface{}
raw = &Artifact{}
if _, ok := raw.(packer.Artifact); !ok {
if _, ok := raw.(packersdk.Artifact); !ok {
t.Fatalf("Artifact should be artifact")
}
}

View File

@ -36,7 +36,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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)
if err != nil {
ui.Error(err.Error())

View File

@ -65,7 +65,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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()
if err != nil {
return nil, err

View File

@ -50,7 +50,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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
driver, err := NewDriverTriton(ui, config)

View File

@ -4,11 +4,11 @@ import (
"reflect"
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifact_Impl(t *testing.T) {
var _ packer.Artifact = new(Artifact)
var _ packersdk.Artifact = new(Artifact)
}
func TestArtifactId(t *testing.T) {

View File

@ -68,7 +68,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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()
if err != nil {

View File

@ -6,7 +6,7 @@ import (
"testing"
ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/stretchr/testify/assert"
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 {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
if len(artifacts) > 1 {
return fmt.Errorf("more than 1 artifact")
}

View File

@ -4,7 +4,7 @@ import (
"fmt"
"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.
@ -23,7 +23,7 @@ type artifact struct {
}
// 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{
OutputDir: dir,
BoxName: "package.box",

View File

@ -5,14 +5,14 @@ import (
"strings"
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifact_Impl(t *testing.T) {
var raw interface{} = &artifact{}
if _, ok := raw.(packer.Artifact); !ok {
t.Fatalf("Artifact does not implement packer.Artifact")
if _, ok := raw.(packersdk.Artifact); !ok {
t.Fatalf("Artifact does not implement packersdk.Artifact")
}
}

View File

@ -272,9 +272,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.
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
VagrantCWD, err := filepath.Abs(b.config.OutputDir)
if err != nil {

View File

@ -5,7 +5,7 @@ import (
"os"
"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.
@ -24,7 +24,7 @@ type artifact struct {
// NewArtifact returns a VirtualBox artifact containing the files
// 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)
visit := func(path string, info os.FileInfo, err error) error {
if err != nil {

View File

@ -6,11 +6,11 @@ import (
"path/filepath"
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestArtifact_impl(t *testing.T) {
var _ packer.Artifact = new(artifact)
var _ packersdk.Artifact = new(artifact)
}
func TestNewArtifact(t *testing.T) {

View File

@ -231,7 +231,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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
driver, err := vboxcommon.NewDriver()
if err != nil {

View File

@ -32,9 +32,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.
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
driver, err := vboxcommon.NewDriver()
if err != nil {

View File

@ -32,9 +32,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.
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
driver, err := vboxcommon.NewDriver()
if err != nil {

View File

@ -4,8 +4,8 @@ import (
"fmt"
"strconv"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
const (
@ -62,7 +62,7 @@ func (a *artifact) Destroy() error {
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 dir OutputDir
var err error

View File

@ -3,9 +3,9 @@ package common
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestLocalArtifact_impl(t *testing.T) {
var _ packer.Artifact = new(artifact)
var _ packersdk.Artifact = new(artifact)
}

View File

@ -31,7 +31,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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)
if err != nil {
return nil, fmt.Errorf("Failed creating VMware driver: %s", err)

View File

@ -34,9 +34,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.
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)
if err != nil {
return nil, fmt.Errorf("Failed creating VMware driver: %s", err)

View File

@ -30,7 +30,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.Put("debug", b.config.PackerDebug)
state.Put("hook", hook)

View File

@ -7,7 +7,7 @@ import (
"github.com/hashicorp/packer/builder/vsphere/common"
commonT "github.com/hashicorp/packer/builder/vsphere/common/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"
)
@ -48,7 +48,7 @@ func defaultConfig() map[string]interface{} {
}
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)
vm := commonT.GetVM(t, d, artifacts)
@ -113,7 +113,7 @@ func TestCloneBuilderAcc_artifact(t *testing.T) {
}
func checkArtifact(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
if len(artifacts) > 1 {
t.Fatal("more than 1 artifact")
}
@ -144,7 +144,7 @@ func folderConfig() string {
}
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)
vm := commonT.GetVM(t, d, artifacts)
@ -182,7 +182,7 @@ func resourcePoolConfig() string {
}
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)
vm := commonT.GetVM(t, d, artifacts)
@ -221,7 +221,7 @@ func datastoreConfig() string {
}
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)
vm := commonT.GetVM(t, d, artifacts)
@ -280,7 +280,7 @@ func fullCloneConfig() string {
}
func checkFullClone(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -313,7 +313,7 @@ func linkedCloneConfig() string {
}
func checkLinkedClone(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -349,7 +349,7 @@ func networkConfig() string {
}
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)
vm := commonT.GetVM(t, d, artifacts)
@ -401,7 +401,7 @@ func hardwareConfig() string {
}
func checkHardware(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -483,7 +483,7 @@ func RAMReservationConfig() string {
}
func checkRAMReservation(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -518,7 +518,7 @@ func sshPasswordConfig() string {
}
func checkDefaultBootOrder(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -569,7 +569,7 @@ func snapshotConfig() string {
}
func checkSnapshot(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -603,7 +603,7 @@ func templateConfig() string {
}
func checkTemplate(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -641,7 +641,7 @@ func bootOrderConfig() string {
}
func checkBootOrder(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -676,7 +676,7 @@ func notesConfig() string {
}
func checkNotes(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)

View File

@ -10,7 +10,7 @@ import (
"github.com/hashicorp/packer/builder/vsphere/common"
"github.com/hashicorp/packer/builder/vsphere/driver"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func NewVMName() string {
@ -56,7 +56,7 @@ func TestConn(t *testing.T) driver.Driver {
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]
artifact, _ := artifactRaw.(*common.Artifact)

View File

@ -29,7 +29,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.Put("debug", b.config.PackerDebug)
state.Put("hook", hook)

View File

@ -8,7 +8,7 @@ import (
commonT "github.com/hashicorp/packer/builder/vsphere/common/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"
)
@ -54,7 +54,7 @@ func defaultConfig() map[string]interface{} {
}
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)
vm := commonT.GetVM(t, d, artifacts)
@ -129,7 +129,7 @@ func notesConfig() string {
}
func checkNotes(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -171,7 +171,7 @@ func hardwareConfig() string {
}
func checkHardware(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -261,7 +261,7 @@ func limitConfig() string {
}
func checkLimit(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -295,7 +295,7 @@ func sataConfig() string {
}
func checkSata(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -347,7 +347,7 @@ func networkCardConfig() string {
}
func checkNetworkCard(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -473,7 +473,7 @@ func fullConfig() map[string]interface{} {
}
func checkFull(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)
@ -515,7 +515,7 @@ func TestISOBuilderAcc_bootOrder(t *testing.T) {
}
func checkBootOrder(t *testing.T) builderT.TestCheckFunc {
return func(artifacts []packer.Artifact) error {
return func(artifacts []packersdk.Artifact) error {
d := commonT.TestConn(t)
vm := commonT.GetVM(t, d, artifacts)

View File

@ -3,13 +3,13 @@ package yandex
import (
"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"
)
func TestArtifact_impl(t *testing.T) {
var _ packer.Artifact = new(Artifact)
var _ packersdk.Artifact = new(Artifact)
}
func TestArtifact_Id(t *testing.T) {

View File

@ -48,9 +48,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
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.
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)
ctx = requestid.ContextWithClientTraceID(ctx, uuid.New().String())

View File

@ -215,8 +215,8 @@ func (c *BuildCommand) RunContext(buildCtx context.Context, cla *BuildArgs) int
var wg sync.WaitGroup
var artifacts = struct {
sync.RWMutex
m map[string][]packer.Artifact
}{m: make(map[string][]packer.Artifact)}
m map[string][]packersdk.Artifact
}{m: make(map[string][]packersdk.Artifact)}
// Get the builds we care about
var errors = struct {
sync.RWMutex

View File

@ -37,7 +37,7 @@ func (b *ParallelTestBuilder) Prepare(raws ...interface{}) ([]string, []string,
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")
b.wg.Done()
return nil, nil
@ -52,7 +52,7 @@ func (b *LockedBuilder) Prepare(raws ...interface{}) ([]string, []string, error)
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")
select {
case <-b.unlock:

View File

@ -78,7 +78,7 @@ func (b *MockBuilder) Prepare(raws ...interface{}) ([]string, []string, error) {
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
}
@ -122,7 +122,7 @@ func (b *MockPostProcessor) Configure(raws ...interface{}) error {
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
}

View File

@ -63,7 +63,7 @@ func (p *HCL2PostProcessor) Configure(args ...interface{}) error {
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{})
if artifactStateData, ok := artifact.State("generated_data").(map[interface{}]interface{}); ok {
for k, v := range artifactStateData {

View File

@ -10,6 +10,7 @@ import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/template"
)
@ -49,7 +50,7 @@ type TestCase struct {
}
// 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.
type TestTeardownFunc func() error

View File

@ -64,7 +64,7 @@ type Build interface {
// Run runs the actual builder, returning an artifact implementation
// of what is built. If anything goes wrong, an error is returned.
// 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
// 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.
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 {
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}
artifacts := make([]Artifact, 0, 1)
artifacts := make([]packersdk.Artifact, 0, 1)
// The builder just has a normal Ui, but targeted
builderUi := &TargetedUI{

View File

@ -37,5 +37,5 @@ type Builder interface {
Prepare(...interface{}) ([]string, []string, error)
// Run is where the actual build should take place. It takes a Build and a Ui.
Run(context.Context, packersdk.Ui, Hook) (Artifact, error)
Run(context.Context, packersdk.Ui, Hook) (packersdk.Artifact, error)
}

View File

@ -40,7 +40,7 @@ func (tb *MockBuilder) Prepare(config ...interface{}) ([]string, []string, error
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.RunHook = h
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,
}, nil
}

View File

@ -112,16 +112,16 @@ func (*FlatMockCommunicator) HCL2Spec() map[string]hcldec.Spec {
// FlatMockPostProcessor is an auto-generated flat version of MockPostProcessor.
// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatMockPostProcessor struct {
ArtifactId *string `cty:"artifact_id" hcl:"artifact_id"`
Keep *bool `cty:"keep" hcl:"keep"`
ForceOverride *bool `cty:"force_override" hcl:"force_override"`
Error error `cty:"error" hcl:"error"`
ConfigureCalled *bool `cty:"configure_called" hcl:"configure_called"`
ConfigureConfigs []interface{} `cty:"configure_configs" hcl:"configure_configs"`
ConfigureError error `cty:"configure_error" hcl:"configure_error"`
PostProcessCalled *bool `cty:"post_process_called" hcl:"post_process_called"`
PostProcessArtifact Artifact `cty:"post_process_artifact" hcl:"post_process_artifact"`
PostProcessUi packersdk.Ui `cty:"post_process_ui" hcl:"post_process_ui"`
ArtifactId *string `cty:"artifact_id" hcl:"artifact_id"`
Keep *bool `cty:"keep" hcl:"keep"`
ForceOverride *bool `cty:"force_override" hcl:"force_override"`
Error error `cty:"error" hcl:"error"`
ConfigureCalled *bool `cty:"configure_called" hcl:"configure_called"`
ConfigureConfigs []interface{} `cty:"configure_configs" hcl:"configure_configs"`
ConfigureError error `cty:"configure_error" hcl:"configure_error"`
PostProcessCalled *bool `cty:"post_process_called" hcl:"post_process_called"`
PostProcessArtifact packersdk.Artifact `cty:"post_process_artifact" hcl:"post_process_artifact"`
PostProcessUi packersdk.Ui `cty:"post_process_ui" hcl:"post_process_ui"`
}
// FlatMapstructure returns a new FlatMockPostProcessor.

Some files were not shown because too many files have changed in this diff Show More