From 6ed90536cf39e8df5096be5f22caad1b9387eed1 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Thu, 19 Jan 2023 13:38:04 -0700 Subject: [PATCH] Implement continue on error for npm builds Former-commit-id: 34aa613d04574284383885586f6d72e068603d19 --- app/build_npms.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/build_npms.py b/app/build_npms.py index 526f78f1..4f0ea219 100644 --- a/app/build_npms.py +++ b/app/build_npms.py @@ -19,6 +19,7 @@ # CERC_REPO_BASE_DIR defaults to ~/cerc import os +import sys from decouple import config import click import importlib.resources @@ -40,6 +41,7 @@ def command(ctx, include, exclude): local_stack = ctx.obj.local_stack debug = ctx.obj.debug stack = ctx.obj.stack + continue_on_error = ctx.obj.continue_on_error if local_stack: dev_root_path = os.getcwd()[0:os.getcwd().rindex("stack-orchestrator")] @@ -99,7 +101,13 @@ def command(ctx, include, exclude): # the command output as a string, in reality it is always the empty string. # Since we detect errors via catching exceptions below, we can safely ignore it here. except DockerException as e: - print(f"FATAL error executing build in container:\n {e}") + print(f"Error executing build for {package} in container:\n {e}") + if not continue_on_error: + print("FATAL Error: build failed and --continue-on-error not set, exiting") + sys.exit(1) + else: + print("****** Build Error, continuing because --continue-on-error is set") + else: print("Skipped")