Commit 9be7883f authored by Paul Morie's avatar Paul Morie

Make hack/update-all.sh short-circuit unless run with -a

parent ca69c2e3
...@@ -23,9 +23,13 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. ...@@ -23,9 +23,13 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/cluster/kube-env.sh" source "${KUBE_ROOT}/cluster/kube-env.sh"
SILENT=true SILENT=true
ALL=false
while getopts ":v" opt; do while getopts ":va" opt; do
case $opt in case $opt in
a)
ALL=true
;;
v) v)
SILENT=false SILENT=false
;; ;;
...@@ -36,10 +40,16 @@ while getopts ":v" opt; do ...@@ -36,10 +40,16 @@ while getopts ":v" opt; do
esac esac
done done
trap 'exit 1' SIGINT
if $SILENT ; then if $SILENT ; then
echo "Running in the silent mode, run with -v if you want to see script logs." echo "Running in the silent mode, run with -v if you want to see script logs."
fi fi
if ! $ALL ; then
echo "Running in short-circuit mode; run with -a to force all scripts to run."
fi
BASH_TARGETS="codecgen BASH_TARGETS="codecgen
generated-conversions generated-conversions
generated-deep-copies generated-deep-copies
...@@ -52,10 +62,22 @@ BASH_TARGETS="codecgen ...@@ -52,10 +62,22 @@ BASH_TARGETS="codecgen
for t in $BASH_TARGETS for t in $BASH_TARGETS
do do
echo -e "Updating $t" echo -e "${color_yellow}Updating $t${color_norm}"
if $SILENT ; then if $SILENT ; then
bash "$KUBE_ROOT/hack/update-$t.sh" 1> /dev/null || echo -e "${color_red}FAILED${color_norm}" if ! bash "$KUBE_ROOT/hack/update-$t.sh" 1> /dev/null; then
echo -e "${color_red}Updating $t FAILED${color_norm}"
if ! $ALL; then
exit 1
fi
fi
else else
bash "$KUBE_ROOT/hack/update-$t.sh" if ! bash "$KUBE_ROOT/hack/update-$t.sh"; then
echo -e "${color_red}$Updating $t FAILED${color_norm}"
if ! $ALL; then
exit 1
fi
fi
fi fi
done done
echo -e "${color_green}Update scripts completed successfully${color_norm}"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment