From 1991f07e85bfb0a5e0e013142dcc650db5110955 Mon Sep 17 00:00:00 2001 From: dsagar Date: Fri, 18 Feb 2022 09:47:08 -0800 Subject: [PATCH] fix(2646): Deep copy parent build meta before deleting the parameters --- launch.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/launch.go b/launch.go index e16055a..8b61d27 100644 --- a/launch.go +++ b/launch.go @@ -310,8 +310,15 @@ func SetExternalMeta(api screwdriver.API, pipelineID, parentBuildID int, mergedM externalMetaFile := "sd@" + strconv.Itoa(parentJob.PipelineID) + ":" + parentJob.Name + ".json" writeMetafile(metaSpace, externalMetaFile, metaLog, parentBuild.Meta) if join { + marshallValue, err := json.Marshal(parentBuild.Meta) + if err != nil { + return resultMeta, fmt.Errorf("Cloning meta of Parent Build ID %d: %v", parentBuildID, err) + } + var externalParentBuildMeta map[string]interface{} + json.Unmarshal(marshallValue, &externalParentBuildMeta) + // Always exclude parameters from external meta - delete(parentBuild.Meta, "parameters") + delete(externalParentBuildMeta, "parameters") resultMeta = deepMergeJSON(resultMeta, parentBuild.Meta) }