fix skipping builds with custom-git

Custom git triggers don't necessarily have commit info available. Our
code reading the commit message was under the assumption that it would
always be there.
This commit is contained in:
Jimmy Zelinskie 2015-09-22 16:51:23 -04:00
parent 28c4f00280
commit 7372068a72

View file

@ -71,8 +71,11 @@ def find_matching_branches(config, branches):
return branches
def should_skip_commit(message):
return '[skip build]' in message or '[build skip]' in message
def should_skip_commit(metadata):
if 'commit_info' in metadata:
message = metadata['commit_info']['message']
return '[skip build]' in message or '[build skip]' in message
return False
def raise_if_skipped_build(prepared_build, config):
@ -93,7 +96,7 @@ def raise_if_skipped_build(prepared_build, config):
raise SkipRequestException()
# Check the commit message.
if should_skip_commit(prepared_build.metadata['commit_info']['message']):
if should_skip_commit(prepared_build.metadata):
logger.debug('Skipping request due to commit message request')
raise SkipRequestException()