Add better exception logging for builds
When the exception is bubbled up through the multiprocessing bits, it loses some information so it's hard to troubleshoot. Let's log the exception in the multiprocessed function call and continue to raise the exception when things fail. Change-Id: Idbf56d97069e238bc6da61c7b3432fe37ecaf1a0 Related-Bug: #1904025
This commit is contained in:
parent
52112d428d
commit
dbfa2399b4
@ -132,9 +132,17 @@ class BuildahBuilder(base.BaseBuilder):
|
|||||||
if container_name in self.excludes:
|
if container_name in self.excludes:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.build(container_name, self._find_container_dir(container_name))
|
# NOTE(mwhahaha): Use a try catch block so we can better log issues
|
||||||
if self.push_containers:
|
# as this is called in a multiprocess fashion so the exception
|
||||||
self.push(self._get_destination(container_name))
|
# loses some information when it reaches _multi_build
|
||||||
|
try:
|
||||||
|
self.build(container_name,
|
||||||
|
self._find_container_dir(container_name))
|
||||||
|
if self.push_containers:
|
||||||
|
self.push(self._get_destination(container_name))
|
||||||
|
except Exception as e:
|
||||||
|
self.log.exception(e)
|
||||||
|
raise
|
||||||
|
|
||||||
@tenacity.retry( # Retry up to 3 times with 1 second delay
|
@tenacity.retry( # Retry up to 3 times with 1 second delay
|
||||||
reraise=True,
|
reraise=True,
|
||||||
|
Loading…
Reference in New Issue
Block a user