Fix pull credentials bug, fix job details parse bug and add some better logging
This commit is contained in:
parent
7ee00b83cb
commit
ce3f8b438c
3 changed files with 11 additions and 8 deletions
|
@ -116,9 +116,9 @@ class BuildComponent(BaseComponent):
|
|||
status_dict['total_commands'] = len(parsed_dockerfile.commands)
|
||||
|
||||
# Add the pull robot information, if any.
|
||||
if build_config.get('pull_credentials') is not None:
|
||||
base_image_information['username'] = build_config['pull_credentials'].get('username', '')
|
||||
base_image_information['password'] = build_config['pull_credentials'].get('password', '')
|
||||
if build_job.pull_credentials:
|
||||
base_image_information['username'] = build_job.pull_credentials.get('username', '')
|
||||
base_image_information['password'] = build_job.pull_credentials.get('password', '')
|
||||
|
||||
# Retrieve the repository's fully qualified name.
|
||||
repo = build_job.repo_build.repository
|
||||
|
@ -244,7 +244,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': str(exception) if exception else None
|
||||
})
|
||||
|
||||
build_id = self._current_job.repo_build.uuid
|
||||
|
@ -360,13 +360,10 @@ class BuildComponent(BaseComponent):
|
|||
def _timeout(self):
|
||||
yield trollius.From(self._set_status(ComponentStatus.TIMED_OUT))
|
||||
logger.warning('Build component with realm %s has timed out', self.builder_realm)
|
||||
self._dispose(timed_out=True)
|
||||
|
||||
def _dispose(self, timed_out=False):
|
||||
# If we still have a running job, then it has not completed and we need to tell the parent
|
||||
# manager.
|
||||
if self._current_job is not None:
|
||||
if timed_out:
|
||||
self._build_status.set_error('Build worker timed out', internal_error=True)
|
||||
|
||||
self.parent_manager.job_completed(self._current_job, BuildJobResult.INCOMPLETE, self)
|
||||
|
|
|
@ -33,6 +33,11 @@ class BuildJob(object):
|
|||
def repo_build(self):
|
||||
return self._load_repo_build()
|
||||
|
||||
@property
|
||||
def pull_credentials(self):
|
||||
""" Returns the pull credentials for this job, or None if none. """
|
||||
return self.job_details.get('pull_credentials')
|
||||
|
||||
@property
|
||||
def build_config(self):
|
||||
try:
|
||||
|
|
|
@ -154,6 +154,7 @@ class BuilderServer(object):
|
|||
except BuildJobLoadException as irbe:
|
||||
logger.exception(irbe)
|
||||
self._queue.incomplete(job_item, restore_retry=False)
|
||||
continue
|
||||
|
||||
logger.debug('Build job found. Checking for an avaliable worker.')
|
||||
scheduled = yield From(self._lifecycle_manager.schedule(build_job))
|
||||
|
|
Reference in a new issue