From 5421280a2b19836be1b3a24190cc099e2ae64348 Mon Sep 17 00:00:00 2001 From: Johannes Hertenstein Date: Fri, 11 Jun 2021 11:56:07 +0200 Subject: [PATCH] Add hint to missing dependency message Signed-off-by: Johannes Hertenstein --- cmd/helm/install.go | 1 + cmd/helm/testdata/output/upgrade-with-missing-dependencies.txt | 2 +- cmd/helm/upgrade.go | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 04419d730..ae02165cb 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -214,6 +214,7 @@ func runInstall(args []string, client *action.Install, valueOpts *values.Options // As of Helm 2.4.0, this is treated as a stopping condition: // https://github.com/helm/helm/issues/2209 if err := action.CheckDependencies(chartRequested, req); err != nil { + err = errors.Wrap(err, "An error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies") if client.DependencyUpdate { man := &downloader.Manager{ Out: out, diff --git a/cmd/helm/testdata/output/upgrade-with-missing-dependencies.txt b/cmd/helm/testdata/output/upgrade-with-missing-dependencies.txt index de62e1d2a..adf2ae899 100644 --- a/cmd/helm/testdata/output/upgrade-with-missing-dependencies.txt +++ b/cmd/helm/testdata/output/upgrade-with-missing-dependencies.txt @@ -1 +1 @@ -Error: found in Chart.yaml, but missing in charts/ directory: reqsubchart2 +Error: An error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies: found in Chart.yaml, but missing in charts/ directory: reqsubchart2 diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 3bd392d1d..e62e6ed35 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -146,6 +146,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { } if req := ch.Metadata.Dependencies; req != nil { if err := action.CheckDependencies(ch, req); err != nil { + err = errors.Wrap(err, "An error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies") if client.DependencyUpdate { man := &downloader.Manager{ Out: out,