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
On this page
- Promotion Mechanics: Moving Artifacts, Not Source Code
- Runtime Configuration Injection: Decoupling Code from Environment
- Rollback Safety, Canary Shifts, and Cryptographic Auditing
- 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
- 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:
-
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. -
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. -
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.yamlwith 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.
#!/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
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 tagor 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.
Prove this skill
6 questions · about 5 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.