Skip to content

Instantly share code, notes, and snippets.

@Spredzy
Created December 14, 2012 16:25
Show Gist options
  • Save Spredzy/4286663 to your computer and use it in GitHub Desktop.
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
#!/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