Simple code review changes.
I sneakily also added local-test.sh and renamed run-local to local-run.sh.
This commit is contained in:
parent
0763f0d999
commit
d0763862b1
8 changed files with 27 additions and 25 deletions
|
@ -31,7 +31,6 @@ class ComponentStatus(object):
|
|||
|
||||
class BuildComponent(BaseComponent):
|
||||
""" An application session component which conducts one (or more) builds. """
|
||||
|
||||
def __init__(self, config, realm=None, token=None, **kwargs):
|
||||
self.expected_token = token
|
||||
self.builder_realm = realm
|
||||
|
@ -113,7 +112,7 @@ class BuildComponent(BaseComponent):
|
|||
base_image_information['username'] = build_config['pull_credentials'].get('username', '')
|
||||
base_image_information['password'] = build_config['pull_credentials'].get('password', '')
|
||||
|
||||
# Retrieve the repository's full name.
|
||||
# Retrieve the repository's fully qualified name.
|
||||
repo = build_job.repo_build().repository
|
||||
repository_name = repo.namespace_user.username + '/' + repo.name
|
||||
|
||||
|
@ -160,6 +159,7 @@ class BuildComponent(BaseComponent):
|
|||
|
||||
@staticmethod
|
||||
def _process_pushpull_status(status_dict, current_phase, docker_data, images):
|
||||
""" Processes the status of a push or pull by updating the provided status_dict and images. """
|
||||
if not docker_data:
|
||||
return
|
||||
|
||||
|
@ -186,6 +186,7 @@ class BuildComponent(BaseComponent):
|
|||
BuildComponent._total_completion(images, max(len(images), num_images))
|
||||
|
||||
def _on_log_message(self, phase, json_data):
|
||||
""" Tails log messages and updates the build status. """
|
||||
# Parse any of the JSON data logged.
|
||||
docker_data = {}
|
||||
if json_data:
|
||||
|
@ -237,7 +238,7 @@ class BuildComponent(BaseComponent):
|
|||
def _build_failure(self, error_message, exception=None):
|
||||
""" Handles and logs a failed build. """
|
||||
self._build_status.set_error(error_message, {
|
||||
'internal_error': exception.message if exception else None
|
||||
'internal_error': exception.message if exception else None
|
||||
})
|
||||
|
||||
build_id = self._current_job.repo_build().uuid
|
||||
|
@ -346,7 +347,7 @@ class BuildComponent(BaseComponent):
|
|||
# manager.
|
||||
if self._current_job is not None:
|
||||
if timed_out:
|
||||
self._build_status.set_error('Build worker timed out. Build has been requeued')
|
||||
self._build_status.set_error('Build worker timed out. Build has been requeued.')
|
||||
|
||||
self.parent_manager.job_completed(self._current_job, BuildJobResult.INCOMPLETE, self)
|
||||
self._build_status = None
|
||||
|
|
Reference in a new issue