diff options
author | Oliver Poignant <oliver@poignant.se> | 2016-03-12 11:49:46 +0100 |
---|---|---|
committer | Oliver Poignant <oliver@poignant.se> | 2016-03-12 11:49:46 +0100 |
commit | 5afe42a66d728f3b5ca3064708e6084d593fc968 (patch) | |
tree | c51db243eaaa6603154dcdb4856bd01cb3885072 /GitAutoDeploy.py | |
parent | 61289b58d2a0e61e7c3b8502c1bb45a3daac2014 (diff) | |
parent | bbb12196a0939bc31a5688e3ea77c03996be2a11 (diff) | |
download | Git-Auto-Deploy-5afe42a66d728f3b5ca3064708e6084d593fc968.zip Git-Auto-Deploy-5afe42a66d728f3b5ca3064708e6084d593fc968.tar.gz Git-Auto-Deploy-5afe42a66d728f3b5ca3064708e6084d593fc968.tar.bz2 |
Merge branch 'etlweather-master'
Diffstat (limited to 'GitAutoDeploy.py')
-rwxr-xr-x | GitAutoDeploy.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/GitAutoDeploy.py b/GitAutoDeploy.py index 7deddac..8827ca0 100755 --- a/GitAutoDeploy.py +++ b/GitAutoDeploy.py @@ -228,6 +228,14 @@ class WebhookRequestHandler(BaseHTTPRequestHandler): if k in data['repository']: repo_urls.append(data['repository'][k]) + # extract the branch + if 'ref' in data: + ref = data['ref'] + + # set the action + if 'object_kind' in data: + action = data['object_kind'] + # Assume GitHub if the X-GitHub-Event HTTP header is set elif github_event: @@ -311,6 +319,7 @@ class WebhookRequestHandler(BaseHTTPRequestHandler): else: logger.error("ERROR - Unable to recognize request origin. Don't know how to handle the request.") + logger.info("Event details - ref: %s; action: %s" % (ref or "master", action)) return repo_urls, ref or "master", action @@ -405,13 +414,15 @@ class GitAutoDeploy(object): # Verify that all filters matches the request if specified if 'filters' in repo_config: for filter in repo_config['filters']: - if filter['type'] == 'pull-request-filter': + if 'type' in filter and filter['type'] == 'pull-request-filter': if filter['ref'] == ref and filter['action'] == action: continue raise FilterMatchError() else: - logger.error('Unrecognized filter: ' % filter) - raise FilterMatchError() + if 'action' in filter and filter['action'] != action: + raise FilterMatchError() + if 'ref' in filter and filter['ref'] != ref: + raise FilterMatchError() except FilterMatchError as e: continue |