From baabc99809fd2d13595c63393c69c1ef28709758 Mon Sep 17 00:00:00 2001 From: Nayana Hettiarachchi Date: Sun, 18 Sep 2022 13:41:26 +0700 Subject: [PATCH 1/4] #11375 isplay the content that has the error for easy troubleshoting Signed-off-by: Nayana Hettiarachchi --- pkg/releaseutil/manifest_sorter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/releaseutil/manifest_sorter.go b/pkg/releaseutil/manifest_sorter.go index e83414500..522b6625f 100644 --- a/pkg/releaseutil/manifest_sorter.go +++ b/pkg/releaseutil/manifest_sorter.go @@ -143,7 +143,7 @@ func (file *manifestFile) sort(result *result) error { var entry SimpleHead if err := yaml.Unmarshal([]byte(m), &entry); err != nil { - return errors.Wrapf(err, "YAML parse error on %s", file.path) + return errors.Wrapf(err, "YAML parse error on %s contents: \n %s", file.path, m) } if !hasAnyAnnotation(entry) { From dcdcb5a46fbb614613f1e45c92e657b58f258f77 Mon Sep 17 00:00:00 2001 From: Nayana Hettiarachchi Date: Sun, 18 Sep 2022 14:42:14 +0700 Subject: [PATCH 2/4] #11375 fix broken tests due to change in output Signed-off-by: Nayana Hettiarachchi --- .../output/template-with-invalid-yaml-debug.txt | 12 +++++++++++- .../testdata/output/template-with-invalid-yaml.txt | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/cmd/helm/testdata/output/template-with-invalid-yaml-debug.txt b/cmd/helm/testdata/output/template-with-invalid-yaml-debug.txt index 909c543d3..e930a2598 100644 --- a/cmd/helm/testdata/output/template-with-invalid-yaml-debug.txt +++ b/cmd/helm/testdata/output/template-with-invalid-yaml-debug.txt @@ -10,4 +10,14 @@ spec: image: "alpine:3.9" command: ["/bin/sleep","9000"] invalid -Error: YAML parse error on chart-with-template-with-invalid-yaml/templates/alpine-pod.yaml: error converting YAML to JSON: yaml: line 11: could not find expected ':' +Error: YAML parse error on chart-with-template-with-invalid-yaml/templates/alpine-pod.yaml contents: + apiVersion: v1 +kind: Pod +metadata: + name: "release-name-my-alpine" +spec: + containers: + - name: waiter + image: "alpine:3.9" + command: ["/bin/sleep","9000"] +invalid: error converting YAML to JSON: yaml: line 11: could not find expected ':' diff --git a/cmd/helm/testdata/output/template-with-invalid-yaml.txt b/cmd/helm/testdata/output/template-with-invalid-yaml.txt index 687227b90..b2d20e8b8 100644 --- a/cmd/helm/testdata/output/template-with-invalid-yaml.txt +++ b/cmd/helm/testdata/output/template-with-invalid-yaml.txt @@ -1,3 +1,13 @@ -Error: YAML parse error on chart-with-template-with-invalid-yaml/templates/alpine-pod.yaml: error converting YAML to JSON: yaml: line 11: could not find expected ':' +Error: YAML parse error on chart-with-template-with-invalid-yaml/templates/alpine-pod.yaml contents: +apiVersion: v1 +kind: Pod +metadata: + name: "release-name-my-alpine" +spec: + containers: + - name: waiter + image: "alpine:3.9" + command: ["/bin/sleep","9000"] +invalid: error converting YAML to JSON: yaml: line 11: could not find expected ':' Use --debug flag to render out invalid YAML From 7666143f7eea0144f5527eadd731d14ad33e51af Mon Sep 17 00:00:00 2001 From: Nayana Hettiarachchi Date: Sun, 18 Sep 2022 14:51:00 +0700 Subject: [PATCH 3/4] #11375 fix extra whitespace on result file Signed-off-by: Nayana Hettiarachchi --- cmd/helm/testdata/output/template-with-invalid-yaml-debug.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/testdata/output/template-with-invalid-yaml-debug.txt b/cmd/helm/testdata/output/template-with-invalid-yaml-debug.txt index e930a2598..9125b19da 100644 --- a/cmd/helm/testdata/output/template-with-invalid-yaml-debug.txt +++ b/cmd/helm/testdata/output/template-with-invalid-yaml-debug.txt @@ -11,7 +11,7 @@ spec: command: ["/bin/sleep","9000"] invalid Error: YAML parse error on chart-with-template-with-invalid-yaml/templates/alpine-pod.yaml contents: - apiVersion: v1 +apiVersion: v1 kind: Pod metadata: name: "release-name-my-alpine" From 750dfae8db282cd65e196958b5ceb6a4adeca431 Mon Sep 17 00:00:00 2001 From: Nayana Hettiarachchi Date: Sun, 18 Sep 2022 16:35:45 +0700 Subject: [PATCH 4/4] #11375 fix broken tests Signed-off-by: Nayana Hettiarachchi --- pkg/releaseutil/manifest_sorter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/releaseutil/manifest_sorter.go b/pkg/releaseutil/manifest_sorter.go index 522b6625f..fca5ce9b7 100644 --- a/pkg/releaseutil/manifest_sorter.go +++ b/pkg/releaseutil/manifest_sorter.go @@ -143,7 +143,7 @@ func (file *manifestFile) sort(result *result) error { var entry SimpleHead if err := yaml.Unmarshal([]byte(m), &entry); err != nil { - return errors.Wrapf(err, "YAML parse error on %s contents: \n %s", file.path, m) + return errors.Wrapf(err, "YAML parse error on %s contents:\n%s", file.path, m) } if !hasAnyAnnotation(entry) {