jjb: Check internal links on babeltrace.org before deploy
authorKienan Stewart <kstewart@efficios.com>
Fri, 7 Jul 2023 14:27:27 +0000 (10:27 -0400)
committerKienan Stewart <kstewart@efficios.com>
Fri, 7 Jul 2023 14:33:58 +0000 (10:33 -0400)
Change-Id: Icf09e3e9d7cedde87dffa0ff264b98295a7a337b

scripts/babeltrace-www/deploy.sh

index 617e4ed33657aeb902f9c2e8d39c4137c078ad04..a7981592a5d09ad71c27f22031ea5c30446a03eb 100644 (file)
@@ -27,6 +27,7 @@ cp "$KEY_FILE_VARIABLE" ~/.ssh/id_rsa
 # Nodejs
 # Using Debian, as root
 apt-add-repository ppa:brightbox/ruby-ng
+apt-get update
 apt-get install -y ruby${RUBY_VERSION} ruby${RUBY_VERSION}-dev ruby-switch ruby-bundler
 
 ruby-switch --list
@@ -52,6 +53,26 @@ pip install -r requirements.txt
 # As we've already opened a venv, set SKIP_VENV so the python job doesn't
 # create a second nested virtual environment.
 TERM=dumb SKIP_VENV=1 grunt build:prod --verbose
+
+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"
+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
 
 # In the venv functions generated by the version of python installed on bionic
This page took 0.024075 seconds and 4 git commands to generate.