No commit activity in last 3 years
No release in over 3 years
Capistrano extension to pin and unpin releases. Pinned releases don't get deleted during `deploy:cleanup`. Unpin the release to unprotect it.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.17
~> 10.0

Runtime

 Project Readme

Capistrano: Pinned Releases

📌 Pin and unpin capistrano releases. Pinned releases don't get deleted during cleanup.

Capistrano 3.0+ only.

Installation

Add this line to your application's Gemfile:

gem 'capistrano-pinned_releases'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install capistrano-pinned_releases

Usage

The extension provides following tasks, all under the deploy:pinned namespace.

  1. list: List all currently pinned releases:

     deploy:pinned:list
    

    This prints a comma separated list of currently pinned releases:

     ** Execute deploy:pinned:list
     20190220192205, 20190225190753
    
  2. pin: Pin a given release:

     cap production deploy:pinned:pin RELEASE_NAME=20190220192205
    

    without the RELEASE_NAME environment variable, it pins the current release:

     cap production deploy:pinned:pin
    
  3. unpin: Unpin a given release:

     deploy:pinned:unpin RELEASE_NAME=20190220192205
    

    without the RELEASE_NAME environment variable, it unpins the current release:

     deploy:pinned:unpin
    
  4. unpin_old: Unpin old pinned releases; defaults to keeping the same number as keep_releases

     deploy:pinned:unpin_old
    

    Helpful if running before cleanup

     after "deploy:pinned:unpin_old", "deploy:cleanup"
    

These tasks can be run individually, but they're far more useful when used during the capistrano release lifecycle:

    after 'sidekiq:restart', 'deploy:pinned:pin'

Or, as a part of other tasks:

rake my_task: :environment do
  if capture(:some_command_on_server, :arg1, :arg2)
    invoke 'deploy:pinned:pin'
  else
    invoke 'deploy:pinned:unpin'
  end
end

# etc.

⚠️ This extension overrides the default deploy:cleanup task, in order to prevent releases from getting deployed. If you have an extension that also overrides the default behavior on deploy:cleanup, then this extension won't work for you. To work around, make sure you are not calling

Rake::Task["deploy:cleanup"].clear_actions

anywhere within your code.

Development

Please fork your copy, and do all your work on an appropriately named branch. After checking out the repo, run bin/setup to install dependencies.

Contributing

Bug reports and pull requests are welcome!