2018-04-21 20:39:04 +02:00
|
|
|
Get Zulip notifications for your Capistrano deploys!
|
2017-06-05 17:15:20 +02:00
|
|
|
|
2018-04-21 20:39:04 +02:00
|
|
|
1. {!create-a-bot-indented.md!}
|
2017-06-22 02:57:59 +02:00
|
|
|
|
2018-04-21 20:39:04 +02:00
|
|
|
1. {!download-python-bindings.md!}
|
2017-06-05 17:15:20 +02:00
|
|
|
|
2018-04-21 20:39:04 +02:00
|
|
|
1. You can now send Zulip messages by calling the `zulip-send`
|
|
|
|
utility from your `deploy.rb` config file. Here's some example code for
|
|
|
|
sending a Zulip notification when a deployment has completed:
|
|
|
|
|
|
|
|
``` bash
|
2017-06-05 17:15:20 +02:00
|
|
|
after 'deploy', 'notify:humbug'
|
|
|
|
|
|
|
|
namespace :notify do
|
2018-04-21 20:39:04 +02:00
|
|
|
desc "Post a message to Zulip after deploy"
|
2017-06-05 17:15:20 +02:00
|
|
|
task :humbug do
|
2018-04-21 20:39:04 +02:00
|
|
|
run_locally "echo 'I just deployed to #{stage}! :tada:' | zulip-send \
|
2017-06-05 17:15:20 +02:00
|
|
|
--user capistrano-bot@example.com --api-key a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 \
|
2017-10-30 22:04:15 +01:00
|
|
|
--site={{ api_url }} \
|
2017-06-05 17:15:20 +02:00
|
|
|
--stream commits --subject deployments || true"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
```
|
|
|
|
|
2018-04-21 20:39:04 +02:00
|
|
|
The `--user` and `--api-key` should be the email and API key of the Zulip
|
|
|
|
bot created above. You can also put these values in a `~/.zuliprc` file on
|
|
|
|
your Capistrano machine. See our [API docs](/api) for instructions on
|
|
|
|
creating that file.
|
|
|
|
|
|
|
|
!!! tip ""
|
2017-06-05 17:15:20 +02:00
|
|
|
|
2018-04-21 20:39:04 +02:00
|
|
|
You can change the `deploy` above to another step of
|
|
|
|
your deployment process, if you'd like the notification to fire
|
|
|
|
at a different time. See [Capistrano's Before/After Hooks page][1]
|
|
|
|
for more information!
|
2017-06-22 02:57:59 +02:00
|
|
|
|
2020-03-27 01:32:21 +01:00
|
|
|
[1]: https://capistranorb.com/documentation/getting-started/before-after/
|
2017-06-05 17:15:20 +02:00
|
|
|
|
2017-06-22 02:57:59 +02:00
|
|
|
{!congrats.md!}
|
2017-06-05 17:15:20 +02:00
|
|
|
|
2020-08-05 11:50:17 +02:00
|
|
|
![Capistrano bot message](/static/images/integrations/capistrano/001.png)
|