Introduction to CI/CD
CI/CD automates the path from code commit to production deployment. It catches bugs early, eliminates manual deployment errors, and lets teams ship software faster and more confidently.
What is Continuous Integration (CI)?
Every code change triggers an automated pipeline:
git push → Build → Test → Lint → Report
Developers integrate code into a shared repository multiple times per day. Each integration is verified by an automated build and test suite.
Benefits:
- Bugs found within minutes, not days
- No “integration hell” at release time
- Always have a known-good build
What is Continuous Delivery (CD)?
Continuous Delivery extends CI — code is always in a deployable state:
CI pipeline → Staging deploy → Manual approval → Production
Continuous Deployment goes further — every passing build deploys to production automatically (no manual gate).
| Practice | Deployment trigger |
|---|---|
| Continuous Integration | Build + test only |
| Continuous Delivery | Ready to deploy; human approves |
| Continuous Deployment | Automatic to production |
Most teams start with CI, add CD to staging, then automate production when confidence is high.
The CI/CD Pipeline
┌─────────┐ ┌───────┐ ┌──────┐ ┌────────┐ ┌──────────┐
│ Trigger │ → │ Build │ → │ Test │ → │ Deploy │ → │ Monitor │
│ (push) │ │ │ │ │ │ staging│ │ │
└─────────┘ └───────┘ └──────┘ └────────┘ └──────────┘
│
┌────▼────┐
│ Deploy │
│ prod │
└─────────┘
Typical Stages
- Trigger — push to branch, Pull Request opened, tag created
- Build — compile code, build Docker image
- Test — unit, integration, end-to-end tests
- Quality gates — lint, security scan, code coverage threshold
- Deploy staging — automatic on merge to
main - Deploy production — manual approval or automatic with feature flags
- Monitor — alerts if error rate or latency spikes post-deploy
CI/CD Without Automation (The Old Way)
Developer commits → waits for weekly build → QA tests manually →
ops deploys Friday night → something breaks → rollback manually
Problems: slow feedback, fear of deploying, big-bang releases, weekend firefighting.
CI/CD With Automation
Developer pushes → CI runs in 5 minutes → PR blocked if tests fail →
merge to main → auto-deploy staging → smoke tests pass →
one-click production deploy → monitoring confirms health
Key Concepts
| Term | Meaning |
|---|---|
| Pipeline | Sequence of automated stages |
| Job | Set of steps run on one agent/runner |
| Stage | Group of jobs (build, test, deploy) |
| Artifact | Output passed between stages (binary, Docker image) |
| Runner/Agent | Machine that executes pipeline jobs |
| Gate | Condition that must pass before next stage |
Example — Node.js CI Pipeline
Conceptual GitHub Actions workflow:
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run build
Every push and PR runs lint + tests. Merge is blocked if CI fails (via branch protection).
Branch Strategy + CI/CD
feature branch → PR → CI runs → review → merge to main → CD deploys
- Feature branches trigger CI on PR
- Main branch triggers CD to staging/production
- Tags (v1.0.0) trigger release builds
CI/CD Tools
| Tool | Type | Best For |
|---|---|---|
| GitHub Actions | Cloud, GitHub-native | GitHub repos |
| GitLab CI | Cloud/self-hosted | GitLab repos |
| Jenkins | Self-hosted | Enterprise, custom plugins |
| CircleCI | Cloud | Fast setup |
| Azure Pipelines | Cloud | Azure/Microsoft ecosystem |
| Argo CD | GitOps deploy | Kubernetes |
Metrics That Matter
| Metric | Target |
|---|---|
| Build time | < 10 minutes for CI feedback |
| Deployment frequency | Daily or on-demand |
| Lead time for changes | Hours, not weeks |
| Mean time to recovery (MTTR) | < 1 hour |
| Change failure rate | < 15% |
(DORA metrics — DevOps Research and Assessment)
What Comes Next
Implement pipelines with GitHub Actions or Jenkins, then apply CI/CD Best Practices for production-grade delivery.