Some small fixes to the dockerfile build worker.
This commit is contained in:
parent
889d178336
commit
1e8ec634e2
1 changed files with 6 additions and 5 deletions
|
@ -56,7 +56,7 @@ class DockerfileBuildContext(object):
|
||||||
self._push_token = push_token
|
self._push_token = push_token
|
||||||
self._cl = Client(timeout=1200, version='1.7')
|
self._cl = Client(timeout=1200, version='1.7')
|
||||||
self._status = StatusWrapper(build_uuid)
|
self._status = StatusWrapper(build_uuid)
|
||||||
self._build_logger = partial(build_logs, build_uuid)
|
self._build_logger = partial(build_logs.append_log_message, build_uuid)
|
||||||
|
|
||||||
dockerfile_path = os.path.join(self._build_dir, "Dockerfile")
|
dockerfile_path = os.path.join(self._build_dir, "Dockerfile")
|
||||||
self._num_steps = DockerfileBuildContext.__count_steps(dockerfile_path)
|
self._num_steps = DockerfileBuildContext.__count_steps(dockerfile_path)
|
||||||
|
@ -101,17 +101,18 @@ class DockerfileBuildContext(object):
|
||||||
current_step = 0
|
current_step = 0
|
||||||
built_image = None
|
built_image = None
|
||||||
for status in build_status:
|
for status in build_status:
|
||||||
logger.debug('Status: %s', str(status.encode('utf-8')))
|
status_str = str(status.encode('utf-8'))
|
||||||
|
logger.debug('Status: %s', status_str)
|
||||||
step_increment = re.search(r'Step ([0-9]+) :', status)
|
step_increment = re.search(r'Step ([0-9]+) :', status)
|
||||||
if step_increment:
|
if step_increment:
|
||||||
self._build_logger(str(status), build_logs.COMMAND)
|
self._build_logger(status_str, build_logs.COMMAND)
|
||||||
current_step = int(step_increment.group(1))
|
current_step = int(step_increment.group(1))
|
||||||
logger.debug('Step now: %s/%s' % (current_step, self._num_steps))
|
logger.debug('Step now: %s/%s' % (current_step, self._num_steps))
|
||||||
with self._status as status:
|
with self._status as status:
|
||||||
status['current_command'] = current_step
|
status['current_command'] = current_step
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
self._build_logger(str(status))
|
self._build_logger(status_str)
|
||||||
|
|
||||||
complete = re.match(r'Successfully built ([a-z0-9]+)$', status)
|
complete = re.match(r'Successfully built ([a-z0-9]+)$', status)
|
||||||
if complete:
|
if complete:
|
||||||
|
@ -314,7 +315,7 @@ class DockerfileBuildWorker(Worker):
|
||||||
logger.exception('Exception when processing request.')
|
logger.exception('Exception when processing request.')
|
||||||
repository_build.phase = 'error'
|
repository_build.phase = 'error'
|
||||||
repository_build.save()
|
repository_build.save()
|
||||||
log_appender(exc.message, build_logs.ERROR)
|
log_appender(str(exc), build_logs.ERROR)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
Reference in a new issue