Skip to main content
1:1 mock interviews with Sumit, scored on a real hiring rubric.Book a slot →
TOPIC 5 OF 5 · 2 MIN READ

CI/CD and Safe Deployments

CI/CD turns every merge into a tested, deployable build. Interviewers ask what a pipeline should contain and how to deploy without downtime: rolling, blue-green and canary releases, and database migrations during deploys.

What you will learn

  • List the stages of a backend pipeline
  • Compare rolling, blue-green and canary deployments
  • Run migrations without downtime
  • Use feature flags and rollbacks

Key concepts

CI

Continuous integration: on every push, install, lint, type-check, run tests and build an image. A red build blocks the merge.

Blue-green

Run the new version (green) next to the old one (blue), test it, then switch traffic at once. Rollback is switching back.

Canary

Send a small share of traffic (1%, then 10%, then 50%) to the new version while watching error rates and latency; roll back automatically if they get worse.

Feature flag

Ship code turned off and enable it per user or percentage at runtime. Separates deploying from releasing.

Step by step

A typical pipeline

  • Lint + type-check
  • Unit tests
  • Integration tests with PostgreSQL and Redis containers
  • Build and scan the image
  • Push to a registry
  • Deploy to staging, run smoke tests
  • Canary or rolling deploy to production
  • Watch metrics; roll back on alert

Examples

GitHub Actions CI

name: ci
on: [push, pull_request]
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-node@v4
        with: { node-version: 24, cache: npm }
      - run: npm ci
      - run: npm run lint
      - run: npm test
        env: { DATABASE_URL: postgres://postgres:test@localhost:5432/postgres }

Practise it

Try these without looking back. If you can explain each one out loud, you are ready for this question.

  • Plan a deploy that renames a database column without downtime.
  • Define the metrics that should trigger an automatic canary rollback.

Interview questions

What interviewers ask next on this topic. Answer out loud first, then open the model answer.

Continuous delivery vs continuous deployment?

Continuous delivery keeps every build ready to release, with a manual approval to go to production. Continuous deployment releases every passing build to production automatically.

How do you roll back a bad release that ran a migration?

Make migrations backward compatible (expand and contract) so the previous app version still works with the new schema, then roll back only the app. Avoid destructive migrations in the same release as the code that needs them.

Summary

A pipeline lints, tests against real dependencies, builds and scans images, and deploys gradually with canaries or blue-green, backward-compatible migrations, feature flags and fast rollback.

Stuck on this one? Talk to Sumit.

Keys: F focus mode · ← → previous / next topic · Esc leave focus