add git_url to metadata, add git to buildargs

This commit is contained in:
Jimmy Zelinskie 2015-03-19 18:09:27 -04:00
parent f6f93e9079
commit b851986cf5
2 changed files with 17 additions and 8 deletions

View file

@ -371,8 +371,9 @@ class GithubBuildTrigger(BuildTrigger):
return commit_info
# TODO(jzelinskie): update this to support both kinds of triggers
@staticmethod
def _prepare_build(config, repo, commit_sha, build_name, ref):
def _prepare_build(config, repo, commit_sha, build_name, ref, git_url):
# Prepare the download and upload URLs
archive_link = repo.get_archive_link('tarball', commit_sha)
download_archive = client.get(archive_link, stream=True)
@ -422,6 +423,7 @@ class GithubBuildTrigger(BuildTrigger):
'commit_sha': commit_sha,
'ref': ref,
'default_branch': repo.default_branch,
'git_url': git_url,
}
# add the commit info.
@ -447,6 +449,7 @@ class GithubBuildTrigger(BuildTrigger):
ref = payload['ref']
commit_sha = payload['head_commit']['id']
commit_message = payload['head_commit'].get('message', '')
git_url = payload['repository']['git_url']
if 'branchtag_regex' in config:
try:
@ -471,7 +474,7 @@ class GithubBuildTrigger(BuildTrigger):
logger.debug('Github repo: %s', repo)
return GithubBuildTrigger._prepare_build(config, repo, commit_sha,
short_sha, ref)
short_sha, ref, git_url)
def manual_start(self, auth_token, config, run_parameters=None):
try:
@ -485,8 +488,9 @@ class GithubBuildTrigger(BuildTrigger):
branch_sha = branch.commit.sha
short_sha = GithubBuildTrigger.get_display_name(branch_sha)
ref = 'refs/heads/%s' % (branch_name)
git_url = repo.git_url
return self._prepare_build(config, repo, branch_sha, short_sha, ref)
return self._prepare_build(config, repo, branch_sha, short_sha, ref, git_url)
except GithubException as ghe:
raise TriggerStartException(ghe.data['message'])