Commit f597add9 authored by chrissi^'s avatar chrissi^

Fix branch detection

Signed-off-by: chrissi^'s avatarChris Fiege <chris@tinyhost.de>
parent 6372223b
......@@ -2,11 +2,13 @@ testbed:
stage: deploy
only:
- /^testbed*$/i
- /^master*$/i
script:
- cd flamingo
- echo $CI_COMMIT_REF_SLUG > REF_SLUG
- make env
- make html
- touch /var/www/testbed/htdocs/foo
- rm -r /var/www/testbed/htdocs/*
- cp -r output/* /var/www/testbed/htdocs/
- chmod go+r -R /var/www/testbed/htdocs/*
- touch /var/www/$CI_COMMIT_REF_SLUG/htdocs/foo
- rm -r /var/www/$CI_COMMIT_REF_SLUG/htdocs/*
- cp -r output/* /var/www/$CI_COMMIT_REF_SLUG/htdocs/
- chmod go+r -R /var/www/$CI_COMMIT_REF_SLUG/htdocs/*
......@@ -12,7 +12,12 @@ class Git:
updated = subprocess.getoutput(["git log -1 --pretty=format:'%aI' {}".format(path)])
content["git_update"] = updated
branch = subprocess.getoutput(["git branch | grep \* | cut -d ' ' -f2"])
try:
with open("REF_SLUG") as fh:
branch = fh.readlines()[0].strip()
except:
branch = subprocess.getoutput(["git branch | grep \* | cut -d ' ' -f2"])
if "HEAD" in branch:
branch = "master"
content["git_branch"] = branch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment