Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 5 of 6 · Worked example · 20 min · revision 3

Promoting a release to production without rebuilding it

Master the mechanics of promoting tested software deliverables across deployment tiers without rebuilding, leveraging digest-based promotions and runtime configuration injection.

Contentsand lesson path

What you will learn

  • Promote one verified artifact through staging and production instead of rebuilding it for each environment.

01. Promotion Mechanics: Moving Artifacts, Not Source Code

A continuous delivery pipeline moves one tested artifact from stage to stage. In older workflows, teams often triggered one pipeline job to build a "staging image" and later triggered a separate pipeline job to build a "production image" from the same Git branch. As the build-once rule explains, the tests then ran on a different build: the production image is a new, untested set of bytes that may contain other dependency versions, compiler differences or changed runtime behaviour.

With the build-once rule, each version is compiled and packaged once. Promotion across environments changes tags, records and deployments, not the artifact itself:

  1. Build and Test in Staging: Continuous integration builds the candidate artifact (api:1.4.2), records its SHA-256 digest (sha256:11eaa6a3...), and deploys this exact digest into the staging environment for automated integration, security, and performance testing.

  2. Promotion Gate: Once staging verification passes and business sign-offs are granted, the promotion workflow is triggered. Instead of rebuilding, the workflow promotes the existing artifact by either adding a production release tag (release-prod) to the existing digest in the registry or copying the immutable image layers to an isolated production registry.

  3. Production Deployment: Production clusters pull and run the exact same cryptographic digest that passed staging verification. The software running in production is bit-for-bit identical to the software that passed the staging gates, which removes build drift as a cause of surprises. It does not remove differences in configuration, data or load between staging and production, so production still needs its own smoke tests and monitoring.

Separating promotion from the build also gives you an audit trail. Each deployment records the digest it deployed, when it was promoted and which test run passed it, so auditors and site reliability engineers can check that what runs in production is what was tested.

02. Runtime Configuration Injection: Decoupling Code from Environment

For one artifact to run in development, staging and production, every setting that differs between them must be supplied at runtime. Three mechanisms are common, and GitOps adds a related way to promote:

  • Environment Variables (POSIX Envs): The universal baseline across cloud platforms, containers, and serverless runtimes. Variables (such as PORT, LOG_LEVEL, CACHE_TTL) are defined in deployment manifests and read by application runtimes upon initialization.

  • Mounted Secret Volumes and ConfigMaps: In Kubernetes and container orchestrators, configuration files (appsettings.json, nginx.conf) and sensitive credentials (TLS certificates, database connection strings) are mounted into the container filesystem as read-only volumes at startup.

  • Centralized Configuration Servers and Vaults: Dynamic applications query centralized configuration stores (such as HashiCorp Vault, AWS Systems Manager Parameter Store, or Consul) during startup using workload identity tokens, fetching fresh credentials without storing secrets on disk.

  • GitOps Promotion Pull Requests: In GitOps workflows managed by Argo CD or Flux, promotion is not done by a script that pushes to the cluster. Instead, an automated CI step opens a pull request against the infrastructure configuration repository (e.g. updating k8s/overlays/production/kustomization.yaml with the new digest). Once approved, the GitOps controller synchronizes the cluster state to match the declared digest.

Here is a concrete case. Build 1.4.2 of orders passed staging, and its manifest digest is in the CI release record. Production must now run that same manifest: either from the same registry under a production tag, or from a separate production registry. promote.sh shows both ways with crane, the registry command-line tool from Google's go-containerregistry project (checked with crane 0.22.1 against a local registry). Replace the two registry names with your own and log in to each with crane auth login first. Because of set -e, step 2 stops the script when the registry does not hold that exact digest, so a typo in the record cannot promote anything.

Bash · promote.sh: promote the tested digest by tag or by copy (crane)
#!/usr/bin/env bash
set -euo pipefail
# 1. The digest that passed staging, read from the CI release record
STAGING_DIGEST="sha256:11eaa6a3501e2f13e2434a5989608bff50a055a439a5e603b6673ea174e37b15"
SRC="registry.internal.net/apps/orders"
PROD="prod-registry.internal.net/apps/orders"

# 2. Stop at once if the registry does not hold exactly that manifest
crane digest "${SRC}@${STAGING_DIGEST}" > /dev/null

# 3. Promote by adding a tag to the existing manifest
#    (no layers are downloaded, rebuilt or re-uploaded; only a tag is written)
crane tag "${SRC}@${STAGING_DIGEST}" v1.4.2-prod

# 4. Or copy it to a separate production registry; the digest stays the same
crane copy "${SRC}@${STAGING_DIGEST}" "${PROD}:v1.4.2"
test "$(crane digest "${PROD}:v1.4.2")" = "${STAGING_DIGEST}"
echo "promoted ${STAGING_DIGEST}"

03. Rollback Safety, Canary Shifts, and Cryptographic Auditing

Promoting unchanged artifacts also speeds up recovery during production incidents. When a newly deployed release introduces unexpected latency or regressions, site reliability engineers do not need to check out old source code branches, wait for CI compilation jobs, or hope that historical dependencies still compile cleanly.

Because all previous release artifacts remain immutable in the registry, executing a rollback requires nothing more than repointing the production orchestrator to the previous verified digest (kubectl rollout undo deployment/orders-service or updating the digest in Terraform). Rolling back is then a pointer change plus a normal rollout: Kubernetes replaces pods at the pace set by image pull time, readiness checks and maxSurge/maxUnavailable, which usually takes minutes rather than the time of a rebuild. The rollback is safe only if the previous version still works with the current database schema, data and messages that the new version may have written. That is why schema changes must be backward compatible (expand and contract): otherwise rolling back the code can break the old version.

Furthermore, promoting unchanged artifacts makes progressive deployment techniques (Canary Deployments and Blue/Green Switches) reliable. In a canary rollout, ingress controllers (like Envoy or AWS ALB) route 5% of customer traffic to pods running the newly promoted digest while 95% remains on the baseline digest. Because both workloads run tested, immutable artifacts, real-time comparisons of Prometheus error rates, CPU metrics, and response latencies reflect genuine algorithmic behavior rather than build anomalies.

Finally, promoting artifacts by digest makes them traceable. By recording the image digest in your deployment manifests and tracking build provenance with tools like Sigstore or in-toto attestations, auditors can trace a binary running in production back to its Git commit, its CI run and the approval that released it.

04. Check your understanding

Practice check · 3 questions

Re-tagging, promotion limits and rollback time

Three questions on what promotion by digest does and does not change.

Q1. The promotion script runs `crane tag registry.example.com/api@sha256:11ea… release-prod`. What does this send to the registry?
Q2. Production runs the exact digest that staging tested, yet a bug shows up only in production. Which cause does promotion by digest NOT rule out?
Q3. You roll a Deployment back from 1.5.0 to 1.4.9 with Kubernetes. What mainly decides how long the rollback takes?
Practice only: not graded, not saved, not evidence.

05. Apply it

Implement these release promotion standards across your deployment pipelines:

  • Promote by Digest: Reference the specific SHA-256 digest verified in staging when triggering production deployments.
  • Extract Configuration to Runtime: Inject all environment-specific URLs, API keys, and database credentials via environment variables or secret volumes.
  • Re-tag Without Rebuilding: Use tools like crane tag or registry APIs to add release tags without re-uploading image layers.
  • Retain Previous Releases for Rollback: Maintain tested release digests in the registry to allow one-command rollbacks, and keep schema changes backward compatible so those rollbacks stay safe.
  • Verify Provenance Attestations: Have production admission or deployment checks verify signatures and build provenance before the code runs.
  • Synchronize Promotion with Release Gates: Tie each promotion to the approval that allowed it, so only release candidates that passed staging reach production.

06. Review prompt

Describe the end-to-end promotion workflow of a software deliverable from staging verification to production deployment without rebuilding source code. Explain how runtime configuration injection enables artifact immutability, and discuss how immutable release registries speed up emergency rollbacks and what can still make a rollback unsafe.

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

6 questions · about 5 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check