phallstrom / slackistrano

Slack integration for Capistrano deployments.
MIT License
374 stars 74 forks source link

Sending some info or stack trace when there are errors #34

Closed ghost closed 7 years ago

ghost commented 8 years ago

Hello I'm new to slackistrano and wondering if I could setup a message when deploy fails about the errors or the stack trace of the error.

Thanks in advance

ghost commented 8 years ago

We already use slackistrano to send this kind of message: "ERROR!​ mmoreno failed to deploy branch master of Gorilla to staging."

But we whant to be able to send something like

ERROR!*​ mmoreno failed to deploy branch master of Gorilla to staging. {{and here capistrano output or stack trace}}

phallstrom commented 8 years ago

Interesting. That might be a lot of output :) If capistrano can get access to that somehow we could do it. Not sure I'll get to it soon, but if you can poke around to see if you can access it within capistrano and post some code it would help.

ghost commented 8 years ago

I wil try these days... I'll let you know... thanks

jherdman commented 8 years ago

For what it's worth, I was just poking around in the issue log here to see if this feature was available.

itsSaad commented 7 years ago

this might allow us to do that. https://github.com/capistrano/capistrano/issues/708

phallstrom commented 7 years ago

With the latest release of Slackistrano I think you can do this yourself via custom messaging.

https://github.com/phallstrom/slackistrano#customizing-the-messaging

With a class something like this:

module Slackistrano
  class CustomMessaging < Messaging::Base
     def payload_for_failed
      # Do whatever you need to do with $! per
      # https://github.com/capistrano/capistrano/issues/708#issuecomment-254844192
    end
  end
end

If one of you comes up with something useful let me know. I'd like to add more custom messaging examples to the wiki and this seems like a good one.