How we approach CI/CD

Reading time5min


Updated


Authors

CI/CD (Continuous Integration and Continuous Deployment) is how a change gets from a pull request to production. Our pipelines build, test and deploy every change.

We use GitHub, and all CI runs on Depot CI.

Small changes, shipped often

We prefer small pull requests that ship many times a day. A small change is easier to review and to roll back.

Pull requests

Every pull request runs our checks: tests, linting, type checks and builds. A change cannot merge until the checks pass and it has an approval.

To see a change before it merges to main:

  • For dashboard and website changes, open the Vercel preview URL on the PR.
  • For backend changes, add the deploy-staging label to deploy the PR to our staging environment.
  • For infrastructure changes, read the CDK diff on the PR to see what will change in AWS.

We ask for reviews in the #review-pr Slack channel by @-ing a person with context or the relevant squad.

AI reviewers also review every PR. For a small change, an AI reviewer can approve it.

An approved PR goes into a merge queue. The queue tests it together with the PRs ahead of it, then squash merges it into main. This catches two PRs that pass alone but fail together before they reach main.

Main and staging

Every merge to main builds the changed apps and deploys them to staging. We build each image once. Staging and production run that same image.

Production

Production deploys from the production branch. Every 5 minutes, a deploy train rebases it onto the newest commit on main where all checks passed. When a change must go out sooner, we promote it by hand.

Database migrations run before the apps deploy, so the code must be backward compatible with both schemas. A schema change usually needs a follow-up PR that makes the new code the default.

Each deploy also gets a tag and a GitHub Release, so we can see what is live and what changed.

A deploy does not have to release a feature to users. We use feature flags to separate deployments from releases.

When something breaks

We fix forward on main. There are no hotfix branches and no commits that exist only on production.

When production is broken, we stop the impact first:

  • Roll back to the tag of an earlier deploy. Nothing rebuilds. We have two levels:
    • All of production, including infrastructure. This resets production to the tag. We use it when more than one app is broken or the bad deploy changed infrastructure.
    • Per app. This rolls back one or more apps to a tag and leaves the rest of production as it is.
  • Freeze production. A freeze stops the deploy train until the fix lands on main. A rollback freezes production automatically.

Then we ship the fix through the normal path and lift the freeze. See how we handle incidents for the rest.

Visibility and automation

Every staging and production deploy posts to a Slack channel, with the result in a thread. Production deploy messages mention the author of every change they ship. When a deploy fails, an AI agent reads the logs and opens a fix or revert PR.

We can roll back from Slack. A freeze and its lift both mention the whole engineering team, so everyone sees when production is frozen.