Image promotion and runtime identity
Image identity: tags and digests
A tag is a human-friendly name associated with an image reference, such as catalog:1.2. A digest identifies the bytes of a manifest or image index using a cryptographic hash. Tags may move unless repository policy prevents it. A digest reference identifies the same manifest or index; a multi-platform index can select different platform manifests, so record the target OS and CPU architecture as well.
Suppose a staging release used digest A under the tag stable. The tag is later moved to digest B. A deployment that resolves stable later might use B. Record A and promote the reviewed artifact by digest instead of rebuilding from the same source tag. ECR supports tag immutability settings, including configured exclusions. Cloud Run resolves a deployment tag to a digest for the resulting revision. Do not assume every platform resolves tags at the same time or with identical behavior.
Build once, review and promote
A safe release pipeline builds from reviewed source and pinned dependencies, records the image digest and target platform, generates a software bill of materials (SBOM), scans the artifact, checks provenance/signature when required and records approval. Promote the approved digest to a restricted production repository or authorize that digest there, then verify the destination identity. Avoid leaking secrets through build arguments, environment dumps or image layers. Never copy real credentials into an image.
A scan detects known findings within its coverage; it cannot establish that the application is safe. Findings may appear after promotion as vulnerability databases change. Keep remediation ownership and a policy for reviewing exceptions. An immutable tag or digest does not replace scanning, signature verification, access control or runtime isolation. Retain the previous known-good artifact and its configuration for rollback; remove only unreferenced artifacts after reviewing retention requirements.
Separate deployment, pull and workload permissions
The release principal can create or update an approved deployment. The image pull principal needs read access to a specific private registry or repository. The workload identity should have only the permissions the app requires at runtime, such as reading catalog data, not publishing images or managing deployments.
In ECS, the task execution role supplies platform actions such as pulling private ECR images and sending logs, whereas the task IAM role supplies credentials for application code. Azure Container Apps can use managed identity for ACR pulls and for accessing supported resources; grant narrowly scoped roles and distinguish the intended uses even if an identity is shared. In Cloud Run, the service agent may need access to Artifact Registry (notably for cross-project image pulls); the configured service identity is used by application code for Google Cloud API calls. Verify the exact principal and resource policy before diagnosing an access denial.
Do not put static cloud keys in images or make a private registry public. Give humans and automation distinct audited access. Private networking does not grant authorization; identity alone does not establish a route to the registry.
Run an offline release gate
The following Python 3 example uses symbolic digest labels and boolean fixtures. It does not compute actual image hashes, verify signatures, query a scanner, or simulate a provider IAM engine. A successful result permits further staging review only.
def release_decision(expected, observed, scanned, approved, pull_allowed): if expected != observed: return "digest-mismatch" if not scanned or not approved: return "review-required" if not pull_allowed: return "pull-denied" return "eligible-for-staging"
print(release_decision("digest-a", "digest-a", True, True, True))print(release_decision("digest-a", "digest-b", True, True, True))print(release_decision("digest-a", "digest-a", True, True, False))Expected output:
eligible-for-stagingdigest-mismatchpull-deniedThe first release meets all four conditions; the second has the wrong artifact; the third cannot be fetched by the intended principal. Even after eligibility, check platform architecture, ingress and runtime policy. If scan status or approval is unknown, the real release process should fail closed until evidence is available.
Roll out and recover
Deploy a candidate revision with no traffic or to a separate staging endpoint where supported. Verify startup, health, authorized requests, error rate and latency. Shift a small fraction of traffic, compare results with the previous version, then increase only if the release criteria pass. Azure Container Apps supports multi-revision traffic allocation; Cloud Run supports gradual traffic changes and rollback. ECS deployments have their own controller and configuration choices; verify the selected strategy instead of applying revision weights universally.
If a 10% canary receives 20,000 total requests, the expected candidate share is 2,000 requests, not a guaranteed exact count. Suppose 80 candidate requests fail: the candidate error rate is 4%. With a fictional 1% maximum, stop the rollout and restore the known-good traffic configuration. Reconcile any incompatible database or external changes separately; image rollback does not undo them.
Review retained revisions, images, logging, identities and endpoints before cleanup. Preserve the audit evidence. The practice task asks you to trace digest and identity decisions before allowing any rollout. The next chapter extends the comparison to managed Kubernetes.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Image promotion and runtime identity — knowledge check
Choose the best answer for each offline scenario.
Why record an image digest for promotion?
Which ECS role normally supplies application permissions?
An image scan reports no findings. What should the release engineer conclude?
A canary has 80 failures in 2,000 requests. What is its error rate?
What does restoring an earlier image not automatically undo?