From afc063621e540d57e6e2272eb996839cd2961624 Mon Sep 17 00:00:00 2001 From: Christopher M Luciano Date: Tue, 4 Oct 2016 13:11:27 -0400 Subject: [PATCH 1/7] switch to golang ssh crypto library --- builder/softlayer/step_create_ssh_key.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/softlayer/step_create_ssh_key.go b/builder/softlayer/step_create_ssh_key.go index 9f82068..689b3ed 100644 --- a/builder/softlayer/step_create_ssh_key.go +++ b/builder/softlayer/step_create_ssh_key.go @@ -1,7 +1,6 @@ package softlayer import ( - "code.google.com/p/gosshold/ssh" "crypto/rand" "crypto/rsa" "crypto/x509" @@ -10,6 +9,7 @@ import ( "github.com/mitchellh/multistep" "github.com/mitchellh/packer/common/uuid" "github.com/mitchellh/packer/packer" + "golang.org/x/crypto/ssh" "io/ioutil" "log" "strings" From 41d8221c66d68330c9026a53f19861505bf320f8 Mon Sep 17 00:00:00 2001 From: Christopher M Luciano Date: Tue, 4 Oct 2016 13:24:06 -0400 Subject: [PATCH 2/7] Use glide for dependency management Glide is necessary in order to make use of packer vendored libraries. If we do not vendor, the softlayer builder becomes confused over which multistep libraries it is supposed to be using. --- README.md | 3 +++ glide.lock | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ glide.yaml | 16 ++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 glide.lock create mode 100644 glide.yaml diff --git a/README.md b/README.md index 18bec22..9d9987a 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,13 @@ The builder does not manage images. Once it creates an image, it is up to you to Download the Packer binaries [here](https://www.packer.io/downloads.html) or build Packer from source as described [here](https://github.com/mitchellh/packer#developing-packer). +Install [glide](https://github.com/Masterminds/glide#install) + Next, clone this repository into `$GOPATH/src/github.com/leonidlm/packer-builder-softlayer`. Then build the packer-softlayer-builder binary into the same folder as the packer binaries: ``` cd $GOPATH/src/github.com/leonidlm/packer-builder-softlayer +glide update --strip-vendor go build -o /usr/local/packer/packer-builder-softlayer main.go ``` diff --git a/glide.lock b/glide.lock new file mode 100644 index 0000000..8e7cd7d --- /dev/null +++ b/glide.lock @@ -0,0 +1,77 @@ +hash: 008a8e7aff1f426b560be6e5788348189242451261fcccaa86c3b3b64f97b26b +updated: 2016-10-04T13:15:02.428110843-04:00 +imports: +- name: github.com/dylanmei/iso8601 + version: 2075bf119b58e5576c6ed9f867b8f3d17f2e54d4 +- name: github.com/dylanmei/winrmtest + version: 025617847eb2cf9bd1d851bc3b22ed28e6245ce5 +- name: github.com/hashicorp/errwrap + version: 7554cd9344cec97297fa6649b055a8c98c2a1e55 +- name: github.com/hashicorp/go-multierror + version: d30f09973e19c1dfcd120b2d9c4f168e68d6b5d5 +- name: github.com/hashicorp/go-version + version: 7e3c02b30806fa5779d3bdfc152ce4c6f40e7b38 +- name: github.com/hashicorp/yamux + version: df949784da9ed028ee76df44652e42d37a09d7e4 +- name: github.com/kr/fs + version: 2788f0dbd16903de03cb8186e5c7d97b69ad387b +- name: github.com/masterzen/simplexml + version: 95ba30457eb1121fa27753627c774c7cd4e90083 + subpackages: + - dom +- name: github.com/masterzen/winrm + version: 54ea5d01478cfc2afccec1504bd0dfcd8c260cfa + subpackages: + - soap + - winrm +- name: github.com/masterzen/xmlpath + version: 13f4951698adc0fa9c1dda3e275d489a24201161 +- name: github.com/mitchellh/go-fs + version: a34c1b9334e86165685a9449b782f20465eb8c69 + subpackages: + - fat +- name: github.com/mitchellh/iochan + version: 87b45ffd0e9581375c491fef3d32130bb15c5bd7 +- name: github.com/mitchellh/mapstructure + version: 281073eb9eb092240d33ef253c404f1cca550309 +- name: github.com/mitchellh/multistep + version: 162146fc57112954184d90266f4733e900ed05a5 +- name: github.com/mitchellh/packer + version: 9e8a3fa3eab8263f3f976bdac51832fa4cf0e39f + subpackages: + - common + - common/ssh + - common/uuid + - communicator/none + - communicator/ssh + - communicator/winrm + - helper/communicator + - helper/config + - packer + - packer/plugin + - packer/rpc + - template + - template/interpolate +- name: github.com/mitchellh/reflectwalk + version: eecf4c70c626c7cfbb95c90195bc34d386c74ac6 +- name: github.com/nu7hatch/gouuid + version: 179d4d0c4d8d407a32af483c2354df1d2c91e6c3 +- name: github.com/packer-community/winrmcp + version: f1bcf36a69fa2945e65dd099eee11b560fbd3346 + subpackages: + - winrmcp +- name: github.com/pkg/sftp + version: e84cc8c755ca39b7b64f510fe1fffc1b51f210a5 +- name: github.com/satori/go.uuid + version: d41af8bb6a7704f00bc3b7cba9355ae6a5a80048 +- name: github.com/ugorji/go + version: 646ae4a518c1c3be0739df898118d9bccf993858 + subpackages: + - codec +- name: golang.org/x/crypto + version: 1f22c0103821b9390939b6776727195525381532 + subpackages: + - curve25519 + - ssh + - ssh/agent +testImports: [] diff --git a/glide.yaml b/glide.yaml new file mode 100644 index 0000000..53d71d9 --- /dev/null +++ b/glide.yaml @@ -0,0 +1,16 @@ +package: github.com/leonidlm/packer-builder-softlayer +import: +- package: github.com/mitchellh/multistep +- package: github.com/mitchellh/packer + version: ~0.10.2 + subpackages: + - common + - common/uuid + - helper/communicator + - helper/config + - packer + - packer/plugin + - template/interpolate +- package: golang.org/x/crypto + subpackages: + - ssh From ca951394994909b8713e2e6c506a44b1c23cf3b8 Mon Sep 17 00:00:00 2001 From: "Christopher M. Luciano" Date: Mon, 21 Dec 2015 13:40:39 -0500 Subject: [PATCH 3/7] Add travis-ci --- .travis.yml | 11 +++++++++++ README.md | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..985a7e2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +sudo: false + +language: go + +go: + - 1.6.3 + - 1.7 + - tip + +matrix: + fast_finish: true diff --git a/README.md b/README.md index 9d9987a..b84c7f8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # SoftLayer Builder (for packer.io) +[![Build Status](https://travis-ci.org/watson-platform/packer-builder-softlayer.svg?branch=master)](https://travis-ci.org/watson-platform/packer-builder-softlayer) + The softlayer builder is able to create new images for use with SoftLayer. The builder takes a source image (identified by it's global ID or reference name), runs any provisioning necessary on the image after launching it, then snapshots it into a reusable image. This reusable image can then be used as the foundation of new servers that are launched within SoftLayer. The builder does not manage images. Once it creates an image, it is up to you to use it or delete it. @@ -120,4 +122,3 @@ To run the unit tests, execute "go test ./..." from the root project directory. * Configure travis CI or any alternative to automatically test and build the code * Provide an easier way to install (with no need to compile from source) * Add an option to configure multiple disks for the instance - From bfca52b8fd5112eec4aef1c74d3b575f646c965f Mon Sep 17 00:00:00 2001 From: Christopher M Luciano Date: Tue, 4 Oct 2016 13:44:44 -0400 Subject: [PATCH 4/7] add glide to travis build --- .travis.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 985a7e2..accb30e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,3 @@ -sudo: false - language: go go: @@ -7,5 +5,16 @@ go: - 1.7 - tip -matrix: - fast_finish: true +addons: + apt: + sources: + - sourceline: 'ppa:masterminds/glide' + packages: + - glide + +cache: + directories: + - $HOME/.glide + +install: + - glide install --strip-vendor From 6180d7eff467dae60c043d6f2a3d2e914f0832b7 Mon Sep 17 00:00:00 2001 From: Christopher M Luciano Date: Tue, 4 Oct 2016 14:36:05 -0400 Subject: [PATCH 5/7] Use go get for glide The glide PPA is needs to be approved with travis-ci/apt-source-whitelist#319. Until this is merged, we should be able to use go get to install glide. --- .travis.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index accb30e..b2ec6ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,16 +5,10 @@ go: - 1.7 - tip -addons: - apt: - sources: - - sourceline: 'ppa:masterminds/glide' - packages: - - glide - cache: directories: - $HOME/.glide install: + - go get github.com/Masterminds/glide - glide install --strip-vendor From 300a950b50cf98d6d58b08653268be2d703b6c36 Mon Sep 17 00:00:00 2001 From: Christopher M Luciano Date: Tue, 4 Oct 2016 15:49:12 -0400 Subject: [PATCH 6/7] change from leonidlm to watson-platform import paths --- .travis.yml | 3 +++ README.md | 8 ++++---- Vagrantfile | 2 +- glide.lock | 4 ++-- glide.yaml | 2 +- main.go | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index b2ec6ac..b9ad233 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,3 +12,6 @@ cache: install: - go get github.com/Masterminds/glide - glide install --strip-vendor + +script: + - go test -v $(glide novendor) diff --git a/README.md b/README.md index b84c7f8..cb3b014 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,11 @@ Download the Packer binaries [here](https://www.packer.io/downloads.html) or bui Install [glide](https://github.com/Masterminds/glide#install) -Next, clone this repository into `$GOPATH/src/github.com/leonidlm/packer-builder-softlayer`. Then build the packer-softlayer-builder binary into the same folder as the packer binaries: +Next, clone this repository into `$GOPATH/src/github.com/watson-platform/packer-builder-softlayer`. Then build the packer-softlayer-builder binary into the same folder as the packer binaries: ``` -cd $GOPATH/src/github.com/leonidlm/packer-builder-softlayer -glide update --strip-vendor +cd $GOPATH/src/github.com/watson-platform/packer-builder-softlayer +glide install --strip-vendor go build -o /usr/local/packer/packer-builder-softlayer main.go ``` @@ -109,7 +109,7 @@ As already stated above, a good way of reviewing the available options is by ins ## Contribute New contributors are always welcome! -When in doubt please feel free to ask questions, just [Create an issue](https://github.com/leonidlm/packer-builder-softlayer/issues/new) with your enquiries. +When in doubt please feel free to ask questions, just [Create an issue](https://github.com/watson-platform/packer-builder-softlayer/issues/new) with your enquiries. ### Development Environment diff --git a/Vagrantfile b/Vagrantfile index 0cd798d..d3ebb6f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -10,7 +10,7 @@ VM_GUI=false GOROOT = '/opt/go' GOPATH = '/opt/gopath' -PACKAGE_PATH = 'src/github.com/leonidlm/packer-builder-softlayer' +PACKAGE_PATH = 'src/github.com/watson-platform/packer-builder-softlayer' script = <