Reliable Release Automation
Build once and verify
A release process should identify the exact source revision, validate inputs, build an artifact, record its digest and promote those same bytes through review. Deterministic output reduces unexplained differences. Pin dependencies, normalize timestamps and order, and record tool versions. Matching digests show byte equality with a trusted expected value, not provenance or authenticity by themselves.
Create a deterministic local artifact
In a new disposable directory create notes.txt with exact bytes Water every 3 days plus LF. Save this Python 3 script as build-release.py and run python3 build-release.py. It validates input before creating files, fixes ZIP metadata and uses stored bytes (no compression). Run twice in separate directories and compare garden.zip and garden.sha256. This narrow example overwrites its own outputs; never run it in a directory containing valuable files with those names.
import hashlibfrom pathlib import Pathfrom zipfile import ZipFile, ZipInfo, ZIP_STORED
source = Path("notes.txt")payload = source.read_bytes()if payload != b"Water every 3 days\n": raise SystemExit("Invalid release input")
entry = ZipInfo("notes.txt", date_time=(2020, 1, 1, 0, 0, 0))entry.create_system = 3entry.external_attr = 0o100644 << 16entry.compress_type = ZIP_STOREDwith ZipFile("garden.zip", "w") as archive: archive.writestr(entry, payload)
digest = hashlib.sha256(Path("garden.zip").read_bytes()).hexdigest()Path("garden.sha256").write_text(digest + " garden.zip\n", encoding="ascii")print(digest)Verify before promotion
Compute SHA-256 of the artifact and compare it with the independently trusted release record. A digest file travelling with a compromised artifact can also be changed; use an authenticated record or signature where appropriate. Record exact source commit, artifact identity, test results and target. The lab tests two independent builds, tampering and invalid input; this is not a general reproducible-build guarantee.
Bound retries and timeouts
Retries should be bounded and limited to retryable conditions; invalid input or permission failures require correction, not repeated attempts. Set job and step timeouts. A timed-out upload may have succeeded remotely; inspect the target identity and digest before retrying. If the intended artifact exists with the expected digest, treat it as already applied; if a different digest exists, stop and investigate. The mock lab checks these decisions, not a live registry.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Reliable Release Automation — knowledge check
Reason about reliable delivery and trust boundaries.
Why fix ZIP metadata in the example?
What does a matching SHA-256 against a trusted record show?
An upload times out; what next?
Which failure should not be retried blindly?
What should a release record bind?