From 1aa739028d4fc07dbfe3054547c3280fe568d18f Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Mon, 11 Sep 2023 13:47:24 +0200 Subject: [PATCH] controller: strip newlines from Helm error message To prevent spurious newlines between the error message and the captured logs, as at times Helm ends error with one or multiple newlines. Signed-off-by: Hidde Beydals --- internal/controller/helmrelease_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/controller/helmrelease_controller.go b/internal/controller/helmrelease_controller.go index afd58a6a2..fa96e5cac 100644 --- a/internal/controller/helmrelease_controller.go +++ b/internal/controller/helmrelease_controller.go @@ -715,7 +715,7 @@ func (r *HelmReleaseReconciler) handleHelmActionResult(ctx context.Context, err = fmt.Errorf("Helm %s failed: %w", action, err) msg := err.Error() if actionErr := (*runner.ActionError)(nil); errors.As(err, &actionErr) { - msg = msg + "\n\nLast Helm logs:\n\n" + actionErr.CapturedLogs + msg = strings.TrimSpace(msg) + "\n\nLast Helm logs:\n\n" + actionErr.CapturedLogs } newCondition := metav1.Condition{ Type: condition,