📖 Lecture — From Commit to Container: CI/CD for Your Capstone

For six weeks you've been assembling a toolbox: containers, cloud deployment, model serving, fine-tuning, agents, RAG, security, and cost management. This week is about the glue that holds a real production system together — the pipeline that takes your code from a local commit to a running, versioned artifact without you manually typing deploy commands at midnight. That glue is CI/CD, and by the end of this lecture you'll understand exactly what it is, why it's structured the way it is, and how to build one for your capstone. CI, CD, and CD — three overlapping terms, one letter apart. "CI/CD" is often said as if it's one thing, but it actually describes a spectrum of automation, and precision here matters for your capstone architecture decisions.

For a solo capstone project, you'll typically land on Continuous Delivery or a light form of Continuous Deployment: your pipeline will automatically build, test, and push a container image, and you decide (manually or via a merge to main) when that image actually goes live. The canonical pipeline: four stages plus a feedback loop. Regardless of which flavor of CI/CD you're running, nearly every pipeline decomposes into the same stages:

Stage What happens Capstone example
Source A commit or pull request triggers the pipeline Push to main or open a PR on GitHub
Build Code is compiled/packaged into a runnable artifact docker build produces your capstone's container image
Test Automated checks verify correctness Linting, unit tests, integration tests run against the build
Deploy The artifact is released to an environment Image is pushed to GHCR (and optionally deployed to your cloud target from AIINFRA 302)
Monitor (feedback loop) Runtime behavior is observed and fed back Logs/metrics from your serving endpoint inform the next commit

Notice that "Monitor" feeds back into "Source" — a production incident or a cost spike you observe (FinOps, from AIINFRA 302) becomes the next commit that starts the loop over. This is why CI/CD is drawn as a loop, not a line. Best practices that make pipelines actually work:

  1. Commit small and often. Large, infrequent commits produce large, hard-to-diagnose failures. Small commits isolate blame quickly.
  2. Automate testing to catch regressions. A pipeline that only builds but never tests is just a build server — it will happily ship a broken image. Tests are what make the pipeline trustworthy enough to automate the next stage.
  3. Provision infrastructure via Infrastructure as Code (IaC). Whatever you configured by hand in AIINFRA 301/302 (a server, a registry, a deployment target) should be reproducible from a file in your repo, not from memory of which buttons you clicked.
  4. Build security checks into the pipeline itself (DevSecOps). Don't treat security as a separate audit that happens after deployment — dependency scanning, secret scanning, and image scanning belong in the pipeline as gates, right alongside your unit tests.

Secrets: the part that goes wrong most often. Your pipeline needs credentials — to push to GHCR, to deploy to a cloud provider. There are two safe patterns:

Correcting three common misconceptions:

By the end of this week, your capstone will have a green pipeline badge, a versioned image sitting in GHCR, and zero credentials sitting in plain text anywhere in your repo. That's a meaningful, resume-worthy milestone — most junior engineers have never built one of these from scratch.