Fix validate-docs script

Validate-docs script return exit 0 status even though
airshipctl command fails in variable assignment with
broken pipe. This make validate-docs zuul gate passes
without complete script execution. In order to solve
this issue added bash option 'set -o pipefail' which
ensure return exit 0 if all commands in the pipeline
exit successfully.

Also minor change in echo statement which should print
'successful site valiation' only when particular phase
evaluate not for skipped phases.

Change-Id: I24db77e8054f4c7017d533b6640516f3141675fc
This commit is contained in:
Pallav Gupta 2021-05-20 23:27:28 -07:00
parent f87fbdbadb
commit 98a7976b73
1 changed files with 2 additions and 1 deletions

View File

@ -15,6 +15,7 @@
# The makefile entrypoint driver for document validation
# Expected to be run from the project root
set -xe
set -o pipefail
# The root of the manifest structure to be validated.
# This corresponds to the targetPath in an airshipctl config
@ -83,8 +84,8 @@ for site_root in ${SITE_ROOTS}; do
# TODO (raliev) remove this condition later
if [ "$plan" = "phasePlan" ]; then
airshipctl --airshipconf "${TMP}/$site.cfg" plan validate $plan
echo "Validation of site ${site} is successful!"
fi
echo "Validation of site ${site} is successful!"
done
done
done