Use Packer 1.2 (#84)
This commit is contained in:
parent
775d0007fa
commit
808a7ce57d
|
@ -80,8 +80,10 @@
|
|||
"communicator/ssh",
|
||||
"communicator/winrm",
|
||||
"helper/builder/testing",
|
||||
"helper/common",
|
||||
"helper/communicator",
|
||||
"helper/config",
|
||||
"helper/multistep",
|
||||
"packer",
|
||||
"packer/plugin",
|
||||
"packer/rpc",
|
||||
|
@ -89,8 +91,8 @@
|
|||
"template/interpolate",
|
||||
"version"
|
||||
]
|
||||
revision = "6a8ae4b258d1bb0beece05c9fc3bbc1c186a0480"
|
||||
version = "v1.0.2"
|
||||
revision = "ab8811dca8f375344f36dfc32710b9790b2ec03e"
|
||||
version = "v1.2.2"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -135,7 +137,7 @@
|
|||
".",
|
||||
"fat"
|
||||
]
|
||||
revision = "7bae45d9a684750e82b97ff320c82556614e621b"
|
||||
revision = "b7b9ca407ffff465de12fc37ccbb81ea8b428c43"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -149,12 +151,6 @@
|
|||
packages = ["."]
|
||||
revision = "00c29f56e2386353d58c599509e8dc3801b0d716"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/mitchellh/multistep"
|
||||
packages = ["."]
|
||||
revision = "391576a156a54cfbb4cf5d5eda40cf6ffa3e3a4d"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/mitchellh/reflectwalk"
|
||||
|
@ -182,14 +178,14 @@
|
|||
[[projects]]
|
||||
name = "github.com/pkg/sftp"
|
||||
packages = ["."]
|
||||
revision = "49488377fa2f14143ba3067cf7555f60f6c7b550"
|
||||
version = "1.5.0"
|
||||
revision = "43ec6c679d353f6e077d3965dc74f6d996eb4a09"
|
||||
version = "1.5.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/ugorji/go"
|
||||
packages = ["codec"]
|
||||
revision = "9831f2c3ac1068a78f50999a30db84270f647af6"
|
||||
version = "v1.1"
|
||||
revision = "b4c50a2b199d93b13dc15e78929cfb23bfdf21ab"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/vmware/govmomi"
|
||||
|
@ -226,13 +222,13 @@
|
|||
"ssh",
|
||||
"ssh/agent"
|
||||
]
|
||||
revision = "88942b9c40a4c9d203b82b3731787b672d6e809b"
|
||||
revision = "d6449816ce06963d9d136eee5a56fca5b0616e7e"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/mobile"
|
||||
packages = ["event/key"]
|
||||
revision = "598bfe4b20d39a660581f014b68e60c5ad425336"
|
||||
revision = "1f177cbe4ddf911017472e9532c6ca3a99949d53"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -240,9 +236,11 @@
|
|||
packages = [
|
||||
"html",
|
||||
"html/atom",
|
||||
"html/charset"
|
||||
"html/charset",
|
||||
"internal/socks",
|
||||
"proxy"
|
||||
]
|
||||
revision = "6078986fec03a1dcc236c34816c71b0e05018fda"
|
||||
revision = "500e7a4f953ddaf55d316b4d3adc516aa0379622"
|
||||
|
||||
[[projects]]
|
||||
name = "golang.org/x/text"
|
||||
|
@ -271,6 +269,6 @@
|
|||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "edb4fc0cd7c29895ef0cb47e8323311bacdba397dd57f12217ac8ea9dce6a31d"
|
||||
inputs-digest = "20177d3d587549d23b3ddea4eefc1fc03aa3436c372843bc76f98052b25432b7"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[[constraint]]
|
||||
name = "github.com/hashicorp/packer"
|
||||
version = "=1.0.2"
|
||||
version = "=1.2.2"
|
||||
|
||||
[[override]]
|
||||
name = "github.com/masterzen/azure-sdk-for-go"
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/common"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
)
|
||||
|
||||
type Builder struct {
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package clone
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"fmt"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/common"
|
||||
"context"
|
||||
)
|
||||
|
||||
type CloneConfig struct {
|
||||
|
@ -28,7 +29,7 @@ type StepCloneVM struct {
|
|||
config *CloneConfig
|
||||
}
|
||||
|
||||
func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepCloneVM) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
d := state.Get("driver").(*driver.Driver)
|
||||
|
||||
|
|
|
@ -4,14 +4,15 @@ import (
|
|||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/common"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"context"
|
||||
)
|
||||
|
||||
type StepConfigureHardware struct {
|
||||
config *common.HardwareConfig
|
||||
}
|
||||
|
||||
func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepConfigureHardware) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
vm := state.Get("vm").(*driver.VirtualMachine)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"errors"
|
||||
)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"io/ioutil"
|
||||
|
||||
packerssh "github.com/hashicorp/packer/communicator/ssh"
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"golang.org/x/crypto/ssh"
|
||||
"github.com/hashicorp/packer/helper/communicator"
|
||||
)
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"fmt"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"context"
|
||||
)
|
||||
|
||||
type ConnectConfig struct {
|
||||
|
@ -34,8 +35,8 @@ type StepConnect struct {
|
|||
Config *ConnectConfig
|
||||
}
|
||||
|
||||
func (s *StepConnect) Run(state multistep.StateBag) multistep.StepAction {
|
||||
d, err := driver.NewDriver(&driver.ConnectConfig{
|
||||
func (s *StepConnect) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
d, err := driver.NewDriver(ctx, &driver.ConnectConfig{
|
||||
VCenterServer: s.Config.VCenterServer,
|
||||
Username: s.Config.Username,
|
||||
Password: s.Config.Password,
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"fmt"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"strings"
|
||||
"time"
|
||||
"context"
|
||||
)
|
||||
|
||||
type RunConfig struct {
|
||||
|
@ -35,7 +36,7 @@ type StepRun struct {
|
|||
Config *RunConfig
|
||||
}
|
||||
|
||||
func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepRun) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
vm := state.Get("vm").(*driver.VirtualMachine)
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
"bytes"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"context"
|
||||
)
|
||||
|
||||
type ShutdownConfig struct {
|
||||
|
@ -37,7 +38,7 @@ type StepShutdown struct {
|
|||
Config *ShutdownConfig
|
||||
}
|
||||
|
||||
func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepShutdown) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
comm := state.Get("communicator").(packer.Communicator)
|
||||
vm := state.Get("vm").(*driver.VirtualMachine)
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"context"
|
||||
)
|
||||
|
||||
type StepCreateSnapshot struct{
|
||||
CreateSnapshot bool
|
||||
}
|
||||
|
||||
func (s *StepCreateSnapshot) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepCreateSnapshot) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
vm := state.Get("vm").(*driver.VirtualMachine)
|
||||
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"context"
|
||||
)
|
||||
|
||||
type StepConvertToTemplate struct{
|
||||
ConvertToTemplate bool
|
||||
}
|
||||
|
||||
func (s *StepConvertToTemplate) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepConvertToTemplate) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
vm := state.Get("vm").(*driver.VirtualMachine)
|
||||
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"fmt"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"time"
|
||||
"context"
|
||||
)
|
||||
|
||||
type StepWaitForIp struct{}
|
||||
|
||||
func (s *StepWaitForIp) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepWaitForIp) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
vm := state.Get("vm").(*driver.VirtualMachine)
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"testing"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/common"
|
||||
"context"
|
||||
)
|
||||
|
||||
func NewVMName() string {
|
||||
|
@ -34,7 +35,7 @@ func RenderConfig(config map[string]interface{}) string {
|
|||
|
||||
|
||||
func TestConn(t *testing.T) *driver.Driver {
|
||||
d, err := driver.NewDriver(&driver.ConnectConfig{
|
||||
d, err := driver.NewDriver(context.TODO(), &driver.ConnectConfig{
|
||||
VCenterServer: "vcenter.vsphere65.test",
|
||||
Username: "root",
|
||||
Password: "jetbrains",
|
||||
|
|
|
@ -28,8 +28,7 @@ type ConnectConfig struct {
|
|||
Datacenter string
|
||||
}
|
||||
|
||||
func NewDriver(config *ConnectConfig) (*Driver, error) {
|
||||
ctx := context.TODO()
|
||||
func NewDriver(ctx context.Context, config *ConnectConfig) (*Driver, error) {
|
||||
|
||||
vcenter_url, err := url.Parse(fmt.Sprintf("https://%v/sdk", config.VCenterServer))
|
||||
if err != nil {
|
||||
|
|
|
@ -5,13 +5,14 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
"math/rand"
|
||||
"context"
|
||||
)
|
||||
|
||||
// Defines whether acceptance tests should be run
|
||||
const TestHostName = "esxi-1.vsphere65.test"
|
||||
|
||||
func newTestDriver(t *testing.T) *Driver {
|
||||
d, err := NewDriver(&ConnectConfig{
|
||||
d, err := NewDriver(context.TODO(), &ConnectConfig{
|
||||
VCenterServer: "vcenter.vsphere65.test",
|
||||
Username: "root",
|
||||
Password: "jetbrains",
|
||||
|
|
|
@ -3,10 +3,11 @@ package main
|
|||
import (
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"fmt"
|
||||
"context"
|
||||
)
|
||||
|
||||
func main() {
|
||||
d, err := driver.NewDriver(&driver.ConnectConfig{
|
||||
d, err := driver.NewDriver(context.TODO(), &driver.ConnectConfig{
|
||||
VCenterServer: "vcenter.vsphere65.test",
|
||||
Username: "root",
|
||||
Password: "jetbrains",
|
||||
|
|
|
@ -2,11 +2,11 @@ package iso
|
|||
|
||||
import (
|
||||
packerCommon "github.com/hashicorp/packer/common"
|
||||
"github.com/hashicorp/packer/helper/communicator"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/common"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/helper/communicator"
|
||||
)
|
||||
|
||||
type Builder struct {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package iso
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"fmt"
|
||||
"context"
|
||||
)
|
||||
|
||||
type CDRomConfig struct {
|
||||
|
@ -20,7 +20,7 @@ type StepAddCDRom struct {
|
|||
Config *CDRomConfig
|
||||
}
|
||||
|
||||
func (s *StepAddCDRom) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepAddCDRom) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
vm := state.Get("vm").(*driver.VirtualMachine)
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package iso
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"github.com/mitchellh/multistep"
|
||||
"fmt"
|
||||
"context"
|
||||
)
|
||||
|
||||
type FloppyConfig struct {
|
||||
|
@ -32,7 +32,7 @@ type StepAddFloppy struct {
|
|||
Host string
|
||||
}
|
||||
|
||||
func (s *StepAddFloppy) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepAddFloppy) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
err := s.runImpl(state)
|
||||
if err != nil {
|
||||
state.Put("error", fmt.Errorf("error adding floppy: %v", err))
|
||||
|
|
|
@ -3,7 +3,7 @@ package iso
|
|||
import (
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"fmt"
|
||||
"time"
|
||||
"strings"
|
||||
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/hashicorp/packer/common"
|
||||
"os"
|
||||
"log"
|
||||
"context"
|
||||
)
|
||||
|
||||
type BootConfig struct {
|
||||
|
@ -63,7 +64,7 @@ func init() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *StepBootCommand) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepBootCommand) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
vm := state.Get("vm").(*driver.VirtualMachine)
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@ package iso
|
|||
import (
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"fmt"
|
||||
"context"
|
||||
)
|
||||
|
||||
type ConfigParamsConfig struct {
|
||||
|
@ -19,7 +20,7 @@ type StepConfigParams struct {
|
|||
Config *ConfigParamsConfig
|
||||
}
|
||||
|
||||
func (s *StepConfigParams) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepConfigParams) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
vm := state.Get("vm").(*driver.VirtualMachine)
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ import (
|
|||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/common"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"context"
|
||||
)
|
||||
|
||||
type CreateConfig struct {
|
||||
|
@ -55,7 +56,7 @@ type StepCreateVM struct {
|
|||
Config *CreateConfig
|
||||
}
|
||||
|
||||
func (s *StepCreateVM) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
d := state.Get("driver").(*driver.Driver)
|
||||
|
||||
|
|
|
@ -5,13 +5,14 @@ import (
|
|||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
"context"
|
||||
)
|
||||
|
||||
type StepRemoveCDRom struct{}
|
||||
|
||||
func (s *StepRemoveCDRom) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepRemoveCDRom) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
vm := state.Get("vm").(*driver.VirtualMachine)
|
||||
|
||||
|
|
|
@ -5,8 +5,9 @@ import (
|
|||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
"context"
|
||||
)
|
||||
|
||||
type StepRemoveFloppy struct {
|
||||
|
@ -14,7 +15,7 @@ type StepRemoveFloppy struct {
|
|||
Host string
|
||||
}
|
||||
|
||||
func (s *StepRemoveFloppy) Run(state multistep.StateBag) multistep.StepAction {
|
||||
func (s *StepRemoveFloppy) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
vm := state.Get("vm").(*driver.VirtualMachine)
|
||||
d := state.Get("driver").(*driver.Driver)
|
||||
|
|
Loading…
Reference in New Issue