From ed8709458c29a4b2730c5d3d744ddefe75b1c1e6 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Fri, 7 Jul 2023 10:26:50 -0400 Subject: [PATCH] jjb: Check internal site links on lttng.org before deploy Change-Id: I4811b7dc6b9cd988a50e1ce23eb7d7519dc20804 --- scripts/lttng-www/deploy.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/scripts/lttng-www/deploy.sh b/scripts/lttng-www/deploy.sh index f66c53f..ac35fb5 100755 --- a/scripts/lttng-www/deploy.sh +++ b/scripts/lttng-www/deploy.sh @@ -32,7 +32,6 @@ apt-get install -y ruby ruby-bundler ruby-dev ruby -v apt-get install -y asciidoc xmlto python3 python3-pip doclifter - npm install -g grunt-cli npm install -g sass @@ -41,6 +40,26 @@ bundle config set --local path "vendor/bundle" ./bootstrap.sh bundle exec grunt build:prod --network + +apt-get install -y linkchecker +bundle exec grunt connect:prod watch:prod & +SERVER_PID="${!}" +sleep 10 # While serve:prod starts up +OUTPUT_FILE="$(mktemp -d)/linkchecker-out.csv" +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 + bundle exec grunt deploy:prod --network # EOF -- 2.34.1