Implement continue on error for npm builds

This commit is contained in:
David Boreham 2023-01-19 13:38:04 -07:00
parent 6faa933d42
commit 34aa613d04

View File

@ -19,6 +19,7 @@
# CERC_REPO_BASE_DIR defaults to ~/cerc # CERC_REPO_BASE_DIR defaults to ~/cerc
import os import os
import sys
from decouple import config from decouple import config
import click import click
import importlib.resources import importlib.resources
@ -40,6 +41,7 @@ def command(ctx, include, exclude):
local_stack = ctx.obj.local_stack local_stack = ctx.obj.local_stack
debug = ctx.obj.debug debug = ctx.obj.debug
stack = ctx.obj.stack stack = ctx.obj.stack
continue_on_error = ctx.obj.continue_on_error
if local_stack: if local_stack:
dev_root_path = os.getcwd()[0:os.getcwd().rindex("stack-orchestrator")] 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. # 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. # Since we detect errors via catching exceptions below, we can safely ignore it here.
except DockerException as e: 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: else:
print("Skipped") print("Skipped")