Mutable names, immutable identities: tags, checksums and digests
Contrast human-friendly mutable tags with cryptographically immutable content-addressable digests, and deploy software deliverables using verified SHA-256 identities.
Contentsand lesson path
On this page
- Tags vs. Digests: The Conflict Between Convenience and Integrity
- Inspecting OCI Manifests and Calculating Checksums
- Digest Pinning in Production Deployment Pipelines
- Check your understanding
- Apply it
- Review prompt
Lessons of Artifact Management
- Artifacts, versions and the build-once rule Concept · 15 min
- Mutable names, immutable identities: tags, checksums and digests Worked example · 15 min
- Lab: publish a versioned package from CI Lab · 25 min
- Registries: access control, retention, immutability and pull-through caches Concept · 20 min
- Promoting a release to production without rebuilding it Worked example · 20 min
- Check: trace a deployed artifact back to its commit Knowledge check · 6 questions
What you will learn
- Apply a versioning scheme (semantic versions and commit SHAs) and identify artifacts immutably by checksum or digest, so any build traces back to its source commit.
02. Inspecting OCI Manifests and Calculating Checksums
In the Open Container Initiative (OCI) image specification, an image does not consist of a single monolithic file. Instead, it is composed of an Image Index, an Image Manifest, a Configuration Descriptor, and an array of compressed Layer Tarballs.
The digest of a single-platform image is the SHA-256 hash of its manifest JSON document (for a multi-platform image, the reference usually names the index, which is hashed the same way). The manifest enumerates the cryptographic SHA-256 digests of each individual filesystem layer. When a container runtime pulls an image, it verifies the checksum of every downloaded layer against the manifest before unpacking files to disk.
Furthermore, modern enterprise applications increasingly support multi-architecture execution (such as deploying identical microservices across x86-64 and ARM64 Graviton instances). Registries support this via an OCI Image Index (often called a "fat manifest"). The image index points to multiple sub-manifests, each corresponding to a specific CPU architecture and operating system combination. When an orchestration agent pulls the image, the runtime matches its local host kernel platform against the index and pulls the corresponding platform-specific manifest digest.
Here is a concrete case. CI has just built orders-service 1.4.2: a release archive in dist/ and a container image pushed to ghcr.io/org/orders-service:1.4.2. Before the deploy job rolls it out, it must record the archive checksum, check it, turn the tag into a digest, and deploy by that digest, so that a tag moved a minute later cannot change what runs. The commands below do those four things in order. Replace ghcr.io/org with your registry and organization; you need Docker with the Buildx plugin (Docker Desktop includes it; on Linux it is the docker-buildx-plugin package from Docker's repository) and kubectl connected to your cluster. No output is shown because it depends on your registry. In the lab of lesson 03 you do the same steps against a local registry with oras resolve and oras pull, and see real output.
# 1. Compute deterministic SHA-256 checksum of a release tarball
sha256sum dist/orders-service-v1.4.2.tar.gz > dist/orders-service.sha256
# 2. Verify integrity against the recorded checksum. This proves the bytes
# match the record; it proves authenticity only if the record itself
# came from a trusted place (your CI, a signed file), not the same server
sha256sum --check dist/orders-service.sha256
# 3. Query remote OCI registry manifest digest without downloading layers
# (plain {{.Manifest.Digest}}: the json function would add quotes)
DIGEST=$(docker buildx imagetools inspect \
ghcr.io/org/orders-service:1.4.2 --format '{{.Manifest.Digest}}')
echo "${DIGEST}" # sha256:<64 hex characters>
# 4. Deploy workload referencing immutable digest pin
kubectl set image deployment/orders-service \
orders="ghcr.io/org/orders-service@${DIGEST}"03. Digest Pinning in Production Deployment Pipelines
To keep names readable for people and exact for machines, many teams use both kinds of reference:
-
Human-Facing Git Tags for Documentation: Releases are tagged with descriptive SemVer identifiers (
v1.4.2) in Git repositories and artifact registries so that engineers can easily navigate release notes, changelogs, and audit logs in web portals. -
Machine-Facing Digests for Orchestration: Continuous integration build jobs resolve the exact
@sha256:...digest immediately after pushing the image. The CI workflow writes this digest into infrastructure-as-code manifests (Terraform variables, Helm values, or Kustomize image transformers). Production deployment tools pull and deploy by digest, so a moved tag cannot change what runs. -
What a Checksum Does and Does Not Prove: A checksum detects corruption, and it detects tampering only when the expected value comes from somewhere the attacker cannot also change. If an attacker compromises a registry or download server and replaces a release tarball, they can replace the
.sha256file next to it just as easily, andsha256sum --checkwill pass. Trust the digest your CI recorded at build time in your own repository or manifests, or verify a signature (cosign/Sigstore, GPG) against the publisher's known identity; a checksum file fetched from the same compromised server proves nothing. -
Settling the Image Pull Policy Question: In Kubernetes, deploying with tags often triggers debates over
imagePullPolicy: AlwaysversusIfNotPresent.Alwaysincurs API roundtrip latency on every pod restart, whileIfNotPresentrisks running stale layers. Deploying by digest removes this trade-off: a digest always names the same content, soIfNotPresentcannot run a stale image. -
Automating Digest Updates with Dependency Bots: To keep digest pins current without manual edits, teams use bots such as Renovate or Dependabot. When a new digest is published, the bot opens a pull request that updates the manifests with the new SHA-256 string, and your normal CI and review check it before it merges.
04. Check your understanding
05. Apply it
Incorporate these artifact identification and verification practices into your infrastructure:
- Ban
:latestin Production: Prohibit the use of mutable tags in Kubernetes deployment manifests, ECS task definitions, and compose files. - Deploy Workloads by Digest: Configure CI release jobs to extract the image
@sha256:...digest and patch it directly into deployment manifests. - Generate Checksum Manifests for Archives: When distributing tarballs, zip archives, or binary wheels, generate companion
.sha256files, and sign them (or the artifacts) so consumers can check who produced them. - Verify Signatures, Not Just Checksums from the Same Location: Have installer and deployment scripts compare against a digest recorded by your CI, or verify a signature against a known identity, before unpacking downloaded archives.
- Retain Human Tags for Navigation: Maintain clear semver tags alongside digests so that developers can correlate production workloads with Git release milestones.
- Automate Digest Resolution in CI/CD: Make release automation scripts query the registry for newly generated digests and update downstream deployment variables without manual copy-paste errors.
06. Review prompt
Contrast mutable artifact tags with content-addressable cryptographic digests. Explain why deploying containerized applications by tag name introduces split-brain cluster drift, and describe how CI/CD pipelines combine human-readable tags with automated digest pinning so that every environment runs the same bytes.
References
Your progress
Reading state
Sign in to save that you finished reading this lesson.
Prove this skill
6 questions · about 5 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.