From 8c1ed5d993c7111afb7d0276a91c47dc79ece5cd Mon Sep 17 00:00:00 2001 From: saville Date: Wed, 20 Nov 2024 09:26:19 -0700 Subject: [PATCH 1/2] Handle container errors correctly --- buildrunner/__init__.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/buildrunner/__init__.py b/buildrunner/__init__.py index a5814929..85dfa01e 100644 --- a/buildrunner/__init__.py +++ b/buildrunner/__init__.py @@ -18,6 +18,7 @@ import sys import tarfile import tempfile +import traceback import types from typing import List, Optional @@ -35,6 +36,7 @@ from buildrunner.errors import ( BuildRunnerConfigurationError, BuildRunnerProcessingError, + BuildRunnerError, ) from buildrunner.steprunner import BuildStepRunner from buildrunner.docker.multiplatform_image_builder import MultiplatformImageBuilder @@ -470,13 +472,6 @@ def run(self): # pylint: disable=too-many-statements,too-many-branches,too-many ) else: self.log.write("\nPush not requested\n") - - except BuildRunnerConfigurationError as brce: - exit_explanation = str(brce) - self.exit_code = os.EX_CONFIG - except BuildRunnerProcessingError as brpe: - exit_explanation = str(brpe) - self.exit_code = 1 except requests.exceptions.ConnectionError as rce: print(str(rce)) exit_explanation = ( @@ -486,6 +481,14 @@ def run(self): # pylint: disable=too-many-statements,too-many-branches,too-many "remote PyPi server information is set correctly." ) self.exit_code = 1 + except BuildRunnerError as exc: + exit_explanation = str(exc) + self.exit_code = ( + os.EX_CONFIG if isinstance(exc, BuildRunnerConfigurationError) else 1 + ) + except Exception as exc: + exit_explanation = f"Encountered unhandled exception ({type(exc).__name__}) {traceback.format_exc()}" + self.exit_code = 1 finally: self._write_artifact_manifest() From bc0cf53ceb874d6956affb8625aac1bf1730fe1a Mon Sep 17 00:00:00 2001 From: saville Date: Wed, 20 Nov 2024 13:24:25 -0700 Subject: [PATCH 2/2] Attempt to use AWS ECR for tests --- tests/config-files/dot-buildrunner.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/config-files/dot-buildrunner.yaml b/tests/config-files/dot-buildrunner.yaml index 8c37db49..58b681a8 100644 --- a/tests/config-files/dot-buildrunner.yaml +++ b/tests/config-files/dot-buildrunner.yaml @@ -32,3 +32,7 @@ caches-root: ~/.buildrunner/caches # buildrunner scripts env: GLOBAL_VAR1: 'value1' + +# The 'docker-registry' global configuration specifies the default docker registry +# Use the AWS public ECR as it has higher rate limits than Docker Hub +docker-registry: public.ecr.aws/docker/library \ No newline at end of file