I'm using Capistrano 3.
I want to trigger a webhook to a external service, when my deployment fails.
It's a matter of calling a method I have already defined, let's say it's called mark_failed.
How I can ensure the method is always called when the deployment fails, for whatever reason, except aborting it via CTRL+C ?
Tried fiddling around with
rescue SystemExit, Interrupt and rescue StandardError
I have no clue where to put my method call the way it will be called reliably.
Any clues ?
I would suggest using at_exit.
at_exit do
mark_failed if $!
end
raise "Something is wrong!"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With