mirror of https://github.com/zulip/zulip.git
post-receive: Add support for deploying to staging server.
After this commit, we're tracking two branches: "master" and "prod". Pushed to "prod" deploy to production, while pushes to "master" deploy to the staging server. (imported from commit 6ce429a1d6f606fb6136341dc393d93fd1228a21)
This commit is contained in:
parent
7cc630e518
commit
33b9a9e8b4
|
@ -41,8 +41,8 @@ def check_output(*popenargs, **kwargs):
|
|||
return output
|
||||
subprocess.check_output = check_output
|
||||
|
||||
def update_deployment(oldrev, newrev, refname):
|
||||
subprocess.check_call(["ssh", "humbughq.com", "--", "env", "-u", "GIT_DIR",
|
||||
def update_deployment(server, oldrev, newrev, refname):
|
||||
subprocess.check_call(["ssh", server, "--", "env", "-u", "GIT_DIR",
|
||||
"/home/humbug/humbug/tools/update-deployment",
|
||||
oldrev, newrev, refname])
|
||||
|
||||
|
@ -91,6 +91,9 @@ def send_bot_message(oldrev, newrev, refname):
|
|||
|
||||
for ln in sys.stdin:
|
||||
oldrev, newrev, refname = ln.strip().split()
|
||||
if refname in ["refs/heads/master", "refs/heads/test-post-receive"]:
|
||||
if refname in ["refs/heads/prod"]:
|
||||
send_bot_message(oldrev, newrev, refname)
|
||||
update_deployment(oldrev, newrev, refname)
|
||||
update_deployment("humbughq.com", oldrev, newrev, "origin/prod")
|
||||
elif refname in ["refs/heads/master", "refs/heads/test-post-receive"]:
|
||||
send_bot_message(oldrev, newrev, refname)
|
||||
update_deployment("staging.humbughq.com", oldrev, newrev, "origin/master")
|
||||
|
|
|
@ -32,7 +32,7 @@ if len(sys.argv) > 1:
|
|||
refname = sys.argv[3]
|
||||
|
||||
subprocess.check_call(["git", "fetch"], stdout=open('/dev/null', 'w'))
|
||||
subprocess.check_call(["git", "reset", "--hard", "origin/master"], stdout=open('/dev/null', 'w'))
|
||||
subprocess.check_call(["git", "reset", "--hard", refname], stdout=open('/dev/null', 'w'))
|
||||
#subprocess.check_call(["python", "manage.py", "syncdb"], stdout=open('/dev/null', 'w'))
|
||||
|
||||
# Restart the FastCGI process, which is running in a shell loop in screen.
|
||||
|
|
Loading…
Reference in New Issue