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

@ -107,8 +107,6 @@ class BuildComponent(BaseComponent):
# Parse the build queue item into build arguments.
# build_package: URL to the build package to download and untar/unzip.
# git_url: URL to clone a repository if there's no buildpack.
# git_key: ssh key to clone a repository.
# sub_directory: The location within the build package of the Dockerfile and the build context.
# repository: The repository for which this build is occurring.
# registry: The registry for which this build is occuring (e.g. 'quay.io', 'staging.quay.io').
@ -122,17 +120,24 @@ class BuildComponent(BaseComponent):
# password: The password for pulling the base image (if any).
build_arguments = {
'build_package': buildpack_url,
'git_url': build_config.get('git_url', ''),
'git_key': build_config.get('git_key', ''),
'sub_directory': build_config.get('build_subdir', ''),
'repository': repository_name,
'registry': self.registry_hostname,
'pull_token': build_job.repo_build.access_token.code,
'push_token': build_job.repo_build.access_token.code,
'tag_names': build_config.get('docker_tags', ['latest']),
'base_image': base_image_information
'base_image': base_image_information,
}
# If the trigger has a private key, it's using git, thus we should add
# git data to the build args.
if build_job.repo_build.trigger.private_key is not None:
build_arguments['git'] = {
'url': build_config['trigger_metadata']['git_url'],
'sha': build_config['trigger_metadata']['commit_sha'],
'private_key': build_job.repo_build.trigger.private_key,
}
# Invoke the build.
logger.debug('Invoking build: %s', self.builder_realm)
logger.debug('With Arguments: %s', build_arguments)