mirror of https://github.com/zulip/zulip.git
hooks: Add a hook to send a Zulip before/after the deploy.
This commit is contained in:
parent
377f2d6d03
commit
8a771c7ac0
|
@ -0,0 +1,40 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
if ! zulip_api_key=$(crudini --get /etc/zulip/zulip-secrets.conf secrets zulip_release_api_key); then
|
||||||
|
echo "zulip_notify: No zulip_release_api_key set! Set zulip_release_api_key in /etc/zulip/zulip-secrets.conf"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! zulip_notify_bot_email=$(crudini --get /etc/zulip/zulip.conf zulip_notify bot_email); then
|
||||||
|
echo "zulip_notify: No zulip_notify.bot_email set in /etc/zulip/zulip.conf"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! zulip_notify_server=$(crudini --get /etc/zulip/zulip.conf zulip_notify server); then
|
||||||
|
echo "zulip_notify: No zulip_notify.server set in /etc/zulip/zulip.conf"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! zulip_notify_stream=$(crudini --get /etc/zulip/zulip.conf zulip_notify stream); then
|
||||||
|
echo "zulip_notify: No zulip_notify.stream set in /etc/zulip/zulip.conf"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
from=${ZULIP_OLD_MERGE_BASE_COMMIT:-$ZULIP_OLD_VERSION}
|
||||||
|
to=${ZULIP_NEW_MERGE_BASE_COMMIT:-$ZULIP_NEW_VERSION}
|
||||||
|
deploy_environment=$(crudini --get /etc/zulip/zulip.conf machine deploy_type || echo "development")
|
||||||
|
|
||||||
|
echo "zulip_notify: Sending notify of $from .. $to for $deploy_environment to $zulip_notify_server"
|
||||||
|
|
||||||
|
zulip_send() {
|
||||||
|
./zulip-py3-venv/bin/zulip-send \
|
||||||
|
--site "$zulip_notify_server" \
|
||||||
|
--user "$zulip_notify_bot_email" \
|
||||||
|
--api-key "$zulip_api_key" \
|
||||||
|
--stream "$zulip_notify_stream" \
|
||||||
|
--subject "$deploy_environment deploy" \
|
||||||
|
--message "$1"
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
source "$(dirname "$0")/../common/zulip_notify.sh"
|
||||||
|
zulip_send "Finished deploying from $from to $to on $(hostname)"
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
source "$(dirname "$0")/../common/zulip_notify.sh"
|
||||||
|
zulip_send "Starting deploy from $from to $to on $(hostname)"
|
|
@ -0,0 +1,11 @@
|
||||||
|
# @summary Install hook that notifies when a deploy starts/stops
|
||||||
|
#
|
||||||
|
class zulip::hooks::zulip_notify {
|
||||||
|
include zulip::hooks::base
|
||||||
|
|
||||||
|
zulip::hooks::file { [
|
||||||
|
'common/zulip_notify.sh',
|
||||||
|
'pre-deploy.d/zulip_notify.hook',
|
||||||
|
'post-deploy.d/zulip_notify.hook',
|
||||||
|
]: }
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
class zulip_ops::profile::prod_app_frontend {
|
class zulip_ops::profile::prod_app_frontend {
|
||||||
include zulip_ops::profile::base
|
include zulip_ops::profile::base
|
||||||
include zulip_ops::app_frontend
|
include zulip_ops::app_frontend
|
||||||
|
include zulip::hooks::zulip_notify
|
||||||
|
|
||||||
file { '/etc/nginx/sites-available/zulip':
|
file { '/etc/nginx/sites-available/zulip':
|
||||||
ensure => file,
|
ensure => file,
|
||||||
|
|
Loading…
Reference in New Issue