#2120·capistrano

Capistrano deletes last working deployment if recovering from too many failures

Author: tminichCreated Jan 12, 2023Updated May 22, 2026

Steps to reproduce

  • Have X or more deployments fail (X being keep_releases-1)
  • Have a successful deployment

Expected behavior

Capistrano keeps (at least) the last known working release

Actual behavior

Last known working release gets deleted and failed releases are kept so there is no working release to roll back to if necessary

Arguably keep_releases should apply to successful and failed deployments separately (or there should be separate configuration options for these cases). I went through the code a bit and from what I can see (not very familiar with Ruby) capistrano doesn't seem to discern between failed and successful deployments for cleanup and rollback at all, which, to be honest, seems a bit strange to me for a deployment tool.