Artifact Promotion
Artifact promotion is building an image or binary once and moving that same immutable artifact through dev, staging, and production instead of rebuilding for each environment.
Understanding Artifact Promotion
What Is Artifact Promotion and Why Does It Matter
Artifact promotion means one build produces one artifact, identified by an immutable reference such as an image digest, and that exact artifact is deployed to every environment in turn. Only the configuration changes between environments, never the bits.
If production is a fresh rebuild from the same source, a base image or dependency can resolve differently, so the production image is technically untested. Promotion removes that gap and gives you a clean chain of custody: this image came from this commit, passed these checks, and was approved by these people.
Promotion Flow
Tags vs Digests
| Reference | Mutable? |
|---|---|
payment-api:latest |
Yes, can move at any time |
payment-api:v1.2.3 |
Yes, unless the registry enforces immutability |
payment-api@sha256:f8a2... |
No, it is a hash of the content |
Implementation with Digest Pinning
jobs: build: runs-on: ubuntu-latest outputs: digest: ${{ steps.push.outputs.digest }} steps: - uses: actions/checkout@v4 - id: push uses: docker/build-push-action@v5 with: push: true tags: ${{ env.ECR_REGISTRY }}/payment-api:${{ github.sha }} deploy-staging: needs: build runs-on: ubuntu-latest environment: staging steps: - run: | helm upgrade --install payment-api ./charts/payment-api \ --set image.repository=$ECR_REGISTRY/payment-api \ --set image.digest=${{ needs.build.outputs.digest }} \ -n payment-api-staging --atomic deploy-production: needs: [build, deploy-staging] runs-on: ubuntu-latest environment: production steps: - run: | helm upgrade --install payment-api ./charts/payment-api \ --set image.repository=$ECR_REGISTRY/payment-api \ --set image.digest=${{ needs.build.outputs.digest }} \ -n payment-api-production --atomicThe chart must render repository@digest when a digest is set. Both environments receive the same digest from the same build job.
Externalise Configuration
Promotion only works if the image is environment-neutral. Pass API URLs, feature flags, and credentials through environment variables, ConfigMaps, or a secrets manager at deploy time. Baking them in at build time forces one build per environment and defeats the point.
Troubleshooting
| Symptom | Check | What to Look For |
|---|---|---|
| Staging and prod behave differently | Image reference per environment | Different digests or a moved tag |
| Cannot trace a running image | Labels and tags | Missing commit SHA label |
| Deploy pulls an unexpected image | Tag strategy | Anything deploying latest |
TipAdd labels such as
git.commitandci.runat build time. They are readable withdocker inspectand link a running container to its exact commit and pipeline run.
RememberA digest is the only truly immutable image reference. Enable tag immutability on the registry as a second safety net.
SecurityPromotion is also a supply chain control. Sign the digest (for example with cosign) and verify the signature at deploy time so only images your pipeline built can run.
Common MistakeTagging with
latestand deploying that tag. It can point at a different image between your test run and your deploy. Deploy by digest or commit SHA.
Frequently Asked Questions
What risk does artifact promotion actually remove?
It removes build-time drift. If each environment rebuilds, a dependency can resolve to a new version between the staging build and the production build, causing a works-in-staging, fails-in-prod bug that has nothing to do with your code.
Is a version tag like v1.2.3 enough to promote safely?
Only if the registry enforces tag immutability. Otherwise a tag can be re-pointed, so the safest reference is the content digest recorded at build time.
How do I handle different settings per environment without rebuilding?
Externalise configuration. Inject values through environment variables, mounted ConfigMaps, or a secrets manager so the same image runs everywhere and only its configuration differs.