Last active
April 29, 2018 10:43
-
-
Save matrey/e4d3645af0918326d9d8 to your computer and use it in GitHub Desktop.
Multiple update hooks for Gitlab
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
#!/bin/bash | |
# The standard, global, Gitlab update hook | |
update_true_path="$(cd `dirname $(readlink $0)` && pwd)" | |
update_gitlab="$update_true_path/update" | |
# Additional, local, update.before and update.after hooks | |
hooks_dir="$(cd `dirname $0` && pwd)" | |
update_before="$hooks_dir/update.before" | |
update_after="$hooks_dir/update.after" | |
if [ -x $update_before ]; then | |
$update_before "$@" || exit 1 | |
fi | |
$update_gitlab "$@" || exit 1 | |
if [ -x $update_after ]; then | |
$update_after "$@" || exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Goals, on push:
2 ways to implement it:
rm update
sudo -u git ln -s /opt/gitlab/embedded/service/gitlab-shell/hooks/update-multiple update
Tested on latest CentOS 6 + Gitlab omnibus package.
I haven't tested what happens in case you update Gitlab. Use at your own risk.
You can now add "update.before" and "update.after" scripts in the hooks folder of your repository.