Commit 04563764 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

`packer build` now communicates through RPC!

parent 91ade277
......@@ -3,6 +3,8 @@ OK_COLOR=\x1b[32;01m
ERROR_COLOR=\x1b[31;01m
WARN_COLOR=\x1b[33;01m
export ROOTDIR=$(CURDIR)
all:
@mkdir -p bin/
go get -d -v ./...
......
......@@ -3,12 +3,18 @@ package main
import (
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer/plugin"
"fmt"
"os"
"os/exec"
)
func main() {
envConfig := packer.DefaultEnvironmentConfig()
envConfig.Commands = []string{"build"}
envConfig.CommandFunc = func(n string) packer.Command {
return plugin.Command(exec.Command("bin/packer-build"))
}
env, err := packer.NewEnvironment(envConfig)
if err != nil {
......
......@@ -11,7 +11,13 @@ import (
)
func Command(cmd *exec.Cmd) packer.Command {
env := []string{
"PACKER_PLUGIN_MIN_PORT=10000",
"PACKER_PLUGIN_MAX_PORT=25000",
}
out := new(bytes.Buffer)
cmd.Env = append(cmd.Env, env...)
cmd.Stdout = out
cmd.Start()
......
plugin:
go get -d -v ./...
go build -v -o $(CURDIR)/bin/packer-build
go build -v -o $(ROOTDIR)/bin/packer-build
format:
go fmt ./...
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment