Chapter 26Lesson 01~155 minutes

Production Capstone: Design, Secure, Scale, and Recover a Governed Git Workflow: Requirements, Constraints, and Target Architecture

Design the final governed Git operating model: requirements, topology, roles, integration/release policy, recovery objectives, trust boundaries, scale choices, audit evidence, operational ownership, runbooks, and measurable acceptance criteria.

Capstone architectureGovernanceRecovery objectivesAcceptance criteria

Learning objectives

  • Translate Git mechanics into explicit production requirements and roles.
  • Design collaboration, integration, release, CI/GitOps, backup, and recovery topology.
  • Separate integrity, authenticity, authorization, credential secrecy, and repository ownership trust.
  • Choose large-repository mechanisms from measured bottlenecks.
  • Define auditable acceptance criteria, runbooks, retention, and ownership.

1. The capstone problem: operate Git as a governed change system

Individual commands are not an operating model. A production team needs explicit answers for who may update which refs, how proposed work is reviewed, how releases are named, how automation proves exact source provenance, how secrets and signing keys are kept out of source, how lost work is recovered, how performance is maintained, and how a failed server is restored.

This capstone integrates the previous 25 chapters into one local, no-account simulation. Git mechanics come first; hosted controls such as protected branches, required checks, permissions, merge queues, and CI token scopes remain server/platform responsibilities.

2. Read-only evidence before any operational change

git --version
git status --porcelain=v2 --branch
git rev-parse --verify HEAD^{commit}
git show-ref
git for-each-ref --sort=refname --format='%(refname) %(objectname)'
git reflog -10 --all
git remote -v
git config --list --show-origin --show-scope
git count-objects -vH
git fsck --full

These commands establish worktree/index state, exact commit identity, refs, recent local ref motion, remote destinations, effective configuration, storage shape, and object/connectivity integrity. They do not prove authorization, signer identity, credential secrecy, or successful deployment.

3. Atlas Service requirements and roles

Role Responsibility Git requirement
Contributor develop change topic refs; no release authority
Integrator review and integrate stable shared trunk
Release automation record release state dedicated monotonic release ref
CI/GitOps automation build/reconcile exact source read exact commit; separate applied state

In the mandatory lab these are separate local clones. In production the server must enforce the intended permissions.

4. Target topology

Governed local Git topology
flowchart TD
C[Contributor clone] -->|topic push| S[(Bare central server)]
I[Integrator clone] -->|reviewed integration| S
B[Release bot] -->|release-state ref| S
S -->|exact commit| R[Detached CI runner]
S -->|desired commit| G[Reconciler]
G --> A[Applied-state marker]
S --> U[Verified full bundle]
S --> M[Recovery mirror]

The arrows represent controlled state transitions. CI and reconciliation consume immutable commits; automation writes only its dedicated ref; backup copies are independently verified.

5. Collaboration and integration policy

Contributors may rewrite unpublished private topic work. Once a ref is shared for review, the reviewed tip must be identified by immutable OID. The integrator compares the exact proposal against the current target, runs validation, and advances the shared integration ref without overwriting unseen work. A hosted pull request is an optional policy/UI layer around these Git mechanics.

6. Release policy

A release tag is a human-facing name for an immutable object. Published release tag names are treated as immutable. Release automation writes metadata to a dedicated branch/ref using ordinary fast-forward history. If a published tag is wrong, the policy prefers a new corrected version instead of silently retargeting the old name.

7. Recovery objectives

  • The recovery artifact must contain every intended ref in the final snapshot.
  • A replacement bare repository must be reconstructable without the original server.
  • Source and restored refname + objectname snapshots must match for the governed namespace.
  • Incident response must not expire reflogs or prune unreachable objects while evidence is needed.

8. Trust boundaries

Question Control
Are objects structurally valid and connected? content addressing + git fsck
Who cryptographically signed an object? OpenPGP/X.509/SSH signature + trust policy
Who may update a server ref? server authorization/hooks/protected refs
Is a credential still secret? secret storage and rotation/revocation
Should Git trust repository ownership/config? ownership and narrowly scoped safe.directory

9. Automation identity, authentication, signing, and authorization are separate

user.name and user.email are commit metadata. SSH/HTTPS credentials authenticate to a server. Cryptographic signatures attest a payload under a configured key. Server rules decide whether that identity may update a ref. Do not collapse these controls into one notion of “trusted bot.”

10. CI provenance is branch-independent

COMMIT=$(git rev-parse --verify HEAD^{commit})
TREE=$(git rev-parse --verify HEAD^{tree})
CLEAN=$(test -z "$(git status --porcelain=v1)" && echo true || echo false)
printf 'commit=%s\ntree=%s\nclean=%s\n' "$COMMIT" "$TREE" "$CLEAN"

The exact commit OID is durable provenance; branch/event names are contextual labels. Do not assume fixed 40-character SHA-1 IDs.

11. GitOps separates desired from applied state

desired_commit = source ref resolved to an immutable commit
candidate       = validated artifact/config being applied
applied_commit  = last commit applied successfully
observed_state  = what the target system currently reports

Git stores desired state; Git itself does not prove that deployment succeeded.

12. Scale choices target measured bottlenecks

Problem Mechanism
large working-tree scan FSMonitor/untracked cache/sparse checkout
history traversal commit-graph / changed-path Bloom filters
many packs MIDX / incremental maintenance
transfer volume partial or shallow clone with tradeoffs
large binaries Git LFS external object storage

The capstone uses a modest repository, so it demonstrates measurement and safe auxiliary maintenance instead of claiming a synthetic speedup.

13. Retention, auditability, and operational ownership

Reflogs, unreachable objects, bundles, mirrors, and old server copies aid recovery but can also retain sensitive history. Assign owners for retention, signing trust, credential rotation, secret scanning, maintenance, backup verification, restore drills, and hosted policy. For integrations/releases, capture source OID, target ref before/after, validation result, and signature state where required.

14. Measurable acceptance criteria

Capability Evidence
Integration reviewed topic OID + passing tests + safe ref advance
Release tag resolves to approved commit + release state records same OID
CI detached HEAD equals requested OID + clean provenance
Integrity git fsck --full succeeds on healthy copy
Performance baseline measured; auxiliary structures verify; refs unchanged
Recovery bundle verifies; restored refs/OIDs match intended source

15. Runbooks and failure injection

A runbook records preconditions, evidence commands, mutation steps, expected outcomes, rollback criteria, and verification. Failure injection is useful only when it is isolated and recoverable; the capstone never asks learners to damage valuable repositories.

16. DevOps connection

A governed repository is part of the software supply chain. Git provides local/distributed mechanics; servers, CI, deployment systems, and organization policy complete the control plane. The goal is an auditable system another operator can understand and recover.

17. Knowledge check

Does a clean fsck prove a commit was authorized?

Why use a dedicated monotonic release-state ref?

What is the durable CI source identity?

Why keep applied state separate?

Why avoid pruning during an incident?

18. Summary

The target architecture is a governed set of roles, refs, trust boundaries, automation paths, scale choices, recovery artifacts, runbooks, and measurable acceptance evidence.

Next

Implement the operating model

Lesson 2 builds the repositories, review/integration flow, release/signing path, exact CI provenance, guarded automation, safe maintenance, and offline recovery proof.

Authoritative references

 Git documentation
 git-push
 git-fsck
 signature formats
 git-maintenance

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0 Send only Ethereum/ERC-20 compatible assets to this address.