summaryrefslogtreecommitdiffstats
path: root/gitautodeploy/parsers/gitlab.py
diff options
context:
space:
mode:
authorKiyan Shalileh <kiyan.shalileh@gmail.com>2016-06-26 19:08:28 +0430
committerKiyan Shalileh <kiyan.shalileh@gmail.com>2016-06-26 19:08:28 +0430
commit055344616f1672b2c27f8b8befb95d1541b1942c (patch)
tree8180b0262cea311626fc52c413f6967330cce69f /gitautodeploy/parsers/gitlab.py
parentb805e3f4554fc2854bb78923b17c906d8ebf9b4f (diff)
downloadGit-Auto-Deploy-055344616f1672b2c27f8b8befb95d1541b1942c.zip
Git-Auto-Deploy-055344616f1672b2c27f8b8befb95d1541b1942c.tar.gz
Git-Auto-Deploy-055344616f1672b2c27f8b8befb95d1541b1942c.tar.bz2
Fixing GitlabCi parser
Diffstat (limited to 'gitautodeploy/parsers/gitlab.py')
-rw-r--r--gitautodeploy/parsers/gitlab.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/gitautodeploy/parsers/gitlab.py b/gitautodeploy/parsers/gitlab.py
index 3551dc6..86c05fa 100644
--- a/gitautodeploy/parsers/gitlab.py
+++ b/gitautodeploy/parsers/gitlab.py
@@ -55,20 +55,28 @@ class GitLabCIRequestParser(WebhookRequestParser):
logger.debug('Received event from Gitlab CI')
- if 'push_data' not in data:
+ if 'repository' not in data:
logger.error("Unable to recognize data format")
return [], ref or "master", action
# Only add repositories if the build is successful. Ignore it in other case.
if data['build_status'] == "success":
for k in ['url', 'git_http_url', 'git_ssh_url']:
- if k in data['push_data']['repository']:
- repo_urls.append(data['push_data']['repository'][k])
+ if k in data['repository']:
+ repo_urls.append(data['repository'][k])
else:
logger.warning("Gitlab CI build '%d' has status '%s'. Not pull will be done" % (
data['build_id'], data['build_status']))
+ # extract the branch
+ if 'ref' in data:
+ ref = data['ref']
+
+ # set the action
+ if 'object_kind' in data:
+ action = data['object_kind']
+
# Get a list of configured repositories that matches the incoming web hook reqeust
repo_configs = self.get_matching_repo_configs(repo_urls)
- return repo_configs, ref or "master", action, repo_urls \ No newline at end of file
+ return repo_configs, ref or "master", action, repo_urls