Capistrano 3版on_rollback?

时间:2014-07-17 20:49:16

标签: capistrano capistrano3

升级到capistrano 3,以下似乎不再起作用:

namespace :project do
  desc "Prevents executing by creating lockfile"
  task :disable do
    on roles(:app) do
      execute "touch /tmp/proj_lockfile"
    end
    on_rollback do
      execute "rm /tmp/proj_lockfile"
    end
  end
end

...
NoMethodError: undefined method `on_rollback' for main:Object
config/deploy.rb:34:in `block (2 levels) in <top (required)>'
Tasks: TOP => deploy:starting => transformer:disable
(See full trace by running task with --trace)

这是否有新任务等?

2 个答案:

答案 0 :(得分:3)

没有Capistrano 3相当于on_rollback

在Capistrano 3中,如果任何命令失败,部署将停止,并且正在部署的版本将保留(可能正在工作和部署,可能无法正常工作和部署,或未部署 - Capistrano不再尝试清理在所有)。

请注意,这也意味着:on_error => :continue不受支持而无需替换;您必须自己begin / rescue例外。

rollbacks section of the documentation完全为空。

答案 1 :(得分:-2)

查看“回滚流程”文档:http://capistranorb.com/documentation/getting-started/flow/

deploy:starting
deploy:started
deploy:reverting           - revert server(s) to previous release
deploy:reverted            - reverted hook
deploy:publishing
deploy:published
deploy:finishing_rollback  - finish the rollback, clean up everything
deploy:finished