From 230bfa774c190ef784664a9d2e62f8375396ef3f Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Wed, 24 Jan 2018 21:01:04 +0300 Subject: [PATCH] Build two independent plugins --- .gitignore | 3 +-- build.sh | 14 +++++++------- cmd/clone/main.go | 13 +++++++++++++ {clone => cmd/iso}/main.go | 5 +++-- docker-compose.yml | 2 +- 5 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 cmd/clone/main.go rename {clone => cmd/iso}/main.go (55%) diff --git a/.gitignore b/.gitignore index 5aee28a7e..5582d6763 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,7 @@ .idea/ .glide/ vendor/ -packer-builder-vsphere -packer-builder-vsphere.exe +packer-builder-vsphere* bin/ test*.json crash.log diff --git a/build.sh b/build.sh index e652100c3..9651be5bd 100755 --- a/build.sh +++ b/build.sh @@ -2,16 +2,16 @@ set -eux -glide install -v +# glide install -v export CGO_ENABLED=0 export GOARCH=amd64 mkdir -p bin rm -f bin/* -GOOS=darwin go build -o bin/packer-builder-vsphere-clone.macos ./clone -GOOS=linux go build -o bin/packer-builder-vsphere-clone.linux ./clone -GOOS=windows go build -o bin/packer-builder-vsphere-clone.exe ./clone +GOOS=darwin go build -o bin/packer-builder-vsphere.macos ./cmd/clone +GOOS=linux go build -o bin/packer-builder-vsphere.linux ./cmd/clone +GOOS=windows go build -o bin/packer-builder-vsphere.exe ./cmd/clone -GOOS=darwin go build -o bin/packer-builder-vsphere-iso.macos ./iso -GOOS=linux go build -o bin/packer-builder-vsphere-iso.linux ./iso -GOOS=windows go build -o bin/packer-builder-vsphere-iso.exe ./iso +GOOS=darwin go build -o bin/packer-builder-vsphere-iso.macos ./cmd/iso +GOOS=linux go build -o bin/packer-builder-vsphere-iso.linux ./cmd/iso +GOOS=windows go build -o bin/packer-builder-vsphere-iso.exe ./cmd/iso diff --git a/cmd/clone/main.go b/cmd/clone/main.go new file mode 100644 index 000000000..0ac47b4a6 --- /dev/null +++ b/cmd/clone/main.go @@ -0,0 +1,13 @@ +package main + +import "github.com/hashicorp/packer/packer/plugin" +import "github.com/jetbrains-infra/packer-builder-vsphere/clone" + +func main() { + server, err := plugin.Server() + if err != nil { + panic(err) + } + server.RegisterBuilder(new(clone.Builder)) + server.Serve() +} diff --git a/clone/main.go b/cmd/iso/main.go similarity index 55% rename from clone/main.go rename to cmd/iso/main.go index 3a710c3d7..f64cc1720 100644 --- a/clone/main.go +++ b/cmd/iso/main.go @@ -1,12 +1,13 @@ -package clone +package main import "github.com/hashicorp/packer/packer/plugin" +import "github.com/jetbrains-infra/packer-builder-vsphere/iso" func main() { server, err := plugin.Server() if err != nil { panic(err) } - server.RegisterBuilder(new(Builder)) + server.RegisterBuilder(new(iso.Builder)) server.Serve() } diff --git a/docker-compose.yml b/docker-compose.yml index 5d2c26933..ea924c80a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ build: - image: jetbrainsinfra/golang:1.8.3 + image: jetbrainsinfra/golang:1.9.2 volumes: - .:/go/src/github.com/jetbrains-infra/packer-builder-vsphere working_dir: /go/src/github.com/jetbrains-infra/packer-builder-vsphere