What are the key stages of a CI/CD pipeline? What is the difference between CI and CD?
CI vs CD
Continuous Integration (CI) Developers frequently merge code to the main branch; each merge automatically triggers a build and tests to catch problems early.
Continuous Delivery Builds on CI — ensures the software is always in a deployable state, but deployment requires manual triggering.
Continuous Deployment Goes further — automatically deploys to production after all automated tests pass, with no human intervention.
Typical CI/CD Pipeline Stages
- Source: Code push or PR triggers the pipeline
- Build: Compile, package, create Docker image
- Unit Test: Fast unit tests (seconds)
- Integration Test: Integration tests (minutes)
- Security Scan: SAST static analysis, dependency vulnerability scanning
- Push Artifact: Push image to Container Registry
- Deploy to Staging: Deploy to test environment
- E2E Test: End-to-end tests
- Deploy to Production: Deploy to production (manual or automatic)
GitHub Actions Example Snippet
on: push: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: npm ci - run: npm test
Fail Fast Principle
Put the fastest tests first (unit tests before integration tests) so developers get feedback quickly — avoiding the need to wait for slow E2E tests before discovering basic issues.
✦ AI Mock Interview
Type your answer and get instant AI feedback
Sign in to use AI scoring
