Add an option to keep_going with run for modules on failure

Signed-off-by: Rajalakshmi Girish <rajalakshmi.girish1@ibm.com>
This commit is contained in:
Rajalakshmi Girish
2023-05-07 00:06:31 -07:00
parent 79eabc1cbf
commit ac61b36e06
2 changed files with 20 additions and 3 deletions

View File

@ -203,11 +203,25 @@ function modules_exp() {
# run given command across all modules and packages
# (unless the set is limited using ${PKG} or / ${USERMOD})
function run_for_modules {
KEEP_GOING_MODULE=${KEEP_GOING_MODULE:-false}
local pkg="${PKG:-./...}"
local fail_mod=false
if [ -z "${USERMOD:-}" ]; then
for m in $(module_dirs); do
run_for_module "${m}" "$@" "${pkg}" || return "$?"
if run_for_module "${m}" "$@" "${pkg}"; then
continue
else
if [ "$KEEP_GOING_MODULE" = false ]; then
log_error "There was a Failure in module ${m}, aborting..."
return 1
fi
log_error "There was a Failure in module ${m}, keep going..."
fail_mod=true
fi
done
if [ "$fail_mod" = true ]; then
return 1
fi
else
run_for_module "${USERMOD}" "$@" "${pkg}" || return "$?"
fi