Skip to content

Commit 93544cc

Browse files
authored
handle image push errors (#178)
1 parent 247f857 commit 93544cc

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

skylib/k8s_gitops.sh.tpl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ function async() {
5656
}
5757

5858
function waitpids() {
59-
# Wait for all of the subprocesses, failing the script if any of them failed.
60-
if [ "${#PIDS[@]}" != 0 ]; then
61-
for pid in ${PIDS[@]}; do
62-
wait ${pid}
63-
done
64-
fi
59+
# Wait for all of the subprocesses, returning the exit code of the first failed process.
60+
if [ "${#PIDS[@]}" != 0 ]; then
61+
for pid in ${PIDS[@]}; do
62+
wait ${pid} || return $?
63+
done
64+
fi
6565
}
6666

6767
cd $BUILD_WORKSPACE_DIRECTORY
@@ -73,4 +73,6 @@ else
7373
TARGET_DIR=$BUILD_WORKSPACE_DIRECTORY
7474
fi
7575

76+
# make sure that the scirpt is immediately exits if any command below fails
77+
set -o errexit
7678
%{statements}

0 commit comments

Comments
 (0)