Prepare reproducible builds and operational handoff
Prepare reproducible builds and operational handoff
A handoff is an evidence package for another engineer: source revision, exact compiler version and target, build commands, test logs, artifact hashes, configuration defaults, known limits, and operating instructions. For this standard-library module use a pinned toolchain and go build -trimpath -buildvcs=false -o jobd ./cmd/jobd in a controlled environment. Record GOOS, GOARCH, CGO_ENABLED and compiler version. This is a lab recipe; disabling VCS embedding means the revision must be recorded separately. Two identical local builds are evidence for those inputs, not a proof of universal reproducibility.
package main
import ( "fmt" "runtime" "runtime/debug" "strings")
func main() { info, ok := debug.ReadBuildInfo() if !ok { panic("missing build metadata") } fmt.Println(strings.HasPrefix(info.GoVersion, "go")) fmt.Println(runtime.GOOS != "", runtime.GOARCH != "")}Build information identifies recorded compiler and settings. Inspect the built binary with go version -m rather than guessing from the active shell. Calculate a SHA-256 digest of the actual artifact and record it beside a trusted release manifest. A hash verifies equality against a trusted expected digest; it does not authenticate an untrusted manifest. Test restore and rollback separately from build reproducibility.
Expected output:
truetrue trueDecide release readiness from evidence
package main
import ( "fmt")
func ready(gates map[string]bool, required []string) bool { if len(required) == 0 { return false } for _, g := range required { if !gates[g] { return false } } return true}func main() { r := []string{"test", "restore", "security"} fmt.Println(ready(map[string]bool{"test": true, "restore": true}, r)) fmt.Println(ready(map[string]bool{"test": true, "restore": true, "security": true}, r))}A missing required gate is not a pass. The lab service listens on loopback, has bounded storage and request processing, and shuts down with a deadline. Its in-memory state disappears at exit. Before a production handoff, implement durable persistence and recovery, authentication/authorization, transport security, telemetry, retention and deployment-specific capacity testing. Keep a rollback plan that accounts for schema compatibility. Run go test ./..., go test -race ./... and go vet ./... before packaging; preserve failures, not just successes.
Expected output:
falsetrueTry it locally
Write a digest comparison helper for two byte slices. Verify identical content matches and a changed byte fails. Explain why the expected digest must come from a trusted source.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Capstone engineering 07: Prepare reproducible builds and operational handoff
Check the lesson objective before moving on.
What does an identical hash for two controlled builds demonstrate?
A production gate has not been run. How should it be reported?