Skip to content

Instantly share code, notes, and snippets.

@garlandkr
Forked from alq666/git-post-receive-hook
Last active August 29, 2015 14:14
Show Gist options
  • Save garlandkr/22a78a9ab42a9ec01641 to your computer and use it in GitHub Desktop.
Save garlandkr/22a78a9ab42a9ec01641 to your computer and use it in GitHub Desktop.
#!/bin/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.
pwd=`pwd`
reponame=`basename "$pwd" | cut -d. -f1`
env -i redis-cli rpush "resque:queue:post_receive" "{\"class\":\"PostReceive\",\"args\":[\"$reponame\",\"$oldrev\",\"$newrev\",\"$ref\",\"$GL_USER\"]}" > /dev/null 2>&1
done
# Assuming https://github.com/DataDog/dogapi/blob/master/examples/git-post-receive-hook
# has been saved in /tmp/datadog-git-post-receive-hook.py
# You probably want a better directory than /tmp, but this is solely
# to make sure it works
python /tmp/datadog-git-post-receive-hook.py $oldrev $newrev $ref
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment