From 42804258d81f359e00156237fefd9252184bc52f Mon Sep 17 00:00:00 2001 From: pengli Date: Fri, 1 May 2020 08:10:12 +0800 Subject: [PATCH] Correct the message for "step" failed in "taskrun" Fix issue: #2518 --- pkg/pod/status.go | 2 +- pkg/pod/status_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/pod/status.go b/pkg/pod/status.go index 36e56205da8..67e952b053d 100644 --- a/pkg/pod/status.go +++ b/pkg/pod/status.go @@ -287,7 +287,7 @@ func getFailureMessage(pod *corev1.Pod) string { term := status.State.Terminated if term != nil && term.ExitCode != 0 { // Newline required at end to prevent yaml parser from breaking the log help text at 80 chars - return fmt.Sprintf(`%q exited with code %d (image: %q); for logs run: kubectl -n %s logs %s -c %s\n`, + return fmt.Sprintf("%q exited with code %d (image: %q); for logs run: kubectl -n %s logs %s -c %s\n", status.Name, term.ExitCode, status.ImageID, pod.Namespace, pod.Name, status.Name) } diff --git a/pkg/pod/status_test.go b/pkg/pod/status_test.go index d8b4cd6bde0..333517f8f74 100644 --- a/pkg/pod/status_test.go +++ b/pkg/pod/status_test.go @@ -215,7 +215,7 @@ func TestMakeTaskRunStatus(t *testing.T) { Type: apis.ConditionSucceeded, Status: corev1.ConditionFalse, Reason: ReasonFailed, - Message: `"step-failure" exited with code 123 (image: "image-id"); for logs run: kubectl -n foo logs pod -c step-failure\n`, + Message: "\"step-failure\" exited with code 123 (image: \"image-id\"); for logs run: kubectl -n foo logs pod -c step-failure\n", }}, }, TaskRunStatusFields: v1alpha1.TaskRunStatusFields{ @@ -653,7 +653,7 @@ func TestMakeTaskRunStatus(t *testing.T) { Type: apis.ConditionSucceeded, Status: corev1.ConditionFalse, Reason: ReasonFailed, - Message: `"step-non-json" exited with code 1 (image: "image"); for logs run: kubectl -n foo logs pod -c step-non-json\n`, + Message: "\"step-non-json\" exited with code 1 (image: \"image\"); for logs run: kubectl -n foo logs pod -c step-non-json\n", }}, }, TaskRunStatusFields: v1alpha1.TaskRunStatusFields{