Cicd_overview
Chapter 46: CI/CD Overview
Section titled “Chapter 46: CI/CD Overview”CI/CD stands for Continuous Integration and Continuous Delivery (or Deployment). It’s a methodology that automates the process of integrating code changes and delivering them to production.
What is CI/CD?
Section titled “What is CI/CD?”┌─────────────────────────────────────────────────────────────────────────────┐│ CI/CD Pipeline │├─────────────────────────────────────────────────────────────────────────────┤│ ││ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ││ │ Code │───▶│ CI │───▶│ CD │───▶│ Staging│───▶│Production│ ││ │ Commit │ │ Build & │ │Deliver │ │ Test │ │ Deploy │ ││ │ │ │ Test │ │ │ │ │ │ │ ││ └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘ ││ ││ CI: Continuous Integration ││ CD: Continuous Delivery (or Deployment) ││ │└─────────────────────────────────────────────────────────────────────────────┘Continuous Integration (CI)
Section titled “Continuous Integration (CI)”┌─────────────────────────────────────────────────────────────────────────────┐│ Continuous Integration │├─────────────────────────────────────────────────────────────────────────────┤│ ││ Developer 1 Developer 2 Developer 3 ││ │ │ │ ││ └─────────────┼─────────────┘ ││ │ ││ ▼ ││ ┌──────────────┐ ││ │ Code Repo │ ││ │ (Git) │ ││ └──────┬───────┘ ││ │ ││ │ Push ││ ▼ ││ ┌──────────────┐ ││ │ CI Server │ ││ │ │ ││ │ ┌──────────┐ │ ││ │ │ Build │ │ Compile, lint, test ││ │ └──────────┘ │ ││ │ ┌──────────┐ │ ││ │ │ Test │ │ Unit, integration tests ││ │ └──────────┘ │ ││ │ ┌──────────┐ │ ││ │ │ Package │ │ Create artifacts ││ │ └──────────┘ │ ││ └──────┬───────┘ ││ │ ││ ▼ ││ ┌──────────────┐ ││ │ Artifacts │ ││ │ Docker Image│ ││ │ JAR/ZIP │ ││ └──────────────┘ ││ ││ Benefits: ││ ✓ Detect issues early ││ ✓ Automated testing ││ ✓ Consistent builds ││ ✓ Faster feedback ││ │└─────────────────────────────────────────────────────────────────────────────┘Continuous Delivery vs Deployment
Section titled “Continuous Delivery vs Deployment”┌─────────────────────────────────────────────────────────────────────────────┐│ Continuous Delivery vs Continuous Deployment │├─────────────────────────────────────────────────────────────────────────────┤│ ││ Continuous Delivery: ││ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ││ │ Build │───▶│ Test │───▶│ Stage │───▶│ Ready │ ││ │ │ │ │ │ │ │ for Prod│ ││ └─────────┘ └─────────┘ └─────────┘ └────┬────┘ ││ │ ││ Manual Approval ────┘ ││ ││ Continuous Deployment: ││ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ││ │ Build │───▶│ Test │───▶│ Stage │───▶│Production│ ││ │ │ │ │ │ │ │ Auto │ ││ └─────────┘ └─────────┘ └─────────┘ └─────────┘ ││ ││ Fully automated after commit ││ │└─────────────────────────────────────────────────────────────────────────────┘CI/CD Pipeline Stages
Section titled “CI/CD Pipeline Stages”┌─────────────────────────────────────────────────────────────────────────────┐│ Pipeline Stages │├─────────────────────────────────────────────────────────────────────────────┤│ ││ 1. Source ││ ┌─────────────────────────────────────────────────────────────────────┐ ││ │ Code push → Trigger pipeline → Clone repository │ ││ └─────────────────────────────────────────────────────────────────────┘ ││ ││ 2. Build ││ ┌─────────────────────────────────────────────────────────────────────┐ ││ │ Compile code → Package application → Create Docker image │ ││ └─────────────────────────────────────────────────────────────────────┘ ││ ││ 3. Test ││ ┌─────────────────────────────────────────────────────────────────────┐ ││ │ Unit tests → Integration tests → Security scans → Performance │ ││ └─────────────────────────────────────────────────────────────────────┘ ││ ││ 4. Deploy ││ ┌─────────────────────────────────────────────────────────────────────┐ ││ │ Deploy to staging → Run smoke tests → Deploy to production │ ││ └─────────────────────────────────────────────────────────────────────┘ ││ ││ 5. Monitor ││ ┌─────────────────────────────────────────────────────────────────────┐ ││ │ Track metrics → Alert on failures → Rollback if needed │ ││ └─────────────────────────────────────────────────────────────────────┘ ││ │└─────────────────────────────────────────────────────────────────────────────┘CI/CD Tools
Section titled “CI/CD Tools”┌─────────────────────────────────────────────────────────────────────────────┐│ CI/CD Tools │├─────────────────────────────────────────────────────────────────────────────┤│ ││ Open Source: ││ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ││ │ Jenkins │ │GitLab CI │ │ CircleCI│ │ Travis │ ││ └──────────┘ └──────────┘ └──────────┘ └──────────┘ ││ ││ Enterprise: ││ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ││ │ Jenkins X │ │ GitHub Actions│ │ Azure DevOps │ ││ └──────────────┘ └──────────────┘ └──────────────┘ ││ ││ Cloud-Native: ││ ┌──────────────┐ ┌──────────────┐ ││ │ AWS CodePipeline │ Google Cloud Build │ ││ └──────────────┘ └──────────────┘ ││ │└─────────────────────────────────────────────────────────────────────────────┘Summary
Section titled “Summary”In this chapter, you learned:
- What is CI/CD
- Continuous Integration (CI)
- Continuous Delivery vs Deployment
- Pipeline stages
- CI/CD tools overview