Fix post-receive hook arguments issues and document the setup.

(imported from commit 0440cbc97337b8dd9f92bbbd428a069f79df400a)
This commit is contained in:
Tim Abbott 2013-02-19 19:16:55 -05:00
parent 4c037a938c
commit cdedb85934
2 changed files with 15 additions and 2 deletions

1
bots/githook-post-receive Symbolic link
View File

@ -0,0 +1 @@
../api/integrations/git/post-receive

View File

@ -7,6 +7,18 @@
#
# ssh humbug@git.humbughq.com 'cd humbug; git pull'
#
# To send the Humbug notices, this script calls out to our
# for-distribution git hook (under api/integrations/); since the git
# hook needs to be in the same directory as the configuration script
# for the git hook, this means that we need to have a shared directory
# containing (a symlink to) both the the for-distribution git hook and
# the Humbug configuration; for the moment those are
# bots/githook-post-receive and bots/humbug_git_config.py,
# respectively. We need the intermediate symlink because the git hook
# looks for its configuration in the directory that it sits in, and
# api/integrations/git/ has the example configuration.
#
#
# The "post-receive" script is run after receive-pack has accepted a pack
# and the repository has been updated. It is passed arguments in through
# stdin in the form
@ -49,7 +61,7 @@ for ln in sys.stdin:
oldrev, newrev, refname = ln.strip().split()
if refname in deployments:
(server, branch) = deployments[refname]
p = subprocess.Popen("/home/humbug/humbug/api/integrations/git/post-receive",
p = subprocess.Popen("/home/humbug/humbug/bots/githook-post-receive",
stdin=subprocess.PIPE)
p.communicate(input=ln)
update_deployment(server, oldrev, newrev, branch)
update_deployment(server, oldrev, newrev, "origin/" + branch)