From 1ab8dab707e321a80073956125d33ce126b4496c Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Wed, 8 May 2019 10:15:39 -0700 Subject: [PATCH 1/3] remove windows and linux builds from travis, since we do those on circle now. --- .travis.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index f814f1298..e917d39c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,6 @@ env: - USER=travis GO111MODULE=off os: - - windows - - linux - osx sudo: false @@ -13,12 +11,6 @@ language: go go: - 1.12.x -before_install: - - > - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; - then choco install -y make; - fi - script: - df -h - make ci @@ -28,6 +20,4 @@ branches: - master matrix: - allow_failures: - - os: windows fast_finish: true From cdd244339ba8401e3cb7d07baf52d811a6f5f64a Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Fri, 10 May 2019 09:41:03 -0700 Subject: [PATCH 2/3] add wait so osx builds dont time out --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e917d39c1..0696a6ad4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ go: script: - df -h - - make ci + - travis_wait make ci branches: only: From 70c223045ee39d7fd93768dde33243d99a9d9605 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Fri, 10 May 2019 10:25:54 -0700 Subject: [PATCH 3/3] fix race condition in hooks --- packer/rpc/hook.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packer/rpc/hook.go b/packer/rpc/hook.go index e4e804839..c5ac329f6 100644 --- a/packer/rpc/hook.go +++ b/packer/rpc/hook.go @@ -4,6 +4,7 @@ import ( "context" "log" "net/rpc" + "sync" "github.com/hashicorp/packer/packer" ) @@ -22,6 +23,7 @@ type HookServer struct { contextCancel func() hook packer.Hook + lock sync.Mutex mux *muxBroker } @@ -67,9 +69,11 @@ func (h *HookServer) Run(args *HookRunArgs, reply *interface{}) error { } defer client.Close() + h.lock.Lock() if h.context == nil { h.context, h.contextCancel = context.WithCancel(context.Background()) } + h.lock.Unlock() if err := h.hook.Run(h.context, args.Name, client.Ui(), client.Communicator(), args.Data); err != nil { return NewBasicError(err) } @@ -79,8 +83,10 @@ func (h *HookServer) Run(args *HookRunArgs, reply *interface{}) error { } func (h *HookServer) Cancel(args *interface{}, reply *interface{}) error { + h.lock.Lock() if h.contextCancel != nil { h.contextCancel() } + h.lock.Unlock() return nil }