| 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 | |
| 19 | set -exu |
| 20 | |
| 21 | RUBY_VERSION=2.7 |
| 22 | |
| 23 | # Add ssh key for deployment |
| 24 | cp "$HOST_PUBLIC_KEYS" ~/.ssh/known_hosts |
| 25 | cp "$KEY_FILE_VARIABLE" ~/.ssh/id_rsa |
| 26 | |
| 27 | # Nodejs |
| 28 | # Using Debian, as root |
| 29 | apt-add-repository ppa:brightbox/ruby-ng |
| 30 | apt-get install -y ruby${RUBY_VERSION} ruby${RUBY_VERSION}-dev ruby-switch ruby-bundler |
| 31 | |
| 32 | ruby-switch --list |
| 33 | ruby-switch --set ruby${RUBY_VERSION} |
| 34 | |
| 35 | ruby -v |
| 36 | export PATH="/root/.gem/ruby/${RUBY_VERSION}.0/bin:$PATH" |
| 37 | bundle config set --local path "/root/.gem" |
| 38 | |
| 39 | |
| 40 | apt-get install -y jekyll npm grunt python3 python3-pip python3-venv |
| 41 | |
| 42 | # babeltrace dependencies |
| 43 | apt-get install -y asciidoc xmlto libdw-dev libelf-dev elfutils autoconf automake libglib2.0-dev make doxygen flex bison |
| 44 | |
| 45 | npm install |
| 46 | |
| 47 | python3 -m venv build_venv && source build_venv/bin/activate |
| 48 | pip install -r requirements.txt |
| 49 | |
| 50 | # Setting TERM avoids spurious warnings when configure is checking TPUT, as |
| 51 | # $TERM is not set in the build environment. |
| 52 | # As we've already opened a venv, set SKIP_VENV so the python job doesn't |
| 53 | # create a second nested virtual environment. |
| 54 | TERM=dumb SKIP_VENV=1 grunt build:prod --verbose |
| 55 | grunt deploy:prod --verbose |
| 56 | |
| 57 | # In the venv functions generated by the version of python installed on bionic |
| 58 | # nodes, the deactivate function checks undefined variables (eg. $1) which causes |
| 59 | # the build to fail when `set -u` is in effect. |
| 60 | set +u |
| 61 | deactivate |
| 62 | |
| 63 | # EOF |