diff --git a/internal/workload/v1/manifests/manifest.go b/internal/workload/v1/manifests/manifest.go index 3be685a..a6e10a9 100644 --- a/internal/workload/v1/manifests/manifest.go +++ b/internal/workload/v1/manifests/manifest.go @@ -62,18 +62,19 @@ func (manifest *Manifest) ExtractManifests() []string { var content string - for _, line := range lines { - if strings.TrimRight(line, " ") == "---" { + for i := range lines { + if strings.TrimRight(lines[i], " ") == "---" { if content != "" { manifests = append(manifests, content) content = "" } } else { - content = content + "\n" + line + content = content + "\n" + lines[i] } } - if content != "" { + // ensure content is not empty before appending it to the manifests slice + if strings.TrimSpace(content) != "" { manifests = append(manifests, content) } diff --git a/test/cases/edge-standalone/.workloadConfig/resources.yaml b/test/cases/edge-standalone/.workloadConfig/resources.yaml index 382e51c..ba448a2 100644 --- a/test/cases/edge-standalone/.workloadConfig/resources.yaml +++ b/test/cases/edge-standalone/.workloadConfig/resources.yaml @@ -157,3 +157,6 @@ spec: requests.memory: 4Gi limits.cpu: "4" limits.memory: 4Gi +# test the trailing yaml separator +# see https://github.com/nukleros/operator-builder/issues/53 +--- \ No newline at end of file