From 62f7ce649db4f64ea7cbc2ab9a4ec504a7aff811 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Wed, 6 Mar 2024 18:38:30 +0000 Subject: [PATCH] Exit non-0 if docker build fails. (#778) Make sure to check the exit code of the docker build and bubble it back up to laconic-so. Reviewed-on: https://git.vdb.to/cerc-io/stack-orchestrator/pulls/778 Co-authored-by: Thomas E Lackey Co-committed-by: Thomas E Lackey --- .../data/container-build/cerc-nextjs-base/build.sh | 8 +++++++- .../data/container-build/cerc-webapp-base/build.sh | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/stack_orchestrator/data/container-build/cerc-nextjs-base/build.sh b/stack_orchestrator/data/container-build/cerc-nextjs-base/build.sh index cca8d64b..bb3983cf 100755 --- a/stack_orchestrator/data/container-build/cerc-nextjs-base/build.sh +++ b/stack_orchestrator/data/container-build/cerc-nextjs-base/build.sh @@ -11,8 +11,14 @@ CERC_CONTAINER_BUILD_DOCKERFILE=${CERC_CONTAINER_BUILD_DOCKERFILE:-$SCRIPT_DIR/D CERC_CONTAINER_BUILD_TAG=${CERC_CONTAINER_BUILD_TAG:-cerc/nextjs-base:local} docker build -t $CERC_CONTAINER_BUILD_TAG ${build_command_args} -f $CERC_CONTAINER_BUILD_DOCKERFILE $CERC_CONTAINER_BUILD_WORK_DIR +rc=$? -if [ $? -eq 0 ] && [ "$CERC_CONTAINER_BUILD_TAG" != "cerc/nextjs-base:local" ]; then +if [ $rc -ne 0 ]; then + echo "BUILD FAILED" 1>&2 + exit $rc +fi + +if [ "$CERC_CONTAINER_BUILD_TAG" != "cerc/nextjs-base:local" ]; then cat <&2 + exit $rc +fi + +if [ "$CERC_CONTAINER_BUILD_TAG" != "cerc/webapp-base:local" ]; then cat <