Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capistrano deletes last working deployment if recovering from too many failures #2120

Open
tminich opened this issue Jan 12, 2023 · 1 comment

Comments

@tminich
Copy link

tminich commented Jan 12, 2023

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.

@mattbrictson
Copy link
Member

Hi @tminich, thanks for the report and apologies for the lack of response.

capistrano doesn't seem to discern between failed and successful deployments for cleanup and rollback at all

That's correct. Capistrano does not have any way to mark a deployment as succeeded or failed. This is why keep_releases does not distinguish which releases get deleted.

I think this is a long-standing design decision and predates my time with Capistrano.

However, I definitely understand that this behavior could be surprising. Perhaps it should be documented somewhere? I would be open to accepting a PR that updates the keep_releases section of the documentation, for example.

* `:keep_releases`
* **default:** `5`
* The last `n` releases are kept for possible rollbacks.
* The cleanup task detects outdated release folders and removes them if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants