Commit 507bdd42 authored by svilayphiou's avatar svilayphiou

Adapted the script to welcome a change on other branches than 'master'

parent d422f77a
Pipeline #400 failed with stages
......@@ -15,11 +15,13 @@ def index():
if request.headers.get('X-Gitlab-Event') == 'Push Hook':
print("push hook")
data = json.load(request.body)
print(data)
#print(data)
repo = data.get("repository")
git_http_url = repo.get("git_http_url")
project = data.get("project")
print(project)
branch = project.get("default_branch")
#ns = data.get("namespace")
ns = "osp"
......@@ -28,7 +30,7 @@ def index():
if os.path.isdir(repo_local_path):
print("repo exists. Pulling")
cmd = "git fetch origin master:master"
cmd = "git fetch origin %s:%s" % (branch, branch)
subprocess.Popen(shlex.split(cmd), cwd=repo_local_path)
else:
print("repo don't exist. Cloning")
......
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