From 45be673c0f09684b4f9d3e4361000f709e582e7f Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 28 May 2020 11:34:00 -0700 Subject: [PATCH] move this to after the prepare() is successful so that we don't try to run builds that didn't prepare successfully. --- packer/core.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packer/core.go b/packer/core.go index 011a21a96..fcbc3904a 100644 --- a/packer/core.go +++ b/packer/core.go @@ -215,7 +215,6 @@ func (c *Core) GetBuilds(opts GetBuildsOptions) ([]Build, hcl.Diagnostics) { }) continue } - builds = append(builds, b) // Now that build plugin has been launched, call Prepare() log.Printf("Preparing build: %s", b.Name()) @@ -233,6 +232,9 @@ func (c *Core) GetBuilds(opts GetBuildsOptions) ([]Build, hcl.Diagnostics) { continue } + // Only append builds to list if the Prepare() is successful. + builds = append(builds, b) + if len(warnings) > 0 { for _, warning := range warnings { diags = append(diags, &hcl.Diagnostic{