Print full url instead of chart name and version

Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
pull/31206/head
Benoit Tigeot 4 weeks ago
parent 4d3b3456a8
commit 43ab1525a2
No known key found for this signature in database
GPG Key ID: 8E6D4FC8AEBDA62C

@ -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)

@ -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.

Loading…
Cancel
Save