Merge pull request #368 from coreos-inc/buildarchive

Allow builds to be started with an external archive URL
This commit is contained in:
Jimmy Zelinskie 2015-08-17 17:09:14 -04:00
commit 239f76d39f
7 changed files with 120 additions and 20 deletions

View file

@ -116,14 +116,10 @@ class BuildComponent(BaseComponent):
# push_token: The token to use to push the built image.
# tag_names: The name(s) of the tag(s) for the newly built image.
# base_image: The image name and credentials to use to conduct the base image pull.
# repository: The repository to pull (DEPRECATED 0.2)
# tag: The tag to pull (DEPRECATED in 0.2)
# username: The username for pulling the base image (if any).
# password: The password for pulling the base image (if any).
build_arguments = {
'build_package': self.user_files.get_file_url(build_job.repo_build.resource_key,
requires_cors=False)
if build_job.repo_build.resource_key is not None else "",
'build_package': build_job.get_build_package_url(self.user_files),
'sub_directory': build_config.get('build_subdir', ''),
'repository': repository_name,
'registry': self.registry_hostname,

View file

@ -62,6 +62,17 @@ class BuildJob(object):
def repo_build(self):
return self._load_repo_build()
def get_build_package_url(self, user_files):
""" Returns the URL of the build package for this build, if any or empty string if none. """
archive_url = self.build_config.get('archive_url', None)
if archive_url:
return archive_url
if not self.repo_build.resource_key:
return ''
return user_files.get_file_url(self.repo_build.resource_key, requires_cors=False)
@property
def pull_credentials(self):
""" Returns the pull credentials for this job, or None if none. """