Merge pull request #14445 from eparis/verify-all-return-error

hack/verify-all.sh return error on errors
This commit is contained in:
Eric Tune 2015-09-23 16:18:40 -07:00
commit db78d27723

View File

@ -24,59 +24,73 @@ source "${KUBE_ROOT}/cluster/kube-env.sh"
SILENT=true SILENT=true
function is-excluded { function is-excluded {
for e in $EXCLUDE; do for e in $EXCLUDE; do
if [[ $1 -ef ${BASH_SOURCE} ]]; then if [[ $1 -ef ${BASH_SOURCE} ]]; then
return return
fi fi
if [[ $1 -ef "$KUBE_ROOT/hack/$e" ]]; then if [[ $1 -ef "$KUBE_ROOT/hack/$e" ]]; then
return return
fi fi
done done
return 1 return 1
} }
while getopts ":v" opt; do while getopts ":v" opt; do
case $opt in case $opt in
v) v)
SILENT=false SILENT=false
;; ;;
\?) \?)
echo "Invalid flag: -$OPTARG" >&2 echo "Invalid flag: -$OPTARG" >&2
exit 1 exit 1
;; ;;
esac esac
done done
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
EXCLUDE="verify-godeps.sh" EXCLUDE="verify-godeps.sh"
ret=0
for t in `ls $KUBE_ROOT/hack/verify-*.sh` for t in `ls $KUBE_ROOT/hack/verify-*.sh`
do do
if is-excluded $t ; then if is-excluded $t ; then
echo "Skipping $t" echo "Skipping $t"
continue continue
fi fi
if $SILENT ; then if $SILENT ; then
echo -e "Verifying $t" echo -e "Verifying $t"
bash "$t" &> /dev/null && echo -e "${color_green}SUCCESS${color_norm}" || echo -e "${color_red}FAILED${color_norm}" if bash "$t" &> /dev/null; then
else echo -e "${color_green}SUCCESS${color_norm}"
bash "$t" || true else
fi echo -e "${color_red}FAILED${color_norm}"
ret=1
fi
else
bash "$t" || ret=1
fi
done done
for t in `ls $KUBE_ROOT/hack/verify-*.py` for t in `ls $KUBE_ROOT/hack/verify-*.py`
do do
if is-excluded $t ; then if is-excluded $t ; then
echo "Skipping $t" echo "Skipping $t"
continue continue
fi fi
if $SILENT ; then if $SILENT ; then
echo -e "Verifying $t" echo -e "Verifying $t"
python "$t" &> /dev/null && echo -e "${color_green}SUCCESS${color_norm}" || echo -e "${color_red}FAILED${color_norm}" if python "$t" &> /dev/null; then
else echo -e "${color_green}SUCCESS${color_norm}"
python "$t" || true else
fi echo -e "${color_red}FAILED${color_norm}"
ret=1
fi
else
python "$t" || ret=1
fi
done done
exit $ret
# ex: ts=2 sw=2 et filetype=sh