From 68b6e210ccd244bcad640c2034695582929b797c Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Fri, 26 May 2023 16:42:50 -0400 Subject: [PATCH] jjb: Add job to build and deploy bt2 website Change-Id: I94daca69cf0f44dea3eba9fc5533de5c32458fc5 --- jobs/babeltrace-www.yaml | 73 ++++++++++++++++++++++++++++++++ scripts/babeltrace-www/deploy.sh | 63 +++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 jobs/babeltrace-www.yaml create mode 100644 scripts/babeltrace-www/deploy.sh diff --git a/jobs/babeltrace-www.yaml b/jobs/babeltrace-www.yaml new file mode 100644 index 0000000..7ada8ce --- /dev/null +++ b/jobs/babeltrace-www.yaml @@ -0,0 +1,73 @@ +- job: + name: babeltrace-www + project-type: freestyle + defaults: global + node: amd64-rootnode + + description: | + This job is responsible for updating the babeltrace website. + +

Job is managed by Jenkins Job Builder.

+ + wrappers: + - ansicolor + - timestamps + - credentials-binding: + - ssh-user-private-key: + credential-id: 63a5abb5-9056-47e2-b419-f5946c1b8f08 + key-file-variable: KEY_FILE_VARIABLE + username-variable: USER_NAME_VARIABLE + passphrase-variable: PASSPHRASE_VARIABLE + - file: + credential-id: d023f830-9ab0-409f-b977-8cd0e1944dd5 + variable: HOST_PUBLIC_KEYS + properties: + - build-discarder: + num-to-keep: 5 + + triggers: + - timed: '@daily' + builders: + - shell: + !include-raw: scripts/babeltrace-www/deploy.sh + + scm: + - babeltrace-www + + publishers: + - ircbot: + strategy: statechange-only + message-type: summary + matrix-notifier: only-parent + - email-ext: + recipients: 'ci-notification@lists.lttng.org' + reply-to: ci-notification@lists.lttng.org + always: false + unstable: false + first-failure: true + first-unstable: true + not-built: false + aborted: false + regression: false + failure: false + second-failure: false + improvement: false + still-failing: false + success: false + fixed: false + fixed-unhealthy: true + still-unstable: false + pre-build: false + matrix-trigger: only-parent + send-to: + - recipients + +- scm: + name: babeltrace-www + scm: + - git: + url: https://git.internal.efficios.com/efficios/bt2-www.git + basedir: ./ + skip-tag: true + branches: + - master diff --git a/scripts/babeltrace-www/deploy.sh b/scripts/babeltrace-www/deploy.sh new file mode 100644 index 0000000..617e4ed --- /dev/null +++ b/scripts/babeltrace-www/deploy.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# shellcheck disable=SC2103 +# +# Copyright (C) 2021 Jonathan Rajotte-Julien +# +# 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 . + +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 -- 2.34.1