2 # shellcheck disable=SC2103
4 # Copyright (C) 2021 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
28 message_len
="${#message}"
29 padding_len
=$
(( (80 - (message_len
)) / 2 ))
31 printf '\n'; printf -- '#%.0s' {1.
.80}; printf '\n'
32 printf -- '-%.0s' {1.
.80}; printf '\n'
33 printf -- '#%.0s' $
(seq 1 $padding_len); printf '%s' "$message"; printf -- '#%.0s' $
(seq 1 $padding_len); printf '\n'
34 printf -- '-%.0s' {1.
.80}; printf '\n'
35 printf -- '#%.0s' {1.
.80}; printf '\n\n'
40 # Add ssh key for deployment
41 cp "$HOST_PUBLIC_KEYS" ~
/.ssh
/known_hosts
42 cp "$KEY_FILE_VARIABLE" ~
/.ssh
/id_rsa
44 # lttng-www dependencies
45 export DPKG_FRONTEND
=noninteractive
48 print_header
"Install web tooling dependencies"
49 apt-get
install -y nodejs node-grunt-cli npm ruby-bundler ruby-dev python3-pip python3-venv
53 apt-get
install -y xmlto doclifter linkchecker
55 python3
-m venv build_venv
56 # shellcheck disable=SC1091
57 source build_venv
/bin
/activate
59 bundle config
set --local path
"vendor/bundle"
63 print_header
"Build website with grunt"
64 bundle
exec grunt build
:prod
66 print_header
"Check links"
67 bundle
exec grunt connect
:prod watch
:prod
&
69 sleep 10 # While serve:prod starts up
71 OUTPUT_DIR
="$(mktemp -d)"
72 OUTPUT_FILE
="${OUTPUT_DIR}/linkchecker-out.csv"
74 # linkchecker drops privileges to 'nobody' when run as root
75 chown nobody
"${OUTPUT_DIR}"
77 # @Note: Only internal links are checked by default
78 if ! linkchecker
-q -F "csv/utf-8/${OUTPUT_FILE}" http
://localhost
:10000/ ; then
79 echo "Linkchecker failed or found broken links"
82 rm -rf "${OUTPUT_DIR}"
83 sleep 5 # Let serve:prod stop
86 rm -rf "${OUTPUT_DIR}"
90 print_header
"Deploy website"
91 bundle
exec grunt deploy
:prod
--network