ansible: Correct launcher delegate host for rootnodes
[lttng-ci.git] / scripts / babeltrace-www / deploy.sh
CommitLineData
68b6e210
KS
1#!/bin/bash
2# shellcheck disable=SC2103
3#
4# Copyright (C) 2021 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
5#
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.
10#
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.
15#
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/>.
18
19set -exu
20
21RUBY_VERSION=2.7
22
23# Add ssh key for deployment
24cp "$HOST_PUBLIC_KEYS" ~/.ssh/known_hosts
25cp "$KEY_FILE_VARIABLE" ~/.ssh/id_rsa
26
27# Nodejs
28# Using Debian, as root
29apt-add-repository ppa:brightbox/ruby-ng
69114bc9 30apt-get update
68b6e210
KS
31apt-get install -y ruby${RUBY_VERSION} ruby${RUBY_VERSION}-dev ruby-switch ruby-bundler
32
33ruby-switch --list
34ruby-switch --set ruby${RUBY_VERSION}
35
36ruby -v
37export PATH="/root/.gem/ruby/${RUBY_VERSION}.0/bin:$PATH"
38bundle config set --local path "/root/.gem"
39
40
41apt-get install -y jekyll npm grunt python3 python3-pip python3-venv
42
43# babeltrace dependencies
44apt-get install -y asciidoc xmlto libdw-dev libelf-dev elfutils autoconf automake libglib2.0-dev make doxygen flex bison
45
46npm install
47
48python3 -m venv build_venv && source build_venv/bin/activate
49pip install -r requirements.txt
50
51# Setting TERM avoids spurious warnings when configure is checking TPUT, as
52# $TERM is not set in the build environment.
53# As we've already opened a venv, set SKIP_VENV so the python job doesn't
54# create a second nested virtual environment.
55TERM=dumb SKIP_VENV=1 grunt build:prod --verbose
69114bc9
KS
56
57apt-get install -y linkchecker
58grunt connect:prod watch:prod &
59SERVER_PID="${!}"
60sleep 10 # While serve:prod starts up
61OUTPUT_FILE="$(mktemp -d)/linkchecker-out.csv"
62chown nobody "$(dirname "${OUTPUT_FILE}")"
63# @Note: Only internal links are checked by default
64if ! linkchecker -q -F "csv/utf-8/${OUTPUT_FILE}" http://localhost:10000/ ; then
65 echo "Linkchecker failed or found broken links"
66 cat "${OUTPUT_FILE}"
67 kill "${SERVER_PID}"
68 rm -rf "${OUTPUT_FILE}/.."
69 sleep 5 # Let serve:prod stop
70 exit 1
71else
72 rm -rf "${OUTPUT_FILE}/.."
73 kill "${SERVER_PID}"
74fi
75
68b6e210
KS
76grunt deploy:prod --verbose
77
78# In the venv functions generated by the version of python installed on bionic
79# nodes, the deactivate function checks undefined variables (eg. $1) which causes
80# the build to fail when `set -u` is in effect.
81set +u
82deactivate
83
84# EOF
This page took 0.046421 seconds and 4 git commands to generate.