diff --git a/Makefile b/Makefile index 87386533c..ef05d62ca 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,8 @@ all: go get -d -v ./... @echo "$(OK_COLOR)--> Compiling Packer...$(NO_COLOR)" go build -v -o bin/packer + @echo "$(OK_COLOR)--> Compiling Builder: Amazon EBS...$(NO_COLOR)" + $(MAKE) -C plugin/builder-amazon-ebs @echo "$(OK_COLOR)--> Compiling Command: Build...$(NO_COLOR)" $(MAKE) -C plugin/command-build diff --git a/builder/amazon/builder.go b/builder/amazon/builder.go deleted file mode 100644 index 27a47afbc..000000000 --- a/builder/amazon/builder.go +++ /dev/null @@ -1,22 +0,0 @@ -package amazon - -type config struct { - AccessKey string - Region string - SecretKey string - SourceAmi string -} - -type Builder struct { - config config -} - -func (b *Builder) ConfigInterface() interface{} { - return &b.config -} - -func (*Builder) Prepare() { -} - -func (b *Builder) Build() { -} diff --git a/builder/amazonebs/builder.go b/builder/amazonebs/builder.go new file mode 100644 index 000000000..d807b53ac --- /dev/null +++ b/builder/amazonebs/builder.go @@ -0,0 +1,20 @@ +package amazonebs + +import ( + "github.com/mitchellh/packer/packer" +) + +type config struct { + AccessKey string + Region string + SecretKey string + SourceAmi string +} + +type Builder struct { + config config +} + +func (*Builder) Prepare(interface{}) {} + +func (*Builder) Run(packer.Build, packer.Ui) {} diff --git a/builder/amazonebs/builder_test.go b/builder/amazonebs/builder_test.go new file mode 100644 index 000000000..47f96fc79 --- /dev/null +++ b/builder/amazonebs/builder_test.go @@ -0,0 +1,14 @@ +package amazonebs + +import ( + "cgl.tideland.biz/asserts" + "github.com/mitchellh/packer/packer" + "testing" +) + +func TestBuilder_ImplementsBuilder(t *testing.T) { + assert := asserts.NewTestingAsserts(t, true) + + var actual packer.Builder + assert.Implementor(&Builder{}, &actual, "should be a Builder") +} diff --git a/plugin/builder-amazon-ebs/Makefile b/plugin/builder-amazon-ebs/Makefile new file mode 100644 index 000000000..729870e83 --- /dev/null +++ b/plugin/builder-amazon-ebs/Makefile @@ -0,0 +1,15 @@ +PLUGIN_NAME=packer-builder-amazon-ebs + +plugin: + go get -d -v ./... + go build -v -o $(ROOTDIR)/bin/$(PLUGIN_NAME) + +format: + go fmt ./... + +test: + @go list -f '{{range .TestImports}}{{.}}\ + {{end}}' ./... | xargs -n1 go get -d + go test ./... + +.PHONY: all format test diff --git a/plugin/builder-amazon-ebs/main.go b/plugin/builder-amazon-ebs/main.go new file mode 100644 index 000000000..38c9c4028 --- /dev/null +++ b/plugin/builder-amazon-ebs/main.go @@ -0,0 +1,10 @@ +package main + +import ( + "github.com/mitchellh/packer/builder/amazonebs" + "github.com/mitchellh/packer/packer/plugin" +) + +func main() { + plugin.ServeBuilder(new(amazonebs.Builder)) +}