Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packer builder #761

Open
wants to merge 44 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
288810f
Add builder plugin templates.
Nov 16, 2015
e08a2cb
Add unit test for config.
Nov 16, 2015
7755c09
Add unit test for artifact.
Nov 16, 2015
037aef4
Add simple step stub.
Nov 16, 2015
99a98d3
Add stub for basic steps for building image.
Nov 16, 2015
60efb9c
Add README.
Nov 17, 2015
1b7b785
Rename folder to generate "packer-builder-wakamevdc" binary file.
Nov 17, 2015
01a14b4
Add a simple install guide.
Nov 18, 2015
6130b4e
Attempt setup_create_instance to call API.
Nov 18, 2015
b8655df
fix test.json to work.
Nov 18, 2015
37fe053
Merge branch 'go-api-client' into packer-builder
Nov 20, 2015
8d0a8cf
Use go-wakamevdc client.
Nov 20, 2015
6892ed7
Merge branch 'go-api-client' into packer-builder
Dec 2, 2015
2c1488d
Read paramters for creating instance from conf file.
Nov 26, 2015
181e8ec
Add terminate instance step.
Nov 26, 2015
fcbbe15
Make waitFor function resouce independent.
Dec 1, 2015
3bd4608
Call real API in poweroff and backup steps.
Dec 1, 2015
e4ff3ec
Add setup step to create ssh key and security group.
Dec 1, 2015
8389476
Got SSH connection step work.
Dec 1, 2015
211ceb7
Enable provision step.
Dec 1, 2015
7334ff6
Handle artifact properly.
Dec 2, 2015
a5312ba
Apply gofmt and golint.
Dec 2, 2015
b4a294f
Merge branch 'go-api-client' into packer-builder
Dec 2, 2015
5b78b94
Merge branch 'go-api-client' into packer-builder
Dec 2, 2015
1ad2698
Cleanup temporary the SSH key and the security group.
Dec 2, 2015
00d430e
Update parameter descriptions.
Dec 2, 2015
947ffb4
Avoid name resolution error for the builder instance.
Dec 2, 2015
3e9a5e7
Merge branch 'go-api-client' into packer-builder
Dec 3, 2015
c4bb674
Get user_data parameter worked.
Dec 3, 2015
f8efaae
change to private scope.
Dec 3, 2015
ffa6a02
Check the vital parameter as artifact only when it accomplished all s…
Dec 3, 2015
029fc92
Cleanup temporary resources when they got cancelled or failed.
Dec 3, 2015
717f26c
Merge branch 'go-api-client' into packer-builder
Dec 4, 2015
4ac78d9
Follow the change cf2508ea in go-api-client.
Dec 4, 2015
e009402
Wait for the instance until terminated during irregular cleanup case.
Dec 4, 2015
56969f3
Only the halted case returns error.
Dec 4, 2015
d4dbbef
wait for instance termination otherwise security group cleanup failed.
Feb 2, 2016
5cf346a
fix an error message.
Feb 2, 2016
ec69205
Merge branch 'go-api-client' into packer-builder
Feb 2, 2016
f88814c
Add ``backup_storage_id`` parameter to set the upload destination.
Feb 2, 2016
05cfab8
Add vendor.json.
Sep 1, 2016
5f67aa2
Merge branch 'go-api-client' into packer-builder
Sep 1, 2016
68732cf
Add govendor .json and stick to packer v0.10.1 (4e5f65131).
Sep 2, 2016
54a7e62
Update the Building section of README.
Sep 2, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/go-wakamevdc/.gitignore
@@ -0,0 +1,2 @@
vendor/**
!vendor/vendor.json
19 changes: 19 additions & 0 deletions client/go-wakamevdc/vendor/vendor.json
@@ -0,0 +1,19 @@
{
"comment": "",
"ignore": "test",
"package": [
{
"checksumSHA1": "7P0J627oSUIrPWhssldsgxjwMSA=",
"path": "github.com/dghubble/sling",
"revision": "52e88a7b75a5db3b49f8911f16d49d9b7b67adc5",
"revisionTime": "2016-08-21T06:16:55Z"
},
{
"checksumSHA1": "F+7lTlQMULu2pqest14vkT8vc7g=",
"path": "github.com/google/go-querystring/query",
"revision": "9235644dd9e52eeae6fa48efd539fdc351a0af53",
"revisionTime": "2016-03-11T01:20:12Z"
}
],
"rootPath": "github.com/axsh/wakame-vdc/client/go-wakamevdc"
}
2 changes: 2 additions & 0 deletions client/packer-builder-wakamevdc/.gitignore
@@ -0,0 +1,2 @@
vendor/**
!vendor/vendor.json
62 changes: 62 additions & 0 deletions client/packer-builder-wakamevdc/README.md
@@ -0,0 +1,62 @@
# Wakame-vdc Builder

Type: ``wakamevdc``

## Basic Example

``` {.javascript}
{
"builders": [
{
"type": "wakamevdc",
"image_id": "wmi-centos1d64",
"api_endpoint": "http://localhost:9001/api/12.03/",
"account_id": "a-00001",
"hypervisor": "openvz",
"cpu_cores": 1,
"memory_size": 1024,
"network_id": "nw-demo1"
}
]
}
```

### Required:

- `image_id` (string) - Wakame Image ID to source.
- `network_id` (string) - Network ID (nw-xxxx) to attach interface.
- `hypervisor` (string) - Choose Hypervisor type: openvz, lxc, kvm

### Optional:

- `api_endpoint` (string) - Base URL to the Web API. (default: ``http://localhost:9001/api/12.03/``)
- `cpu_cores` (int) Number CPU cores for the instance. (Default: 1)
- `memory_size` (int) Memory size for the instance in megabyte. (Default: 512MB)
- `account_id` (string) - Account ID to become owner for new image (Default: a-shpoolxx)
- `host_node_id` (string) - Host Node ID to run instance.
- `user_data` (string) - User data for the instance.
- `state_timeout` (string) - Duration in seconds to wait for instance's state transition. (Default: 360)
- `ssh_username` (string) - User name for SSH connection. (Default: root)
- `backup_storage_id` (string) - Backup Storage ID (bkst-xxxx) to upload image file. (Default: same storage)

## Build & Install

Go (>= 1.6) is recommended to build. [govendor](https://github.com/kardianos/govendor) is the tool to manage the dependencies.

```bash
go get -u github.com/kardianos/govendor
go get -u github.com/axsh/wakame-vdc/client/packer-builder-wakamevdc
cd $GOPATH/src/github.com/axsh/wakame-vdc/client/go-wakamevdc
govendor sync
cd $GOPATH/src/github.com/axsh/wakame-vdc/client/packer-builder-wakamevdc
govendor sync
go build
```

Once you complete to build, you'll see the ``packer-builder-wakamevdc`` binary. It can be installed to:

- Same folder where ``packer`` is in.
- ``$HOME/.packer.d/plugins``
- Current working directory

See [Installing Plugins](https://www.packer.io/docs/extend/plugins.html) section.
15 changes: 15 additions & 0 deletions client/packer-builder-wakamevdc/main.go
@@ -0,0 +1,15 @@
package main

import (
"github.com/axsh/wakame-vdc/client/packer-builder-wakamevdc/wakamevdc"
"github.com/mitchellh/packer/packer/plugin"
)

func main() {
server, err := plugin.Server()
if err != nil {
panic(err)
}
server.RegisterBuilder(new(wakamevdc.Builder))
server.Serve()
}
25 changes: 25 additions & 0 deletions client/packer-builder-wakamevdc/test.json
@@ -0,0 +1,25 @@
{
"builders": [
{
"type": "wakamevdc",
"api_endpoint": "http://localhost:9001/api/12.03/",
"image_id": "wmi-centos1d64",
"hypervisor": "openvz",
"cpu_cores": 1,
"memory_size": 1024,
"network_id": "nw-demo1",
"ssh_username": "root",
"ssh_timeout": "60m"
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"echo RUN Provisioner.",
"echo \"nameserver 8.8.8.8\" >> /etc/resolve.conf",
"yum install -y httpd"
]
}
]
}
266 changes: 266 additions & 0 deletions client/packer-builder-wakamevdc/vendor/vendor.json
@@ -0,0 +1,266 @@
{
"comment": "",
"ignore": "test github.com/axsh/wakame-vdc/client/go-wakamevdc",
"package": [
{
"checksumSHA1": "LxbUydpP5v/OHYJwDFWM7i/g69o=",
"origin": "github.com/mitchellh/packer/vendor/github.com/dylanmei/iso8601",
"path": "github.com/dylanmei/iso8601",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "VouXWSVlKOI0daCPAoHELxFMPSY=",
"origin": "github.com/mitchellh/packer/vendor/github.com/dylanmei/winrmtest",
"path": "github.com/dylanmei/winrmtest",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "pP0b9eRHl4ZFD4zTcWxTZH4CPq0=",
"origin": "github.com/mitchellh/packer/vendor/github.com/hashicorp/errwrap",
"path": "github.com/hashicorp/errwrap",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "DvGmf2sDyNBK6H8PhlmJZFKwEBw=",
"origin": "github.com/mitchellh/packer/vendor/github.com/hashicorp/go-multierror",
"path": "github.com/hashicorp/go-multierror",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "EpQtumfEmrEF/8SXn+Y255E/Cuo=",
"origin": "github.com/mitchellh/packer/vendor/github.com/hashicorp/go-version",
"path": "github.com/hashicorp/go-version",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "Is4tKxuLcbiLzEG5LpwkkTpeCpw=",
"origin": "github.com/mitchellh/packer/vendor/github.com/hashicorp/yamux",
"path": "github.com/hashicorp/yamux",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "nvGuYn0dr8PhD6jFH9N/VGJQ2gg=",
"origin": "github.com/mitchellh/packer/vendor/github.com/kr/fs",
"path": "github.com/kr/fs",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "Qj0//kmojTaaIA4fUUwvwoCuTuU=",
"origin": "github.com/mitchellh/packer/vendor/github.com/masterzen/simplexml/dom",
"path": "github.com/masterzen/simplexml/dom",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "zVaCiA60yAnMfm1rrac8fyineGs=",
"origin": "github.com/mitchellh/packer/vendor/github.com/masterzen/winrm/soap",
"path": "github.com/masterzen/winrm/soap",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "NIaCaW5FywMpF9vzWmB70dFv9RM=",
"origin": "github.com/mitchellh/packer/vendor/github.com/masterzen/winrm/winrm",
"path": "github.com/masterzen/winrm/winrm",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "DW4478al92N1vZEBQVHFRFjj7EY=",
"origin": "github.com/mitchellh/packer/vendor/github.com/masterzen/xmlpath",
"path": "github.com/masterzen/xmlpath",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "m1hOjbN3vFl5y+g515lDeYqWanA=",
"origin": "github.com/mitchellh/packer/vendor/github.com/mitchellh/go-fs",
"path": "github.com/mitchellh/go-fs",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "Ag1vNLT2WjhlrDv9roDfMO1zG0w=",
"origin": "github.com/mitchellh/packer/vendor/github.com/mitchellh/go-fs/fat",
"path": "github.com/mitchellh/go-fs/fat",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "2N4BljlHw470zqjKVMcK1uL38bk=",
"origin": "github.com/mitchellh/packer/vendor/github.com/mitchellh/iochan",
"path": "github.com/mitchellh/iochan",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "OfuWpFpWCTAM9dfbhxjz5JMx2bQ=",
"origin": "github.com/mitchellh/packer/vendor/github.com/mitchellh/mapstructure",
"path": "github.com/mitchellh/mapstructure",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "pCCSJoPXp4dvTFsioPp+lHUDRok=",
"origin": "github.com/mitchellh/packer/vendor/github.com/mitchellh/multistep",
"path": "github.com/mitchellh/multistep",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "91TcWpkNmv98Z4x+VKc2RM5TAwA=",
"path": "github.com/mitchellh/packer/common",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "uid6VWkpioHmt2A0gfQ56tXRKA0=",
"path": "github.com/mitchellh/packer/common/ssh",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "Dim3j68HeCZW/z53YV8Ha2sqQQ8=",
"path": "github.com/mitchellh/packer/common/uuid",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "ddX9sYvka2TrVT/2ToPvo0F4saU=",
"path": "github.com/mitchellh/packer/communicator/none",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "Bth1PTz8VFL2rQTWOtdURNfeHko=",
"path": "github.com/mitchellh/packer/communicator/ssh",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "02wyrAeOs4VfgDoeloUgHjC3U18=",
"path": "github.com/mitchellh/packer/communicator/winrm",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "xiBFWwHgaq0DcpaS8WKtKrX27hc=",
"path": "github.com/mitchellh/packer/helper/builder/testing",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "31TuTMlyGrcnrJXurB8YLuS+MMM=",
"path": "github.com/mitchellh/packer/helper/communicator",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "7Dd7niSNVBa3fFrHETUIyYJCrn4=",
"path": "github.com/mitchellh/packer/helper/config",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "VwUOgwgtLknXJwL9AqEAC6kiA7w=",
"path": "github.com/mitchellh/packer/packer",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "aYwAUqfUFJynx6YxW2B4V337qAY=",
"path": "github.com/mitchellh/packer/packer/plugin",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "hZpkPUJejlckkcmGs+4STwpNwFk=",
"path": "github.com/mitchellh/packer/packer/rpc",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "+J1UFwomaURMZH/zb6oJlym5YIM=",
"path": "github.com/mitchellh/packer/template",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "JdcKa934mDV2lGKdPIsO2I521Nk=",
"path": "github.com/mitchellh/packer/template/interpolate",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "zATM6foYk5+zTcGobwO35SK7a90=",
"origin": "github.com/mitchellh/packer/vendor/github.com/mitchellh/reflectwalk",
"path": "github.com/mitchellh/reflectwalk",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "jTwXALBikWAgWtFJtfN5IBQLK0E=",
"origin": "github.com/mitchellh/packer/vendor/github.com/nu7hatch/gouuid",
"path": "github.com/nu7hatch/gouuid",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "IWV8ksuLYseXhyqMbrwRA1BFtSs=",
"origin": "github.com/mitchellh/packer/vendor/github.com/packer-community/winrmcp/winrmcp",
"path": "github.com/packer-community/winrmcp/winrmcp",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "vHYHm7ZgmhroBZ+YCKZX9LQWu8A=",
"origin": "github.com/mitchellh/packer/vendor/github.com/pkg/sftp",
"path": "github.com/pkg/sftp",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "gcEMcYxY1rLvGi5DU8CeIPHR/vE=",
"origin": "github.com/mitchellh/packer/vendor/github.com/satori/go.uuid",
"path": "github.com/satori/go.uuid",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "POPK0OfIbZKdUNJ38bbRG+ayfXs=",
"origin": "github.com/mitchellh/packer/vendor/github.com/ugorji/go/codec",
"path": "github.com/ugorji/go/codec",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "v4e3DAqDKcsgzKJoUQk9V48jWds=",
"origin": "github.com/mitchellh/packer/vendor/golang.org/x/crypto/curve25519",
"path": "golang.org/x/crypto/curve25519",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "iYX0qfJmLIrOjgXpCvQOtWnQ1qY=",
"origin": "github.com/mitchellh/packer/vendor/golang.org/x/crypto/ssh",
"path": "golang.org/x/crypto/ssh",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
},
{
"checksumSHA1": "q+/wYnZutlwGt9E+vKStbj7k8HM=",
"origin": "github.com/mitchellh/packer/vendor/golang.org/x/crypto/ssh/agent",
"path": "golang.org/x/crypto/ssh/agent",
"revision": "4e5f65131b5491ab44ff8aa0626abe4a85597ac0",
"revisionTime": "2016-05-07T07:19:36Z"
}
],
"rootPath": "github.com/axsh/wakame-vdc/client/packer-builder-wakamevdc"
}