diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go index b6cee5843..b9affaaaa 100644 --- a/pkg/cmd/install.go +++ b/pkg/cmd/install.go @@ -38,6 +38,7 @@ import ( "helm.sh/helm/v4/pkg/cmd/require" "helm.sh/helm/v4/pkg/downloader" "helm.sh/helm/v4/pkg/getter" + "helm.sh/helm/v4/pkg/kube" release "helm.sh/helm/v4/pkg/release/v1" ) @@ -157,6 +158,8 @@ func newInstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { } client.DryRunStrategy = dryRunStrategy + printWaitMessage(out, outfmt, client.WaitStrategy, client.Timeout) + rel, err := runInstall(args, client, valueOpts, out) if err != nil { return fmt.Errorf("INSTALLATION FAILED: %w", err) @@ -370,6 +373,13 @@ func checkIfInstallable(ch chart.Accessor) error { return fmt.Errorf("%s charts are not installable", meta["Type"]) } +func printWaitMessage(out io.Writer, outfmt output.Format, strategy kube.WaitStrategy, timeout time.Duration) { + if outfmt != output.Table || strategy == kube.HookOnlyStrategy { + return + } + fmt.Fprintf(out, "Waiting for resources to become ready (timeout: %s)\n", timeout) +} + // Provide dynamic auto-completion for the install and template commands func compInstall(args []string, toComplete string, client *action.Install) ([]string, cobra.ShellCompDirective) { requiredArgs := 1 diff --git a/pkg/cmd/testdata/output/install-with-wait-for-jobs.txt b/pkg/cmd/testdata/output/install-with-wait-for-jobs.txt index c5676c610..67e223847 100644 --- a/pkg/cmd/testdata/output/install-with-wait-for-jobs.txt +++ b/pkg/cmd/testdata/output/install-with-wait-for-jobs.txt @@ -1,3 +1,4 @@ +Waiting for resources to become ready (timeout: 5m0s) NAME: apollo LAST DEPLOYED: Fri Sep 2 22:04:05 1977 NAMESPACE: default diff --git a/pkg/cmd/testdata/output/install-with-wait.txt b/pkg/cmd/testdata/output/install-with-wait.txt index c5676c610..67e223847 100644 --- a/pkg/cmd/testdata/output/install-with-wait.txt +++ b/pkg/cmd/testdata/output/install-with-wait.txt @@ -1,3 +1,4 @@ +Waiting for resources to become ready (timeout: 5m0s) NAME: apollo LAST DEPLOYED: Fri Sep 2 22:04:05 1977 NAMESPACE: default diff --git a/pkg/cmd/testdata/output/upgrade-with-wait-for-jobs.txt b/pkg/cmd/testdata/output/upgrade-with-wait-for-jobs.txt index 21784413c..44524d8df 100644 --- a/pkg/cmd/testdata/output/upgrade-with-wait-for-jobs.txt +++ b/pkg/cmd/testdata/output/upgrade-with-wait-for-jobs.txt @@ -1,3 +1,4 @@ +Waiting for resources to become ready (timeout: 5m0s) Release "crazy-bunny" has been upgraded. Happy Helming! NAME: crazy-bunny LAST DEPLOYED: Fri Sep 2 22:04:05 1977 diff --git a/pkg/cmd/testdata/output/upgrade-with-wait.txt b/pkg/cmd/testdata/output/upgrade-with-wait.txt index 21784413c..44524d8df 100644 --- a/pkg/cmd/testdata/output/upgrade-with-wait.txt +++ b/pkg/cmd/testdata/output/upgrade-with-wait.txt @@ -1,3 +1,4 @@ +Waiting for resources to become ready (timeout: 5m0s) Release "crazy-bunny" has been upgraded. Happy Helming! NAME: crazy-bunny LAST DEPLOYED: Fri Sep 2 22:04:05 1977 diff --git a/pkg/cmd/upgrade.go b/pkg/cmd/upgrade.go index 688842141..3df130b3c 100644 --- a/pkg/cmd/upgrade.go +++ b/pkg/cmd/upgrade.go @@ -163,6 +163,8 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { instClient.Replace = true } + printWaitMessage(out, outfmt, instClient.WaitStrategy, instClient.Timeout) + rel, err := runInstall(args, instClient, valueOpts, out) if err != nil { return err @@ -257,6 +259,8 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { cancel() }() + printWaitMessage(out, outfmt, client.WaitStrategy, client.Timeout) + rel, err := client.RunWithContext(ctx, args[0], ch, vals) if err != nil { return fmt.Errorf("UPGRADE FAILED: %w", err)