Skip to content

Print waiting message when --wait is used for install/upgrade#32019

Open
johnlinp wants to merge 1 commit intohelm:mainfrom
johnlinp:add-wait-message
Open

Print waiting message when --wait is used for install/upgrade#32019
johnlinp wants to merge 1 commit intohelm:mainfrom
johnlinp:add-wait-message

Conversation

@johnlinp
Copy link
Copy Markdown

@johnlinp johnlinp commented Apr 8, 2026

Closes #12710

Signed-off-by: John Lin johnlinp@gmail.com

What this PR does / why we need it:

This PR adds a user-facing progress message for helm install --wait and helm upgrade --wait.

Today, Helm can appear to stall after printing earlier output such as dependency update messages, because there is no explicit indication that it has entered the resource-wait phase. This change prints Waiting for resources to become ready... before the blocking wait begins, so users have clearer feedback about what Helm is doing.

Special notes for your reviewer:

This intentionally changes the default table output for install and upgrade when --wait is used.

A Helm maintainer previously noted in the issue discussion that the main concern was changing command output that some users may consume from scripts, and that a Helm v4-targeted PR would be welcome:
#12710 (comment)

If that is considered too compatibility-sensitive for Helm v4.x, I'm happy to rework this behind a gate or defer it to the next major release.

If applicable:

  • this PR contains user facing changes (the docs needed label should be applied if so)
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

Copilot AI review requested due to automatic review settings April 8, 2026 16:54
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 8, 2026
Closes helm#12710

Signed-off-by: John Lin <johnlinp@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a user-facing progress line when helm install --wait / helm upgrade --wait enters the blocking resource-wait phase, addressing the “looks stalled” UX reported in #12710.

Changes:

  • Print Waiting for resources to become ready (timeout: …) before the wait begins for upgrade (table output).
  • Add a printWaitMessage helper and call it from the install flow.
  • Update golden test outputs for install/upgrade wait scenarios.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/cmd/upgrade.go Prints a wait/progress line for table output before running the upgrade when --wait is in effect.
pkg/cmd/install.go Adds printWaitMessage helper and prints the wait/progress line in the shared install execution path.
pkg/cmd/testdata/output/upgrade-with-wait.txt Updates expected output to include the new wait/progress line.
pkg/cmd/testdata/output/upgrade-with-wait-for-jobs.txt Updates expected output to include the new wait/progress line.
pkg/cmd/testdata/output/install-with-wait.txt Updates expected output to include the new wait/progress line.
pkg/cmd/testdata/output/install-with-wait-for-jobs.txt Updates expected output to include the new wait/progress line.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +328 to +329
printWaitMessage(out, client.WaitStrategy, client.Timeout)

Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

printWaitMessage writes directly to out unconditionally (except for hookOnly). Since install supports -o json|yaml, this will prepend a plain-text line and corrupt machine-readable output when users run e.g. helm install --wait -o json (and also affects upgrade --install and template, which both reuse runInstall). Consider gating this message on outfmt == output.Table (like upgrade.go already does) and/or only enabling it for the actual install/upgrade commands (not template), and add a unit test that asserts JSON output remains valid with --wait enabled.

Suggested change
printWaitMessage(out, client.WaitStrategy, client.Timeout)
// Do not print wait progress here: runInstall is shared by commands that
// may produce machine-readable output, and writing plain text to `out`
// would corrupt JSON/YAML responses.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@utafrali utafrali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, focused change that solves a real UX pain point. The logic is correct, tests are included, and the output-format guard in upgrade.go is consistent with surrounding code. Two minor style points around symmetry and function placement, neither of which blocks merging.

cancel()
}()

printWaitMessage(out, client.WaitStrategy, client.Timeout)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

printWaitMessage is called here without an output-format guard, while upgrade.go wraps the same call in if outfmt == output.Table. Since install is always table-only this makes no practical difference, but the inconsistency could confuse future maintainers. Consider adding the same guard here for symmetry, or add a comment explaining why the guard is intentionally omitted.

return fmt.Errorf("%s charts are not installable", meta["Type"])
}

func printWaitMessage(out io.Writer, strategy kube.WaitStrategy, timeout time.Duration) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

printWaitMessage is defined in install.go but is also called from upgrade.go. In Go this works fine within the same package, but a helper shared by two sibling command files is more naturally home in a small shared file (e.g. pkg/cmd/common.go or similar) so readers of upgrade.go can find it without hunting. Not a blocker, just a discoverability concern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Print waiting message when --wait is used for install/upgrade

3 participants