From 120a908305b6552b3995714297118a4bdfa7ff12 Mon Sep 17 00:00:00 2001 From: ElayAharoni <62550608+ElayAharoni@users.noreply.github.com> Date: Tue, 20 Aug 2024 20:54:56 +0300 Subject: [PATCH] test: Fail fast when image build fails on tests #11102 (#11115) * Fail fast when image build fails on tests #11102 Signed-off-by: Elay Aharoni (EXT-Nokia) * Fail fast when image build fails on tests #11102 Signed-off-by: Elay Aharoni (EXT-Nokia) --------- Signed-off-by: Elay Aharoni (EXT-Nokia) Co-authored-by: Elay Aharoni (EXT-Nokia) --- scripts/deploy/github/build-images.sh | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/scripts/deploy/github/build-images.sh b/scripts/deploy/github/build-images.sh index ffa6db2e216..1b90d9e7bad 100755 --- a/scripts/deploy/github/build-images.sh +++ b/scripts/deploy/github/build-images.sh @@ -20,14 +20,31 @@ set -e REGISTRY="${REGISTRY:-kind-registry:5000}" TAG="${TAG:-latest}" +EXIT_CODE=0 docker system prune -a -f -docker build -q -t "${REGISTRY}/apiserver:${TAG}" -f backend/Dockerfile . && docker push "${REGISTRY}/apiserver:${TAG}" & -docker build -q -t "${REGISTRY}/persistenceagent:${TAG}" -f backend/Dockerfile.persistenceagent . && docker push "${REGISTRY}/persistenceagent:${TAG}" & -docker build -q -t "${REGISTRY}/scheduledworkflow:${TAG}" -f backend/Dockerfile.scheduledworkflow . && docker push "${REGISTRY}/scheduledworkflow:${TAG}" & +docker build -q -t "${REGISTRY}/apiserver:${TAG}" -f backend/Dockerfile . && docker push "${REGISTRY}/apiserver:${TAG}" || EXIT_CODE=$? +if [[ $EXIT_CODE -ne 0 ]] +then + echo "Failed to build apiserver image." + exit $EXIT_CODE +fi + +docker build -q -t "${REGISTRY}/persistenceagent:${TAG}" -f backend/Dockerfile.persistenceagent . && docker push "${REGISTRY}/persistenceagent:${TAG}" || EXIT_CODE=$? +if [[ $EXIT_CODE -ne 0 ]] +then + echo "Failed to build persistenceagent image." + exit $EXIT_CODE +fi + +docker build -q -t "${REGISTRY}/scheduledworkflow:${TAG}" -f backend/Dockerfile.scheduledworkflow . && docker push "${REGISTRY}/scheduledworkflow:${TAG}" || EXIT_CODE=$? +if [[ $EXIT_CODE -ne 0 ]] +then + echo "Failed to build scheduledworkflow image." + exit $EXIT_CODE +fi -wait # clean up intermittent build caches to free up disk space docker system prune -a -f