Record phase information and make better error messages on pull failure
This commit is contained in:
parent
d9ce8fdf52
commit
e06435fee4
3 changed files with 46 additions and 51 deletions
|
@ -206,10 +206,10 @@ class BuildComponent(BaseComponent):
|
|||
self._last_heartbeat = datetime.datetime.utcnow()
|
||||
|
||||
# Parse any of the JSON data logged.
|
||||
docker_data = {}
|
||||
log_data = {}
|
||||
if json_data:
|
||||
try:
|
||||
docker_data = json.loads(json_data)
|
||||
log_data = json.loads(json_data)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
@ -217,8 +217,8 @@ class BuildComponent(BaseComponent):
|
|||
fully_unwrapped = ''
|
||||
keys_to_extract = ['error', 'status', 'stream']
|
||||
for key in keys_to_extract:
|
||||
if key in docker_data:
|
||||
fully_unwrapped = docker_data[key]
|
||||
if key in log_data:
|
||||
fully_unwrapped = log_data[key]
|
||||
break
|
||||
|
||||
# Determine if this is a step string.
|
||||
|
@ -233,10 +233,10 @@ class BuildComponent(BaseComponent):
|
|||
# Parse and update the phase and the status_dict. The status dictionary contains
|
||||
# the pull/push progress, as well as the current step index.
|
||||
with self._build_status as status_dict:
|
||||
if self._build_status.set_phase(phase):
|
||||
if self._build_status.set_phase(phase, log_data.get('status_data')):
|
||||
logger.debug('Build %s has entered a new phase: %s', self.builder_realm, phase)
|
||||
|
||||
BuildComponent._process_pushpull_status(status_dict, phase, docker_data, self._image_info)
|
||||
BuildComponent._process_pushpull_status(status_dict, phase, log_data, self._image_info)
|
||||
|
||||
# If the current message represents the beginning of a new step, then update the
|
||||
# current command index.
|
||||
|
@ -244,8 +244,8 @@ class BuildComponent(BaseComponent):
|
|||
status_dict['current_command'] = current_step
|
||||
|
||||
# If the json data contains an error, then something went wrong with a push or pull.
|
||||
if 'error' in docker_data:
|
||||
self._build_status.set_error(docker_data['error'])
|
||||
if 'error' in log_data:
|
||||
self._build_status.set_error(log_data['error'])
|
||||
|
||||
if current_step is not None:
|
||||
self._build_status.set_command(current_status_string)
|
||||
|
|
Reference in a new issue