Course map
Stage 1: Foundations
Stage 2: Data Integration
Stage 3: Building & Shipping
Stage 4: Customer Engagement
Stage 5: Specialization

Part 10 / Topic 6 of 6

CI/CD

Continuous integration runs your tests, linter and type checker on every push (Part 3); continuous delivery turns a passing build into a deployable artifact — the container image — and releases it in a controlled way. For engagement work the pipeline can be small, but three properties are non-negotiable:

  1. Per-environment config is checked in CI, as data, before anything deploys:
# examples/02_environment_differences_as_data_checked_before.py
ENVIRONMENTS = {
    "dev":     {"replicas": 1, "log_level": "DEBUG", "acme_api_url": "https://sandbox.acme.example", "pii_logging": True},
    "staging": {"replicas": 2, "log_level": "INFO",  "acme_api_url": "https://sandbox.acme.example", "pii_logging": False},
    "prod":    {"replicas": 3, "log_level": "INFO",  "acme_api_url": "https://api.acme.example",     "pii_logging": False},
}
RULES = [
    ("prod has at least 2 replicas", lambda name, c: name != "prod" or c["replicas"] >= 2),
    ("prod never logs PII", lambda name, c: name != "prod" or not c["pii_logging"]),
    ("prod uses the real API", lambda name, c: name != "prod" or "sandbox" not in c["acme_api_url"]),
    ("no DEBUG logging outside dev", lambda name, c: name == "dev" or c["log_level"] != "DEBUG"),
]
problems = [(env, rule) for env, cfg in ENVIRONMENTS.items() for rule, check in RULES if not check(env, cfg)]
print("config problems:", problems or "none")
# config problems: none
  1. Releases are versioned and reversible — deploying v1.4.2 implies being able to go back to v1.4.1 with one command.
  2. The customer can run it. Their CI system, their approval gates. A release process only you can execute is another failed handoff.

The config-rules idea deserves its own sentence: environment differences written as data and checked by named rules turn "we think prod is right" into "these four assertions pass". It catches the sandbox-URL-in-prod class of incident at review time.

🧪 Quick quiz

  1. Where should environment-specific settings (URLs, replicas, log level) live?
Show the answer

In configuration per environment, checked by automated rules — the rule check confirmed prod has 2+ replicas, never logs PII and uses the real API. (verified against the example output above)

Done here? The practice set for Part 10 — 4 exercises with solutions — is on the part page.

Search the guide