Sub topic 11
Pinning a chart by digest
This chapter assumes you can package, push, pull and install a chart from an OCI registry, and that you know how oci:// references and chart versions map to tags. Helm 3.8 or later is required. Digest installs need a newer Helm, so check your version with helm version.
Why a tag is not enough
An OCI tag is a movable label. If someone pushes a different chart with the same name and version, the tag 0.1.0 points to the new content. Some registries block this and others allow it. Your install then changes without any change on your side.
A digest is a SHA-256 hash of the chart's manifest. The hash changes whenever the content changes, so a digest always identifies the same bytes. Pinning means you install by digest, and the registry cannot hand you anything else.
| Property | Tag (`0.1.0`) | Digest (`sha256:...`) |
|---|---|---|
| Can point to new content later | Yes, if the registry allows overwrites | No |
| Easy to read | Yes | No |
| Good for audits and reproducible deploys | Weak | Strong |
Finding the digest
helm push prints the digest when it finishes:
helm push myapp-0.1.0.tgz oci://registry.example.com/charts
# Pushed: registry.example.com/charts/myapp:0.1.0
# Digest: sha256:...Record this value in your release notes or CI output. Helm also prints the digest during helm pull:
helm pull oci://registry.example.com/charts/myapp --version 0.1.0
# Pulled: registry.example.com/charts/myapp:0.1.0
# Digest: sha256:...Installing by digest
Put the digest in the reference after an @ sign. Do not combine it with --version in a conflicting way. The digest alone selects the content.
helm install my-release \
oci://registry.example.com/charts/myapp@sha256:<digest>You can use the same form with helm pull and helm show chart. Replace <digest> with the full 64-character hex value from your push or pull output.
helm pull oci://registry.example.com/charts/myapp@sha256:<digest>If the digest does not exist in the registry, the command fails. It does not fall back to a tag.
A reference can carry both a tag and a digest, as in myapp:0.1.0@sha256:<digest>. Registry tools treat the digest as authoritative. Helm support for this combined form depends on the version, so test it before relying on it.
How pinning fits the workflow
A common pattern is for CI to publish the chart, capture the digest, and write it into the deployment configuration that production uses. Staging can follow a tag. Production follows the digest that passed staging.
Gotchas
- Digests change when you repackage.
helm packagecan produce a different archive from the same source, for example when file timestamps differ. A new archive gives a new digest, so you cannot rebuild the chart and expect the old digest. - A digest does not prove who published the chart. It proves the content is unchanged since you recorded it. If the value you recorded was wrong, pinning preserves the wrong chart. Signing, covered in a later chapter, addresses authorship.
- Dependencies are not pinned by digest in
Chart.yaml. Thedependenciesentry takes aversion, not a digest. Pin the parent chart by digest, and useChart.lockto record the resolved dependency versions. - Digests are not human-friendly. Keep the tag in your records too, so people can tell what the digest corresponds to.
Exercise
Exercise
Your team pushed myapp 0.1.0 and a colleague later pushes different content under the same tag. Why does an install that uses oci://registry.example.com/charts/myapp@sha256:<digest> still return the original chart, and what must you record at push time to use this method?
Show answer
The digest is a hash of the manifest, so it identifies the exact original content. A different chart has a different digest, so the tag change does not affect the pinned install. At push time you must record the Digest: sha256:... value that helm push prints.
Exercise
You rebuild the chart from unchanged source with helm package and push it again. You expected the same digest. Name one reason it can differ.
Show answer
The new archive can differ in details such as file timestamps, which changes the bytes and therefore the hash. Keep the digest from the original push instead of rebuilding.