jjb: Add job to build and deploy bt2 website
[lttng-ci.git] / scripts / babeltrace-www / deploy.sh
diff --git a/scripts/babeltrace-www/deploy.sh b/scripts/babeltrace-www/deploy.sh
new file mode 100644 (file)
index 0000000..617e4ed
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/bash
+# shellcheck disable=SC2103
+#
+# Copyright (C) 2021 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set -exu
+
+RUBY_VERSION=2.7
+
+# Add ssh key for deployment
+cp "$HOST_PUBLIC_KEYS" ~/.ssh/known_hosts
+cp "$KEY_FILE_VARIABLE" ~/.ssh/id_rsa
+
+# Nodejs
+# Using Debian, as root
+apt-add-repository ppa:brightbox/ruby-ng
+apt-get install -y ruby${RUBY_VERSION} ruby${RUBY_VERSION}-dev ruby-switch ruby-bundler
+
+ruby-switch --list
+ruby-switch --set ruby${RUBY_VERSION}
+
+ruby -v
+export PATH="/root/.gem/ruby/${RUBY_VERSION}.0/bin:$PATH"
+bundle config set --local path "/root/.gem"
+
+
+apt-get install -y jekyll npm grunt python3 python3-pip python3-venv
+
+# babeltrace dependencies
+apt-get install -y asciidoc xmlto libdw-dev libelf-dev elfutils autoconf automake libglib2.0-dev make doxygen flex bison
+
+npm install
+
+python3 -m venv build_venv && source build_venv/bin/activate
+pip install -r requirements.txt
+
+# Setting TERM avoids spurious warnings when configure is checking TPUT, as
+# $TERM is not set in the build environment.
+# 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
+grunt deploy:prod --verbose
+
+# In the venv functions generated by the version of python installed on bionic
+# nodes, the deactivate function checks undefined variables (eg. $1) which causes
+# the build to fail when `set -u` is in effect.
+set +u
+deactivate
+
+# EOF
This page took 0.023992 seconds and 4 git commands to generate.