Notify the Slack user of success/failure of an entire workflow trigger by that user's commit

Right now as far as I can tell, you have the ability to Slack two ways; via a configuration on the project, and via orbs (namely the slack orb).

The project configuration must be done via the UI; as far as I can tell, there’s no way to do this programmatically via the API or circle.yml. We have 200+ microservices GitHub repos, so this just doesn’t work for us at all.

I was able to build a workaround with a precommit hook that checks the current user and updates the .circle.yml file to use the Slack orb to notify whoever the user is that made the commit when the workflow fails. This is fine; but when the failure happens within other orbs - like when a Cypress test fails - there’s no way for me to catch that and get notified. So; I can’t get Slack notified when a Cyrpess run fails, which means my builds can go into a black hole.

The request then is a way to:

a) Associate my Github username to a Slack channel (or Slack User)
b) Whenever a commit triggers a build, to send a message to the appropriate Slack channel whenever the workflow succeeds (one message) or fails (another message)
c) Make this configurable via the circle.yml so we can source control and manage it across 500+ projects

Without this, I have no way to know if I broke a build unless I remember to check. There’s too much noise in a shared channel, so I tune it out. As a result, I end up with a bunch of builds that have been broken for weeks before I notice, which defeats a lot of the point of Continuous Integration.

Other stuff:

  • I tried desktop notifications, but this notifies me on every job in a workflow - which is noisy and thus not too useful to me. Also - only configurable via the UI, so not really manageable
  • I found SeaEye https://github.com/nolaneo/SeaEye; but it broke as soon as I ran it. Doesn’t seem like it’s being too actively maintained; also, you have to type in projects (you can’t follow ALL projects) and with 500+ projects, not workable.

Any thoughts?

Thanks,
Andrew

1 Like

Not sure if this directly suits your needs but I’ve configured something similar by including on_fail and on_success slack webhooks for relevant jobs.

So for example:

jobs:
   testing:
      steps:
         - run:
             when: on_fail
             command: |
                curl -X POST {slack-webhook-url} -d '{webhook-variables-for-slack-message}'

Thanks… I’ve done something similar.

But it doesn’t work within Cypress orbs… so I can’t get notified when Cypress jobs fail. Need a more comprehensive solution…

@andrewryan1906 better late than never… The way we worked around “custom orbs” was to add the slack orb command to “post_steps”. I wish there was a way to trigger it per-workflow rather than per-job though…