A rollback is a feature

If going back takes a meeting, you do not have a rollback. You have a second deploy.

Ask a team how they roll back and many will describe how to deploy the previous version: find the commit, rebuild it, push it through the pipeline, wait.

That is not a rollback. It is a second deploy, made under pressure, by somebody who was not planning to make one.

What a rollback is

One action. No build, no decision tree, a few minutes at most. Yesterday’s artifact still exists, and so does everything it needs to run.

If going back requires a meeting, a rebuild or the one person who remembers how, you do not have the feature yet.

Keep the old thing alive

  • Artifacts are immutable and addressed by digest. latest is not a version.
  • The previous ReplicaSets stay around, scaled to zero, for as many releases as you would ever want to go back.
  • Configuration is versioned with the code it belongs to, and travels with it. Rolling back the binary but not its flags is how a small incident becomes a strange one.

Make the database go both ways

Most rollbacks that fail, fail here. A migration that drops a column makes the previous version unable to start, and suddenly “go back” means “restore from backup”.

The discipline is old and dull: expand, then contract. Add the new column. Write to both. Switch the reads. Only several releases later, when nobody could want the old version, remove what it needed. Every step can be undone by deploying the step before it.

Let the pipeline pull the trigger

People are slow to roll back. They want one more graph, one more minute. A pipeline has no pride: give it a budget and it will act the moment the budget is gone.

strategy:
  canary:
    steps:
      - setWeight: 5
      - pause: { duration: 5m }
      - analysis: { templates: [{ templateName: error-rate }] }
      - setWeight: 25
      - pause: { duration: 10m }
      - analysis: { templates: [{ templateName: error-rate }] }
      - setWeight: 100
kind: AnalysisTemplate
metadata: { name: error-rate }
spec:
  metrics:
    - name: http-5xx
      interval: 30s
      failureLimit: 1
      successCondition: result[0] < 0.005
      provider:
        prometheus:
          query: |
            sum(rate(http_requests_total{app="scoring",code=~"5.."}[1m]))
              / sum(rate(http_requests_total{app="scoring"}[1m]))

Five percent of traffic, a pause, a question with a numeric answer. If the answer is wrong twice, the weight goes back to zero and the old version carries on as if nothing had happened. For most users, nothing has.

Models roll back too

A model is an artifact like any other, and “production” should be a pointer in a registry, not a file somebody copied. Keep the previous champion loaded, or at least warm. Rolling back is then moving the pointer.

The trap is the features. A new model that needs a new feature is fine; a feature pipeline that changed the meaning of an old one has quietly broken the model you would roll back to. Features are an API. Version them like one.

Rehearse it

Roll back on a Tuesday afternoon, on purpose, once a month. Time it. Write down what surprised you.

The first rehearsal is always embarrassing. That is the point of having it on a Tuesday.

The best compliment a rollback can get is that nobody remembers it.