Created
December 14, 2012 16:25
-
-
Save Spredzy/4286663 to your computer and use it in GitHub Desktop.
This shows how to edit the gitolite post-receive hook in order for gitlab to use customs one and not only web hooks This needs the creation of the post-receive.secondary.d directory prior to run. This specific case show a 1:1 relation between post-receive hook and projects
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
#!/usr/bin/env bash | |
# This file was placed here by GitLab. It makes sure that your pushed commits | |
# will be processed properly. | |
while read oldrev newrev ref | |
do | |
# For every branch or tag that was pushed, create a Resque job in redis. | |
path_to_hook='hooks/post-receive.secondary.d/' | |
pwd=`pwd` | |
reponame=`basename "$pwd" | sed s/\.git$//` | |
env -i redis-cli rpush "resque:gitlab:queue:post_receive" "{\"class\":\"PostReceive\",\"args\":[\"$reponame\",\"$oldrev\",\"$newrev\",\"$ref\",\"$GL_USER\"]}" > /dev/null 2>&1 | |
if [ -x "$path_to_hook/$reponame" ];then | |
"$path_to_hook/$reponame" "$reponame" "$oldrev" "$newrev" "$ref" "$GL_USER" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment