New subject: [PATCH 1/2] Log to morph's log output of a failed build
Normally, the build log would go into the artifact cache, but it's tedious
to fetch from there, so we log it into the normal morph log as well if
things fail.
---
morphlib/builder2.py | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/morphlib/builder2.py b/morphlib/builder2.py
index 03a6214..a5f86e8 100644
--- a/morphlib/builder2.py
+++ b/morphlib/builder2.py
@@ -249,6 +249,7 @@ class ChunkBuilder(BuilderBase):
def build_and_cache(self): # pragma: no cover
with self.build_watch('overall-build'):
mounted = self.do_mounts()
+ log_name = None
try:
builddir = self.staging_area.builddir(self.artifact.source)
self.get_sources(builddir)
@@ -256,9 +257,15 @@ class ChunkBuilder(BuilderBase):
with self.local_artifact_cache.put_source_metadata(
self.artifact.source, self.artifact.cache_key,
'build-log') as log:
+ log_name = log._savefile_filename
self.run_commands(builddir, destdir, log)
except:
self.do_unmounts(mounted)
+ if log_name:
+ with open(log_name) as f:
+ for line in f:
+ logging.error('OUTPUT FROM FAILED BUILD: %s' %
+ line.rstrip('\n'))
raise
self.do_unmounts(mounted)
built_artifacts = self.assemble_chunk_artifacts(destdir)
--
1.7.2.5