From 247bf7c2e0c591554b6cfd4c2f62cb2700b034ee Mon Sep 17 00:00:00 2001 From: Feng Cao <24779889+shfc@users.noreply.github.com> Date: Sun, 11 May 2025 01:48:39 +0930 Subject: [PATCH 1/4] fix: add warning when ignore repo flag Signed-off-by: Feng Cao <24779889+shfc@users.noreply.github.com> --- pkg/action/install.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/action/install.go b/pkg/action/install.go index 7bdfc2ab5..b2589c06f 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -759,6 +759,11 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) ( return "", err } } + // Issue #7862: Helm prioritizes local charts over --repo flag. + // This behavior is maintained for backwards compatibility but with a warning. + if c.RepoURL != "" { + fmt.Printf("WARNING: local chart %s found in current working directory. --repo flag will be ignored\n", name) + } return abs, nil } if filepath.IsAbs(name) || strings.HasPrefix(name, ".") { From 6b5c94475db950a981523344029f0a7c620a2e32 Mon Sep 17 00:00:00 2001 From: Feng Cao <24779889+shfc@users.noreply.github.com> Date: Sun, 11 May 2025 02:46:50 +0930 Subject: [PATCH 2/4] fix: replace fmt warning with slog Signed-off-by: Feng Cao <24779889+shfc@users.noreply.github.com> --- pkg/action/install.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/action/install.go b/pkg/action/install.go index b2589c06f..7cc8dcd3a 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -21,6 +21,7 @@ import ( "context" "fmt" "io" + "log/slog" "net/url" "os" "path" @@ -762,7 +763,7 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) ( // Issue #7862: Helm prioritizes local charts over --repo flag. // This behavior is maintained for backwards compatibility but with a warning. if c.RepoURL != "" { - fmt.Printf("WARNING: local chart %s found in current working directory. --repo flag will be ignored\n", name) + slog.Warn("local chart found in current working directory. --repo flag ignored", "chart", name) } return abs, nil } From eb5b6d50474842db17330b11e0db70077e1c4510 Mon Sep 17 00:00:00 2001 From: Feng Cao <24779889+shfc@users.noreply.github.com> Date: Tue, 13 May 2025 17:51:49 +0930 Subject: [PATCH 3/4] fix: move warning to top of block Emit the warning first to ensure it's always logged. This clarifies that any following errors are due to using a local chart instead of a remote repository. Signed-off-by: Feng Cao <24779889+shfc@users.noreply.github.com> --- pkg/action/install.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/action/install.go b/pkg/action/install.go index 7cc8dcd3a..e040c15e4 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -751,6 +751,12 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) ( version := strings.TrimSpace(c.Version) if _, err := os.Stat(name); err == nil { + // Issue #7862: Helm prioritizes local charts over --repo flag. + // This behavior is maintained for backwards compatibility but with a warning. + if c.RepoURL != "" { + slog.Warn("local chart found in current working directory. --repo flag ignored", "chart", name) + } + abs, err := filepath.Abs(name) if err != nil { return abs, err @@ -760,11 +766,6 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) ( return "", err } } - // Issue #7862: Helm prioritizes local charts over --repo flag. - // This behavior is maintained for backwards compatibility but with a warning. - if c.RepoURL != "" { - slog.Warn("local chart found in current working directory. --repo flag ignored", "chart", name) - } return abs, nil } if filepath.IsAbs(name) || strings.HasPrefix(name, ".") { From afefca8b2dcb3c220e24075e8dabf0cffd170daf Mon Sep 17 00:00:00 2001 From: Feng Cao <24779889+shfc@users.noreply.github.com> Date: Fri, 16 May 2025 15:50:18 +0930 Subject: [PATCH 4/4] chore: update generalization warning message Signed-off-by: Feng Cao <24779889+shfc@users.noreply.github.com> --- pkg/action/install.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/action/install.go b/pkg/action/install.go index e040c15e4..f81f65749 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -751,10 +751,10 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) ( version := strings.TrimSpace(c.Version) if _, err := os.Stat(name); err == nil { - // Issue #7862: Helm prioritizes local charts over --repo flag. + // Issue #7862: Helm prioritizes local charts over repository URL. // This behavior is maintained for backwards compatibility but with a warning. if c.RepoURL != "" { - slog.Warn("local chart found in current working directory. --repo flag ignored", "chart", name) + slog.Warn("local chart found in current working directory. repository url ignored", "chart", name, "repository", c.RepoURL) } abs, err := filepath.Abs(name)