forked from zulip/zulip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hooks: Add a push_git_ref post-deploy hook.
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -u | ||
|
||
if [ -z "${ZULIP_NEW_MERGE_BASE_COMMIT:-}" ]; then | ||
echo "push_git_ref: Can't push because deploy is not from git!" | ||
exit 0 | ||
fi | ||
|
||
if ! repo=$(crudini --get /etc/zulip/zulip.conf push_git_ref repo); then | ||
echo "push_git_ref: No repo set! Set push_git_ref.repo in /etc/zulip/zulip.conf" | ||
exit 0 | ||
fi | ||
|
||
if ! ref=$(crudini --get /etc/zulip/zulip.conf push_git_ref ref); then | ||
echo "push_git_ref: No ref set! Set push_git_ref.ref in /etc/zulip/zulip.conf" | ||
exit 0 | ||
fi | ||
|
||
git push -f "$repo" "$ZULIP_NEW_MERGE_BASE_COMMIT:$ref" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# @summary Push the merge_base to a git repo after deploy | ||
# | ||
class zulip::hooks::push_git_ref { | ||
include zulip::hooks::base | ||
|
||
zulip::hooks::file { [ | ||
'post-deploy.d/push_git_ref.hook', | ||
]: } | ||
} |