Promotion & Immutable Releases
A release candidate that passed QA must be exactly the binary that ships. Rebuilding it "for release" from the same commit gives you a different binary (other compiler patch level, other dependency resolution, other timestamps), one nobody has tested. The rule of artifact management is therefore:
Build once, promote many times.
Promotion between repositories
Artifacts move through repositories that represent maturity levels, without being rebuilt:
libs-dev-local ──promote──▶ libs-staging-local ──promote──▶ libs-release-local
(every CI build) (passed integration tests) (approved, shipped)| Repository | Who writes | Retention | Immutable? |
|---|---|---|---|
| dev / snapshot | any CI build of any branch | days to weeks | no (snapshots are overwritten) |
| staging / candidate | promotion only, after automated gates | until released or rejected | yes |
| release | promotion only, after approval | forever (or per policy) | yes |
Promotion is a copy or move of the same bytes plus metadata: Artifactory's build promotion API (jf rt build-promote), Nexus's staging/tagging features, or simply "copy this digest to the next repository" in a script. Because the bytes don't change, the checksums don't change, and every signature, SBOM and test report produced for the candidate still applies to the release.
A model of the rules
The model below implements three rules most teams enforce: releases are immutable, promotion only moves forward, and a promotion needs its gate to have passed. It tracks artifacts by content digest, the way repository managers do:
import hashlib
class Repo:
def __init__(self, name, immutable):
self.name, self.immutable, self.files = name, immutable, {}
def put(self, path, data):
if self.immutable and path in self.files:
if self.files[path] == data:
return f"{self.name}: {path} already present (same bytes), ok"
return f"{self.name}: REJECTED overwrite of {path}"
self.files[path] = data
return f"{self.name}: stored {path} sha256={hashlib.sha256(data).hexdigest()[:12]}"
dev, staging, release = Repo("dev", False), Repo("staging", True), Repo("release", True)
order = [dev, staging, release]
gates = {("dev", "staging"): "integration tests", ("staging", "release"): "QA sign-off"}
passed = set()
def promote(path, src, dst):
if order.index(dst) != order.index(src) + 1:
return f"REJECTED promotion {src.name} -> {dst.name}: must go one step forward"
gate = gates[(src.name, dst.name)]
if gate not in passed:
return f"REJECTED promotion to {dst.name}: gate '{gate}' not passed"
return dst.put(path, src.files[path]) # the same bytes, never a rebuild
art = "engine/1.4.0/engine-1.4.0-linux-x86_64.tar.gz"
print(dev.put(art, b"build #812 of commit 3f2a"))
print(promote(art, dev, release))
print(promote(art, dev, staging))
passed.add("integration tests")
print(promote(art, dev, staging))
passed.add("QA sign-off")
print(promote(art, staging, release))
print(release.put(art, b"rebuild #815 of commit 3f2a"))
print(release.put(art, b"build #812 of commit 3f2a"))
print("dev may overwrite:", dev.put(art, b"build #816 of commit 3f2a").split(":")[1].strip())
same = staging.files[art] == release.files[art]
print("staging and release hold identical bytes:", same)dev: stored engine/1.4.0/engine-1.4.0-linux-x86_64.tar.gz sha256=8cd602af6b7c
REJECTED promotion dev -> release: must go one step forward
REJECTED promotion to staging: gate 'integration tests' not passed
staging: stored engine/1.4.0/engine-1.4.0-linux-x86_64.tar.gz sha256=8cd602af6b7c
release: stored engine/1.4.0/engine-1.4.0-linux-x86_64.tar.gz sha256=8cd602af6b7c
release: REJECTED overwrite of engine/1.4.0/engine-1.4.0-linux-x86_64.tar.gz
release: engine/1.4.0/engine-1.4.0-linux-x86_64.tar.gz already present (same bytes), ok
dev may overwrite: stored engine/1.4.0/engine-1.4.0-linux-x86_64.tar.gz sha256=0e9bec54d4f6
staging and release hold identical bytes: True
Note the two "put the same path again" cases in the release repository. A different file under a released name is rejected: once engine 1.4.0 exists, 1.4.0 means exactly those bytes forever, for everyone who already downloaded it. Re-uploading identical bytes is harmless, which makes retries in CI safe.
Immutable releases in practice
- Repository managers: Artifactory and Nexus have per-repository "allow redeploy" settings; turn redeploy off for release repositories. Maven Central, npm, PyPI, crates.io and NuGet.org never allow replacing a published version (you can only yank/deprecate and publish a new one).
- Container registries: tags are mutable by default (
:latest, even:1.4.0). Deploy by digest (app@sha256:…), and turn on tag immutability where the registry supports it (ECR, Artifact Registry, Harbor). - GitHub Releases: assets can be replaced by default; newer repository settings add immutable releases. Publish checksums next to assets either way.
- Fixing a bad release means a new version (
1.4.1), never overwriting1.4.0. See Rollbacks & Roll-forward.
Snapshots vs releases
Maven makes the distinction explicit: 1.5.0-SNAPSHOT is a moving target that resolves to the newest timestamped upload (1.5.0-20260115.100000-3), stored in a snapshot repository; 1.5.0 is a release, stored once. Other ecosystems use pre-release versions (1.5.0-rc.1, 1.5.0rc1) or dev tags in a separate repository. In every case: development builds go to a repository with short retention and overwrites allowed, and only promotion fills the release repository.
Test yourself
Why promote the tested binary instead of rebuilding the release from the same commit?
- Rebuilding is not allowed by Git
- A rebuild produces different bytes that nobody tested
- Promotion compresses the file
- Rebuilds are always slower
The release repository already holds engine 1.4.0. CI uploads a rebuilt engine 1.4.0 with different bytes. What should happen?
- Overwrite it
- Reject it
- Store both
- Rename the old one
Why does the model allow re-uploading identical bytes to the release repository?
- It's a bug
- It makes retried CI uploads harmless while still preventing changes
- Release repositories are mutable
- To save space