Skip to content

Commit 5d0c974

Browse files
committed
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 <hidde@hhh.computer>
1 parent 2643d87 commit 5d0c974

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/controller/helmrelease_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ func (r *HelmReleaseReconciler) handleHelmActionResult(ctx context.Context,
715715
err = fmt.Errorf("Helm %s failed: %w", action, err)
716716
msg := err.Error()
717717
if actionErr := (*runner.ActionError)(nil); errors.As(err, &actionErr) {
718-
msg = msg + "\n\nLast Helm logs:\n\n" + actionErr.CapturedLogs
718+
msg = strings.TrimSpace(msg) + "\n\nLast Helm logs:\n\n" + actionErr.CapturedLogs
719719
}
720720
newCondition := metav1.Condition{
721721
Type: condition,

0 commit comments

Comments
 (0)