CI/CD is a fundamental practice of modern development. Automate everything.
CI — Continuous Integration¶
Every push leads to build, test, and feedback. Goal: find bugs as early as possible.
- Automatic build on every push
- Unit + integration tests
- Linting and static analysis
- Security scanning
CD — Continuous Delivery vs Deployment¶
Delivery: code is always ready to deploy (manual approval). Deployment: automatic deploy after tests.
GitHub Actions Example¶
name: CI/CD
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm test
deploy:
needs: test
if: github.ref == ‘refs/heads/main’
runs-on: ubuntu-latest
steps:
- run: deploy.sh
Deployment Strategies¶
- Rolling — gradual replacement of instances
- Blue/Green — two identical environments, switch
- Canary — 5% traffic to new version, monitor metrics
- Feature flags — deploy code, toggle feature
Tools¶
- GitHub Actions, GitLab CI, CircleCI
- ArgoCD (GitOps for K8s)
- Jenkins (enterprise legacy)
- Tekton (cloud-native)
DORA Metrics¶
- Deployment frequency
- Lead time for changes
- Mean time to recovery (MTTR)
- Change failure rate
Goal¶
Deploying to production should be boring, routine, risk-free. If deploying stresses you out, you need better CI/CD.