# CI CD pipelines CI/CD pipelines are automated workflows that implement [[Continuous Integration (CI)]] and [[Continuous Delivery (CD)|Continuous Delivery]]/[[Continuous Deployment (CD)|Deployment]]. They automate the process of building, testing, and deploying code changes, forming the backbone of modern [[DevOps]] practices. Pipelines are typically defined as code (often in [[Yet Another Markup Language (YAML)|YAML]]) and triggered automatically by events like code pushes or [[Pull Requests (PRs)|pull requests]]. ## Pipeline Stages ``` ┌─────────────────────────────────────────────────────────────┐ │ CI/CD Pipeline │ │ │ │ Source → Build → Test → Security → Stage → Deploy → Monitor│ │ ↓ ↓ ↓ ↓ ↓ ↓ ↓ │ │ Commit Compile Unit SAST/ Deploy Prod Alerts │ │ Push Package E2E DAST Preview Release Metrics │ └─────────────────────────────────────────────────────────────┘ ``` ## Common Stages | Stage | Purpose | Tools | |-------|---------|-------| | **Source** | Trigger on code change | Git hooks, webhooks | | **Build** | Compile, package | npm, Maven, Docker | | **Test** | Verify correctness | Jest, pytest, Selenium | | **Security** | Scan vulnerabilities | Snyk, SonarQube, Trivy | | **Deploy** | Release to environment | Kubernetes, AWS, Terraform | ## Popular Platforms - **[[GitHub]] Actions**: YAML workflows in `.github/workflows/` - **[[GitLab]] CI/CD**: YAML pipelines in `.gitlab-ci.yml` - **Jenkins**: Groovy-based Jenkinsfile - **CircleCI**: Cloud-native CI/CD - **Azure Pipelines**: Microsoft's CI/CD service ## Example (GitHub Actions) ```yaml name: CI/CD Pipeline on: [push, pull_request] jobs: build-test-deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: npm install - run: npm test - run: npm run build - run: ./deploy.sh if: github.ref == 'refs/heads/main' ``` ## References - https://en.wikipedia.org/wiki/CI/CD ## Related - [[Continuous Integration (CI)]] - [[Continuous Delivery (CD)]] - [[Continuous Deployment (CD)]] - [[DevOps]] - [[DevSecOps]] - [[Static Application Security Testing (SAST)]] - [[Software Composition Analysis (SCA)]] - [[GitHub]] - [[GitLab]] - [[Yet Another Markup Language (YAML)]]