From d7824bac7bafb49fd5fc9dc52455e75a1e3ee2d0 Mon Sep 17 00:00:00 2001 From: Andreas Karis Date: Tue, 25 May 2021 23:29:57 +0200 Subject: [PATCH] Add WARNING when --repo parameter is ignored When helm finds a chart under a local (relative) path, it will always use that chart. Thus, helm will ignore the --repo parameter. Issue a warning message to make users aware of this behavior. Closes #9731 Signed-off-by: Andreas Karis --- pkg/action/action.go | 5 +++++ pkg/action/install.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/pkg/action/action.go b/pkg/action/action.go index 38ba638e4..a974d0846 100644 --- a/pkg/action/action.go +++ b/pkg/action/action.go @@ -418,3 +418,8 @@ func (c *Configuration) Init(getter genericclioptions.RESTClientGetter, namespac return nil } + +func warning(format string, v ...interface{}) { + format = fmt.Sprintf("WARNING: %s\n", format) + fmt.Fprintf(os.Stderr, format, v...) +} diff --git a/pkg/action/install.go b/pkg/action/install.go index af99717d1..bf242827d 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -643,6 +643,11 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) ( return "", err } } + if c.RepoURL != "" { + warning("Chart found at local path '%v'. Ignoring Repository URL '%v.'", + abs, + c.RepoURL) + } return abs, nil } if filepath.IsAbs(name) || strings.HasPrefix(name, ".") {