Merge "Enhance error messages when building containers" into stable/train

This commit is contained in:
Zuul 2020-05-22 15:54:31 +00:00 committed by Gerrit Code Review
commit 7656c21106
2 changed files with 15 additions and 4 deletions

View File

@ -205,12 +205,23 @@ class BuildahBuilder(base.BaseBuilder):
# failed a SystemError will be raised using the
# exception information. If any job was loaded
# but not executed a SystemError will be raised.
exceptions = list()
for job in done:
if job._exception:
raise SystemError("%(container)s raised %(exception)s" %
{'container': future_to_build[job],
'exception': job._exception})
exceptions.append(
"\nException information: {exception}".format(
exception=job._exception
)
)
else:
if exceptions:
raise RuntimeError(
'\nThe following errors were detected during '
'container build(s):\n{exceptions}'.format(
exceptions='\n'.join(exceptions)
)
)
if not_done:
error_msg = ('The following jobs were '
'incomplete: {}'.format(

View File

@ -185,7 +185,7 @@ class TestBuildahBuilder(base.TestCase):
mock_submit.side_effect = R_FAILED_LIST
_b = bb(WORK_DIR, DEPS)
self.assertRaises(
SystemError,
RuntimeError,
_b.build_all,
deps=BUILD_ALL_LIST_CONTAINERS
)