From: Kienan Stewart Date: Fri, 7 Jul 2023 14:25:54 +0000 (-0400) Subject: jjb: Check internal site links on efficios.com before deploy X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=00c49046e8bd8a6637ef3c8712adf5d4893296dc;p=lttng-ci.git jjb: Check internal site links on efficios.com before deploy Change-Id: I56b36751928d7b06f9d598566ddb0c0cf715287c --- diff --git a/scripts/efficios-www/deploy.sh b/scripts/efficios-www/deploy.sh index 7a9ef22..f1c22d9 100644 --- a/scripts/efficios-www/deploy.sh +++ b/scripts/efficios-www/deploy.sh @@ -22,8 +22,10 @@ set -exu cp "$HOST_PUBLIC_KEYS" ~/.ssh/known_hosts cp "$KEY_FILE_VARIABLE" ~/.ssh/id_rsa +apt-get update + # Nodejs -apt-get install -y npm +apt-get install --no-install-recommends -y npm ./bootstrap-ubuntu.sh npm install @@ -31,5 +33,27 @@ grunt build:dev --verbose grunt deploy:pre --verbose grunt build:prod --verbose + +# Check for broken internal links +apt-get install -y linkchecker +grunt connect:prod watch:prod & +SERVER_PID="${!}" +sleep 10 # While serve:prod starts up +OUTPUT_FILE="$(mktemp -d)/linkchecker-out.csv" +# linkchecker drops privileges to 'nobody' when run as root +chown nobody "$(dirname "${OUTPUT_FILE}")" +# @Note: Only internal links are checked by default +if ! linkchecker -q -F "csv/utf-8/${OUTPUT_FILE}" http://localhost:10000/ ; then + echo "Linkchecker failed or found broken links" + cat "${OUTPUT_FILE}" + kill "${SERVER_PID}" + rm -rf "${OUTPUT_FILE}/.." + sleep 5 # Let serve:prod stop + exit 1 +else + rm -rf "${OUTPUT_FILE}/.." + kill "${SERVER_PID}" +fi + grunt deploy:prod --verbose # EOF