【问题标题】:Capistrano - mark deployment as failedCapistrano - 将部署标记为失败
【发布时间】:2017-05-09 08:41:40
【问题描述】:

我正在使用 Capistrano 3。

我想在部署失败时触发外部服务的 webhook。

这是调用我已经定义的方法的问题,假设它被称为mark_failed

我如何确保在部署失败时始终调用该方法,无论出于何种原因,除了通过 CTRL+C 中止它?

试着摆弄

rescue SystemExit, Interruptrescue StandardError

我不知道将我的方法调用放在哪里才能可靠地调用它。

有什么线索吗?

【问题讨论】:

    标签: deployment capistrano3


    【解决方案1】:

    我建议使用at_exit

    at_exit do
       mark_failed if $!
    end
    raise "Something is wrong!"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多