gitlab: consistent commit for _prepare_build
This commit is contained in:
parent
c8cab6b7e2
commit
b3bf947af5
1 changed files with 7 additions and 3 deletions
|
@ -1264,7 +1264,7 @@ class GitLabBuildTrigger(BuildTriggerHandler):
|
|||
|
||||
return None
|
||||
|
||||
def _prepare_build(self, commit, ref, is_manual):
|
||||
def _prepare_build(self, commit_sha, ref, is_manual):
|
||||
config = self.config
|
||||
gl_client = self._get_authorized_client()
|
||||
|
||||
|
@ -1272,6 +1272,10 @@ class GitLabBuildTrigger(BuildTriggerHandler):
|
|||
if repo is False:
|
||||
raise TriggerStartException('Could not find repository')
|
||||
|
||||
commit = gl_client.getrepositorycommit(repo['id'], commit_sha)
|
||||
if repo is False:
|
||||
raise TriggerStartException('Could not find repository')
|
||||
|
||||
try:
|
||||
[committer] = gl_client.getusers(search=commit['committer_email'])
|
||||
except ValueError:
|
||||
|
@ -1335,7 +1339,7 @@ class GitLabBuildTrigger(BuildTriggerHandler):
|
|||
ref = payload['ref']
|
||||
raise_if_skipped(self.config, ref)
|
||||
|
||||
return self._prepare_build(commit, ref, False)
|
||||
return self._prepare_build(commit['id'], ref, False)
|
||||
|
||||
def manual_start(self, run_parameters=None):
|
||||
run_parameters = run_parameters or {}
|
||||
|
@ -1360,7 +1364,7 @@ class GitLabBuildTrigger(BuildTriggerHandler):
|
|||
|
||||
ref = 'refs/heads/%s' % branch_name
|
||||
|
||||
return self._prepare_build(commit, ref, True)
|
||||
return self._prepare_build(commit['id'], ref, True)
|
||||
|
||||
def get_repository_url(self):
|
||||
gl_client = self._get_authorized_client()
|
||||
|
|
Reference in a new issue