CI/CD & Deployment interview question · Most asked

What stages does a typical CI/CD pipeline contain?

Summary

Checkout → install dependencies (cached) → lint and type-check → unit tests → build artifact/image → integration tests → security scans (SAST, dependencies, image) → publish artifact → deploy to staging → smoke/E2E tests → deploy to production (progressively) → post-deploy verification.

Longer Answer

Fail fast: run cheap checks first. Build the artifact once and promote the same artifact across environments.

Code Example

# .github/workflows/ci.yml (excerpt)
jobs:
  test:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:17
        env: { POSTGRES_PASSWORD: test }
        ports: ["5432:5432"]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with: { python-version: "3.13", cache: pip }
      - run: pip install -r requirements.txt
      - run: ruff check . && mypy app
      - run: pytest -q

Key Points

  • Lint/type-check first
  • Tests and scans
  • Build once, promote everywhere
  • Staging then production
  • Post-deploy checks

More most-asked CI/CD & Deployment questions

← All CI/CD & Deployment questions