Hi!
I have a little request that should help detect build failures during automated runs, e.g. when doing ./build update_versions n (in my case through ansible).
For pretty much all builds, there is a section such as this:
What this does is exit with the code 0 when "n" has been selected (interactively or automatically). The exit code when running interactively might not be a big deal. However in automatic runs where I pass "n" as the second option in ansible, the make fails and then exits with 0, and ansible thinks everything was fine.
My suggestion is to exit with the exit code that triggered this section in the first place, for example:
This should (untested) cause ansible (or anything else people use for automation) to report an error for this task, suggesting that a closer investigation on what happened is a good idea.
I have a little request that should help detect build failures during automated runs, e.g. when doing ./build update_versions n (in my case through ansible).
For pretty much all builds, there is a section such as this:
Code:
if [ $? -ne 0 ]; then
if [ ${USER_INPUT} -eq 1 ]; then
printf "\n*** The make has failed, would you like to try to make again? (y,n): \n"
read yesno
echo ""
else
if [ "${INPUT_VALUE}" != "y" ]; then
yesno=n
else
yesno=${INPUT_VALUE}
fi
fi
if [ "${yesno}" = "n" ]; then
do_exit 0
fi
else
break
fi
What this does is exit with the code 0 when "n" has been selected (interactively or automatically). The exit code when running interactively might not be a big deal. However in automatic runs where I pass "n" as the second option in ansible, the make fails and then exits with 0, and ansible thinks everything was fine.
My suggestion is to exit with the exit code that triggered this section in the first place, for example:
Code:
lastexit=$?
if [ ${lastexit} -ne 0 ]; then
if [ ${USER_INPUT} -eq 1 ]; then
printf "\n*** The make has failed, would you like to try to make again? (y,n): \n"
read yesno
echo ""
else
if [ "${INPUT_VALUE}" != "y" ]; then
yesno=n
else
yesno=${INPUT_VALUE}
fi
fi
if [ "${yesno}" = "n" ]; then
do_exit ${lastexit}
fi
else
break
fi
This should (untested) cause ansible (or anything else people use for automation) to report an error for this task, suggesting that a closer investigation on what happened is a good idea.