aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Arbet <michal.arbet@ultimum.io>2023-09-14 12:31:23 +0200
committerMichal Arbet <michal.arbet@ultimum.io>2023-09-14 12:31:23 +0200
commit299f1d6bdd94018532ec27fad80830e8a8f1d4eb (patch)
tree3cf476b641529627f060b8d3fc380cb4c3f466a0
parent64098b209cfab47b1cd23351c09e5de3ed275c46 (diff)
downloadkolla-299f1d6bdd94018532ec27fad80830e8a8f1d4eb.tar.gz
kolla-299f1d6bdd94018532ec27fad80830e8a8f1d4eb.zip
Fix stderr logging when image build fail
Change-Id: Ie8730ae44cc26b87bd7eac93c8aac8dce8c7c5fc
-rw-r--r--kolla/image/tasks.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/kolla/image/tasks.py b/kolla/image/tasks.py
index 27377a865..1fbfbd6b5 100644
--- a/kolla/image/tasks.py
+++ b/kolla/image/tasks.py
@@ -16,6 +16,7 @@ import os
import shutil
import tarfile
+import docker.errors
import git
import requests
from requests import exceptions as requests_exc
@@ -391,10 +392,16 @@ class BuildTask(EngineTask):
if image.status != Status.ERROR and self.conf.squash and \
self.conf.engine == engine.Engine.DOCKER.value:
self.squash()
- except engine.getEngineException(self.conf):
+
+ except engine.getEngineException(self.conf) as e:
image.status = Status.ERROR
+ if isinstance(e, docker.errors.BuildError):
+ for line in e.build_log:
+ if 'stream' in line:
+ self.logger.error(line['stream'].strip())
self.logger.exception('Unknown container engine '
'error when building')
+
except Exception:
image.status = Status.ERROR
self.logger.exception('Unknown error when building')