π CI/CD Pipelines β
Automating build, test, and deployment for reliable delivery.
CI vs CD β
- Continuous Integration (CI) β Automatically build and test on every push
- Continuous Delivery (CD) β Automatically prepare deployable artifacts
- Continuous Deployment β Automatically deploy to production
Pipeline stages β
Code Push β Lint β Build β Unit Tests β Integration Tests β Deploy Staging β E2E Tests β Deploy ProductionCI pipeline essentials β
- [ ] Lint and format check
- [ ] Build the application
- [ ] Run unit tests
- [ ] Run integration tests
- [ ] Security scan (dependencies + code)
- [ ] Build Docker image (if applicable)
- [ ] Publish artifacts
CD pipeline essentials β
- [ ] Deploy to staging automatically
- [ ] Run smoke tests on staging
- [ ] Manual approval gate (or auto-deploy)
- [ ] Deploy to production
- [ ] Health check post-deploy
- [ ] Notify team of deployment
Deployment strategies β
| Strategy | Downtime | Risk | Complexity |
|---|---|---|---|
| Rolling | None | Medium | Low |
| Blue-Green | None | Low | Medium |
| Canary | None | Low | High |
| Feature flags | None | Low | Medium |
| Recreate | Yes | High | Low |
Best practices β
- Pipeline must be fast β under 10 minutes for CI
- Fail fast β run cheapest checks first (lint before tests)
- Cache dependencies between runs
- Use the same build artifact across all environments
- Store secrets in vault, never in pipeline files
- Make pipelines reproducible β pin dependency versions
- Monitor pipeline success rate and duration
Common tools β
| Tool | Type |
|---|---|
| GitHub Actions | CI/CD |
| GitLab CI | CI/CD |
| Docker | Containerization |
| Terraform | Infrastructure as Code |
| ArgoCD | GitOps deployment |
| Renovate / Dependabot | Dependency updates |