From ccb5a22bb41b039c896c31ba4b68a65ac45f2f9a Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Thu, 17 Nov 2022 08:50:01 -0500 Subject: [PATCH] hcp: remove duplicated build registration for JSON In JSON templates, we register the builds to process on HCP at the initialisation of the Registry. However, during the HCP breakout, this code was duplicated with a slight difference for the JSON templates, and the build names were registered once during initialisation, with the expected full name, and once at the start of PopulateIteration, with the truncated name. This caused a bug when processing a template that contains a builder with both a name and a type, as both would be registered, but only one would complete, leading to the iteration being unable to complete. --- internal/hcp/registry/json.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/internal/hcp/registry/json.go b/internal/hcp/registry/json.go index 20a389252..a5aced955 100644 --- a/internal/hcp/registry/json.go +++ b/internal/hcp/registry/json.go @@ -38,11 +38,6 @@ func NewJSONMetadataRegistry(config *packer.Core) (*JSONMetadataRegistry, hcl.Di // PopulateIteration creates the metadata on HCP for a build func (h *JSONMetadataRegistry) PopulateIteration(ctx context.Context) error { - for _, b := range h.configuration.Template.Builders { - // Get all builds slated within config ignoring any only or exclude flags. - h.bucket.RegisterBuildForComponent(b.Name) - } - err := h.bucket.Validate() if err != nil { return err