Merge pull request #1767 from coreos-inc/bitbucket-lookup

Fix manual run under bitbucket repos with many tags/branches
This commit is contained in:
josephschorr 2016-08-29 11:54:56 -04:00 committed by GitHub
commit 715cfd8313

View file

@ -513,19 +513,19 @@ class BitbucketBuildTrigger(BuildTriggerHandler):
def get_branch_sha(branch_name):
# Lookup the commit SHA for the branch.
(result, data, _) = repository.get_branches()
if not result or not branch_name in data:
(result, data, _) = repository.get_branch(branch_name)
if not result:
raise TriggerStartException('Could not find branch commit SHA')
return data[branch_name]['node']
return data['target']['hash']
def get_tag_sha(tag_name):
# Lookup the commit SHA for the tag.
(result, data, _) = repository.get_tags()
if not result or not tag_name in data:
(result, data, _) = repository.get_tag(tag_name)
if not result:
raise TriggerStartException('Could not find tag commit SHA')
return data[tag_name]['node']
return data['target']['hash']
def lookup_author(email_address):
(result, data, _) = bitbucket_client.accounts().get_profile(email_address)