4

Heroku has this great Slack chatbot (chatops) that lets you send messages if a deployment pipeline succeeded or failed. Unfortunately, while setting it up and logging in to Heroku, it asks for your github account and will not let you chose a different DVCS provider.

Since I am using Bitbucket, this leaves me without a solution for pipeline notifications. Has anyone solved this in the past?

4

ChatOps uses GitHub status checks, so it's decidedly GitHub specific and won't work with another provider.

However, if you're just after notifications, what about Heroku's App webhooks? They have an 'entity' for new app releases (api:release) which might partially help you... in that you can set up a notification for successful releases, at least.

Alternatively, you could listen to the api:build entity's create event to know when a build starts, and the update event to know when its status changes - which I haven't used but presume would include a field for whether it succeeded or failed.

To subscribe to a webhook, you use the Heroku CLI:

heroku webhooks:add --include api:build --level sync --url https://example.com/hooks

This is outlined in more detail in the documentation here. The payload you receive will look like this.

This isn't going to get it straight into Slack for you though, so you'll need a piece of middleware to do that. Here's a tiny Sinatra app I forked from a fork. It converts Docker Hub notifications into the format Slack expects for an incoming webhook. It should be pretty easy to edit it to make it convert Heroku webhooks instead. Then, voila, the tiny app itself deploys on Heroku, and that's the URL you stick in the webhook subscription above.

This is probably a lot more steps than you wanted. Someone may have already done it somewhere... but I can say that at least doing it the above way will give you a lot more flexibility to create your own customised workflows where you need them!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.