fix the initilization for trait in output section (#6762)

Signed-off-by: Shivin Gopalani <gopalanishivin@gmail.com>
This commit is contained in:
PushparajShetty
2025-04-18 10:21:54 +05:30
committed by GitHub
parent fb17af5e75
commit 262daacb63
+3 -1
View File
@@ -133,12 +133,14 @@ func buildTemplateFromYAML(templateYAML string, def *pkgdef.Definition) error {
process.OutputsFieldName: map[string]interface{}{},
process.ParameterFieldName: map[string]interface{}{},
}
kind := def.GetKind()
for index, yamlString := range yamlStrings {
var yamlObject map[string]interface{}
if err = yaml.Unmarshal([]byte(yamlString), &yamlObject); err != nil {
return errors.Wrapf(err, "failed to unmarshal template yaml file")
}
if index == 0 {
if index == 0 && kind != v1beta1.TraitDefinitionKind {
templateObject[process.OutputFieldName] = yamlObject
} else {
name, _, _ := unstructured.NestedString(yamlObject, "metadata", "name")