From 43ab1525a2e40dda1d1fa97d9496faa1ff2e862c Mon Sep 17 00:00:00 2001 From: Benoit Tigeot Date: Fri, 29 Aug 2025 10:21:30 +0200 Subject: [PATCH] Print full url instead of chart name and version Signed-off-by: Benoit Tigeot --- pkg/action/pull.go | 13 +------------ pkg/action/pull_test.go | 6 ++++-- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/pkg/action/pull.go b/pkg/action/pull.go index 5eaa0bf1a..dc1e33e3a 100644 --- a/pkg/action/pull.go +++ b/pkg/action/pull.go @@ -151,18 +151,7 @@ func (p *Pull) Run(chartRef string) (string, error) { // For direct OCI pulls, the registry client already prints "Pulled:" and // "Digest:" (manifest digest), so we do not print here to avoid duplicates. if p.RepoURL != "" || !registry.IsOCI(downloadSourceRef) { - base := strings.TrimSuffix(filepath.Base(saved), ".tgz") - chart := base - ver := "" - if i := strings.LastIndex(base, "-"); i > 0 { - chart = base[:i] - ver = base[i+1:] - } - if ver != "" { - fmt.Fprintf(&out, "Pulled: %s:%s\n", chart, ver) - } else { - fmt.Fprintf(&out, "Pulled: %s\n", chart) - } + fmt.Fprintf(&out, "Pulled: %s\n", downloadSourceRef) if f, err := os.ReadFile(saved); err == nil { sum := sha256.Sum256(f) diff --git a/pkg/action/pull_test.go b/pkg/action/pull_test.go index f7cd45885..7d06ff9dd 100644 --- a/pkg/action/pull_test.go +++ b/pkg/action/pull_test.go @@ -77,7 +77,8 @@ entries: out, err := p.Run("testchart") require.NoError(t, err, "Pull.Run() should succeed. Output:\n%s", out) - assert.Contains(t, out, "Pulled: testchart:1.2.3", "expected Pulled summary in output") + expectedURL := srv.URL + "/testchart-1.2.3.tgz" + assert.Contains(t, out, "Pulled: "+expectedURL, "expected Pulled summary in output") assert.Contains(t, out, "Digest: "+wantDigest, "expected archive digest in output") // Ensure the chart file was saved. @@ -119,7 +120,8 @@ func TestPull_PrintsSummary_ForDirectHTTPURL(t *testing.T) { require.NoError(t, err, "Pull.Run() should succeed. Output:\n%s", out) // Output should reflect name-version.tgz from the URL. - assert.Contains(t, out, "Pulled: directchart:9.9.9", "expected Pulled summary in output") + expectedURL := srv.URL + "/directchart-9.9.9.tgz" + assert.Contains(t, out, "Pulled: "+expectedURL, "expected Pulled summary in output") assert.Contains(t, out, "Digest: "+wantDigest, "expected archive digest in output") // Ensure the chart file was saved.