Avoid misleading terminology when displaying SHA-256 checksum

For HTTP/repo-based chart pulls, we calculate the SHA-256 checksum of the
downloaded .tgz archive file, not a manifest digest. This change updates
the output terminology to be more accurate:

- HTTP pulls: "Checksum: sha256:..." (file checksum)
- OCI pulls: "Digest: ..." (manifest digest, unchanged)

Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
pull/31206/head
Benoit Tigeot 21 hours ago
parent 5b0dc8f021
commit 83789b112b
No known key found for this signature in database
GPG Key ID: 8E6D4FC8AEBDA62C

@ -146,7 +146,7 @@ func (p *Pull) Run(chartRef string) (string, error) {
// a consistent summary here. We mirror the OCI output format:
//
// Pulled: <chartUrl>:<version>
// Digest: sha256:<digest>
// Checksum: sha256:<digest>
//
// For HTTP/repo pulls, the digest is the SHA-256 of the downloaded .tgz archive.
// For direct OCI pulls, the registry client already prints "Pulled:" and
@ -164,9 +164,9 @@ func (p *Pull) Run(chartRef string) (string, error) {
fmt.Fprintf(&out, "Pulled: %s\n", tag)
if sum, err := sha256File(saved); err == nil {
fmt.Fprintf(&out, "Digest: sha256:%x\n", sum)
fmt.Fprintf(&out, "Checksum: sha256:%x\n", sum)
} else {
fmt.Fprintf(&out, "Digest failed: %v\n", err)
fmt.Fprintf(&out, "Checksum failed: %v\n", err)
}
}

@ -79,7 +79,7 @@ entries:
expectedURL := srv.URL + "/testchart:1.2.3"
assert.Contains(t, out, "Pulled: "+expectedURL, "expected Pulled summary in output")
assert.Contains(t, out, "Digest: "+wantDigest, "expected archive digest in output")
assert.Contains(t, out, "Checksum: "+wantDigest, "expected archive checksum in output")
// Ensure the chart file was saved.
_, statErr := os.Stat(filepath.Join(p.DestDir, "testchart-1.2.3.tgz"))
@ -122,7 +122,7 @@ func TestPull_PrintsSummary_ForDirectHTTPURL(t *testing.T) {
// Output should reflect name-version.tgz from the URL.
expectedURL := srv.URL + "/directchart:9.9.9"
assert.Contains(t, out, "Pulled: "+expectedURL, "expected Pulled summary in output")
assert.Contains(t, out, "Digest: "+wantDigest, "expected archive digest in output")
assert.Contains(t, out, "Checksum: "+wantDigest, "expected archive checksum in output")
// Ensure the chart file was saved.
_, statErr := os.Stat(filepath.Join(p.DestDir, "directchart-9.9.9.tar.gz"))

@ -45,7 +45,7 @@ func TestPullCmd(t *testing.T) {
}
helmTestKeyOut := "Pulled: test/signtest\n" +
"Digest: sha256:e5ef611620fb97704d8751c16bab17fedb68883bfb0edc76f78a70e9173f9b55\n" +
"Checksum: sha256:e5ef611620fb97704d8751c16bab17fedb68883bfb0edc76f78a70e9173f9b55\n" +
"Signed by: Helm Testing (This key should only be used for testing. DO NOT TRUST.) <helm-testing@helm.sh>\n" +
"Using Key With Fingerprint: 5E615389B53CA37F0EE60BD3843BBF981FC18762\n" +
"Chart Hash Verified: "

Loading…
Cancel
Save