Blue-green deploys and rollback

Jenkins CI/CD Course · lesson 12 of 15 · 5 min read

Two production stacks and a router turn rollback into a switch flip instead of a rebuild.

Open this lesson in the learning hub

Key points

  • Blue-green keeps two identical production stacks and lets only one of them receive live traffic.
  • You deploy to the idle stack, smoke test it against real infrastructure, then move the router to it.
  • Rollback is moving the router back, which takes seconds and needs no rebuild and no redeploy.
  • Keep the old stack alive for at least one release cycle, because tearing it down deletes your rollback.
  • Database migrations do not flip back, so ship them ahead of the code and keep them backward compatible.
  • Deploying an image tag rather than a branch is what makes the previous version still exist to roll back to.

Rollback is only cheap while the previous stack is still running, so retire it on a timer, not at deploy time.

This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the Jenkins CI/CD Course course, and every lesson in it is listed on the Jenkins CI/CD Course contents page.