Merge "ansible: Do not update jenkins node during ci-instances when not set"
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 15 Aug 2023 17:29:45 +0000 (13:29 -0400)
committerGerrit Code Review <review@lttng.org>
Tue, 15 Aug 2023 17:29:45 +0000 (13:29 -0400)
automation/ansible/vars/ci-instances.yml
jobs/babeltrace-www.yaml
jobs/efficios-www.yaml
jobs/lttng-www.yaml
scripts/babeltrace-www/deploy.sh
scripts/efficios-www/deploy.sh
scripts/lttng-www/deploy.sh

index 526457c20fdd38f97675d29b3f60c4ed7f1bc285..48b8880a4927064e59df8d2d7d428111edfbd9ee 100644 (file)
@@ -783,7 +783,7 @@ containers:
         launcher/virtualMachineName: 'ci-rootnode-deb12-amd64-1b-01'
         launcher/delegate: 'hudson.plugins.sshslaves.SSHLauncher=class'
         launcher/delegate/port: '22'
-        launcher/delegate/host: 'ci-rootnode-deb12-amd64-1a-01.internal.efficios.com'
+        launcher/delegate/host: 'ci-rootnode-deb12-amd64-1b-01.internal.efficios.com'
         launcher/delegate/credentialsId: 'bb5a81cf-346b-43fc-8586-3dc5e43801be'
         ./hypervisorDescription: 'QEMU+ssh - ci-host-amd64-1b.internal.efficios.com'
         ./virtualMachineName: 'ci-rootnode-deb12-amd64-1b-01'
@@ -808,7 +808,7 @@ containers:
         launcher/virtualMachineName: 'ci-rootnode-deb12-amd64-1c-01'
         launcher/delegate: 'hudson.plugins.sshslaves.SSHLauncher=class'
         launcher/delegate/port: '22'
-        launcher/delegate/host: 'ci-rootnode-deb12-amd64-1a-01.internal.efficios.com'
+        launcher/delegate/host: 'ci-rootnode-deb12-amd64-1c-01.internal.efficios.com'
         launcher/delegate/credentialsId: 'bb5a81cf-346b-43fc-8586-3dc5e43801be'
         snapshotName: ''
         beforeJobSnapshotName: 'base-configuration'
@@ -830,7 +830,7 @@ containers:
         launcher/virtualMachineName: 'ci-rootnode-deb12-amd64-1d-01'
         launcher/delegate: 'hudson.plugins.sshslaves.SSHLauncher=class'
         launcher/delegate/port: '22'
-        launcher/delegate/host: 'ci-rootnode-deb12-amd64-1a-01.internal.efficios.com'
+        launcher/delegate/host: 'ci-rootnode-deb12-amd64-1d-01.internal.efficios.com'
         launcher/delegate/credentialsId: 'bb5a81cf-346b-43fc-8586-3dc5e43801be'
         ./hypervisorDescription: 'QEMU+ssh - ci-host-amd64-1d.internal.efficios.com'
         ./virtualMachineName: 'ci-rootnode-deb12-amd64-1d-01'
@@ -855,7 +855,7 @@ containers:
         launcher/virtualMachineName: 'ci-rootnode-deb12-amd64-2a-01'
         launcher/delegate: 'hudson.plugins.sshslaves.SSHLauncher=class'
         launcher/delegate/port: '22'
-        launcher/delegate/host: 'ci-rootnode-deb12-amd64-1a-01.internal.efficios.com'
+        launcher/delegate/host: 'ci-rootnode-deb12-amd64-2a-01.internal.efficios.com'
         launcher/delegate/credentialsId: 'bb5a81cf-346b-43fc-8586-3dc5e43801be'
         ./hypervisorDescription: 'QEMU+ssh - ci-host-amd64-2a.internal.efficios.com'
         ./virtualMachineName: 'ci-rootnode-deb12-amd64-2a-01'
@@ -879,7 +879,7 @@ containers:
         launcher/virtualMachineName: 'ci-rootnode-deb12-amd64-2b-01'
         launcher/delegate: 'hudson.plugins.sshslaves.SSHLauncher=class'
         launcher/delegate/port: '22'
-        launcher/delegate/host: 'ci-rootnode-deb12-amd64-1a-01.internal.efficios.com'
+        launcher/delegate/host: 'ci-rootnode-deb12-amd64-2b-01.internal.efficios.com'
         launcher/delegate/credentialsId: 'bb5a81cf-346b-43fc-8586-3dc5e43801be'
         ./hypervisorDescription: 'QEMU+ssh - ci-host-amd64-2b.internal.efficios.com'
         ./virtualMachineName: 'ci-rootnode-deb12-amd64-2b-01'
@@ -904,7 +904,7 @@ containers:
         launcher/virtualMachineName: 'ci-rootnode-deb12-amd64-2c-01'
         launcher/delegate: 'hudson.plugins.sshslaves.SSHLauncher=class'
         launcher/delegate/port: '22'
-        launcher/delegate/host: 'ci-rootnode-deb12-amd64-1a-01.internal.efficios.com'
+        launcher/delegate/host: 'ci-rootnode-deb12-amd64-2c-01.internal.efficios.com'
         launcher/delegate/credentialsId: 'bb5a81cf-346b-43fc-8586-3dc5e43801be'
         ./hypervisorDescription: 'QEMU+ssh - ci-host-amd64-2c.internal.efficios.com'
         ./virtualMachineName: 'ci-rootnode-deb12-amd64-2c-01'
@@ -929,7 +929,7 @@ containers:
         launcher/virtualMachineName: 'ci-rootnode-deb12-amd64-2d-01'
         launcher/delegate: 'hudson.plugins.sshslaves.SSHLauncher=class'
         launcher/delegate/port: '22'
-        launcher/delegate/host: 'ci-rootnode-deb12-amd64-1a-01.internal.efficios.com'
+        launcher/delegate/host: 'ci-rootnode-deb12-amd64-2d-01.internal.efficios.com'
         launcher/delegate/credentialsId: 'bb5a81cf-346b-43fc-8586-3dc5e43801be'
         ./hypervisorDescription: 'QEMU+ssh - ci-host-amd64-2d.internal.efficios.com'
         ./virtualMachineName: 'ci-rootnode-deb12-amd64-2d-01'
index 7ada8ce49cae6e11475fb29b4138d35fc044225f..37dc0f82c480e490f0b59a30fcc4638a7eb8b61a 100644 (file)
         - 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
+      - git:
+          url: https://git.internal.efficios.com/efficios/bt2-www.git
+          basedir: ./
+          skip-tag: true
+          branches:
+            - master
 
     publishers:
+      - archive:
+          artifacts: 'site/**,prod/**'
+          follow-symlinks: true
+          allow-empty: false
       - ircbot:
           strategy: statechange-only
           message-type: summary
           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
index 19cd30a1d5b2dbd0375549c51e193dd528aa1c9c..f4ab347c6eb0dc2b3242f163847d7fc566855240 100644 (file)
@@ -2,7 +2,7 @@
     name: efficios-www
     project-type: freestyle
     defaults: global
-    node: amd64-rootnode-jammy
+    node: amd64-rootnode
 
     description: |
       This job is responsible for updating the efficios website.
@@ -21,6 +21,7 @@
         - file:
             credential-id: d023f830-9ab0-409f-b977-8cd0e1944dd5
             variable: HOST_PUBLIC_KEYS
+
     properties:
       - build-discarder:
           num-to-keep: 5
     triggers:
       - pollscm:
           cron: "@hourly"
+
     builders:
       - shell:
           !include-raw: scripts/efficios-www/deploy.sh
 
     scm:
-      - efficios-www
+      - git:
+          url: git@git.internal.efficios.com:efficios/efficios-www.git
+          credentials-id: f3c907b6-7485-49e1-afe1-4df24fac4ca1
+          basedir: ./
+          skip-tag: true
+          branches:
+            - master
 
     publishers:
+      - archive:
+          artifacts: 'site/**,prod/**'
+          follow-symlinks: true
+          allow-empty: false
       - ircbot:
           strategy: statechange-only
           message-type: summary
           matrix-trigger: only-parent
           send-to:
             - recipients
-
-- scm:
-    name: efficios-www
-    scm:
-      - git:
-          url: git@git.internal.efficios.com:efficios/efficios-www.git
-          credentials-id: f3c907b6-7485-49e1-afe1-4df24fac4ca1
-          basedir: ./
-          skip-tag: true
-          branches:
-            - master
index 15ea9a2bceb8712ef9a9c29aeebe3c5856560bed..4e18c59090f374ad808af6110199cacc416a366c 100644 (file)
@@ -2,7 +2,7 @@
     name: lttng-www
     project-type: freestyle
     defaults: global
-    node: amd64-rootnode-jammy
+    node: amd64-rootnode
 
     description: |
       This job is responsible for updating the lttng website.
           !include-raw: scripts/lttng-www/deploy.sh
 
     scm:
-      - lttng-www
+      - git:
+          url: git@git.efficios.com:lttng-www.git
+          credentials-id: 63a5abb5-9056-47e2-b419-f5946c1b8f08
+          basedir: ./
+          skip-tag: true
+          branches:
+            - master
 
     publishers:
+      - archive:
+          artifacts: 'site/**,prod/**'
+          follow-symlinks: true
+          allow-empty: false
       - ircbot:
           strategy: statechange-only
           message-type: summary
           matrix-trigger: only-parent
           send-to:
             - recipients
-
-- scm:
-    name: lttng-www
-    scm:
-      - git:
-          url: git@git.efficios.com:lttng-www.git
-          credentials-id: 63a5abb5-9056-47e2-b419-f5946c1b8f08
-          basedir: ./
-          skip-tag: true
-          branches:
-            - master
-
index a7981592a5d09ad71c27f22031ea5c30446a03eb..21010571a6555b24a8c12688b6b2cf7d572ed01a 100644 (file)
@@ -2,6 +2,7 @@
 # shellcheck disable=SC2103
 #
 # Copyright (C) 2021 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+#               2023 Michael Jeanson <mjeanson@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
 
 set -exu
 
-RUBY_VERSION=2.7
+print_header() {
+    set +x
+
+    local message=" $1 "
+    local message_len
+    local padding_len
+
+    message_len="${#message}"
+    padding_len=$(( (80 - (message_len)) / 2 ))
+
+    printf '\n'; printf -- '#%.0s' {1..80}; printf '\n'
+    printf -- '-%.0s' {1..80}; printf '\n'
+    printf -- '#%.0s' $(seq 1 $padding_len); printf '%s' "$message"; printf -- '#%.0s' $(seq 1 $padding_len); printf '\n'
+    printf -- '-%.0s' {1..80}; printf '\n'
+    printf -- '#%.0s' {1..80}; printf '\n\n'
+
+    set -x
+}
 
 # 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
+export DEBIAN_FRONTEND=noninteractive
 apt-get update
-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"
+print_header "Install web tooling dependencies"
+apt-get install -y jekyll npm grunt python3 python3-pip python3-venv linkchecker
 
-
-apt-get install -y jekyll npm grunt python3 python3-pip python3-venv
-
-# babeltrace dependencies
+print_header "Install babeltrace build dependencies"
 apt-get install -y asciidoc xmlto libdw-dev libelf-dev elfutils autoconf automake libglib2.0-dev make doxygen flex bison
 
+print_header "Install NPM stuff"
 npm install
 
-python3 -m venv build_venv && source build_venv/bin/activate
+print_header "Install Python requirements"
+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
+print_header "Build website with grunt"
+TERM=dumb SKIP_VENV=1 VERBOSE=1 grunt build:prod --verbose
 
-apt-get install -y linkchecker
+print_header "Check links"
 grunt connect:prod watch:prod &
 SERVER_PID="${!}"
 sleep 10 # While serve:prod starts up
-OUTPUT_FILE="$(mktemp -d)/linkchecker-out.csv"
-chown nobody "$(dirname "${OUTPUT_FILE}")"
+
+OUTPUT_DIR="$(mktemp -d)"
+OUTPUT_FILE="${OUTPUT_DIR}/linkchecker-out.csv"
+
+# linkchecker drops privileges to 'nobody' when run as root
+chown nobody "${OUTPUT_DIR}"
+
 # @Note: Only internal links are checked by default
 if ! linkchecker -q -F "csv/utf-8/${OUTPUT_FILE}" http://localhost:10000/ ; then
     echo "Linkchecker failed or found broken links"
     cat "${OUTPUT_FILE}"
     kill "${SERVER_PID}"
-    rm -rf "${OUTPUT_FILE}/.."
+    rm -rf "${OUTPUT_DIR}"
     sleep 5 # Let serve:prod stop
     exit 1
 else
-    rm -rf "${OUTPUT_FILE}/.."
+    rm -rf "${OUTPUT_DIR}"
     kill "${SERVER_PID}"
 fi
 
+print_header "Deploy website"
 grunt deploy:prod --verbose
 
 # In the venv functions generated by the version of python installed on bionic
index f1c22d9b6cd737e60c0d5852fabb9c3aa274221c..9f0fb1386b35002f10c4b500690533812f0ee373 100644 (file)
 
 set -exu
 
+print_header() {
+    set +x
+
+    local message=" $1 "
+    local message_len
+    local padding_len
+
+    message_len="${#message}"
+    padding_len=$(( (80 - (message_len)) / 2 ))
+
+    printf '\n'; printf -- '#%.0s' {1..80}; printf '\n'
+    printf -- '-%.0s' {1..80}; printf '\n'
+    printf -- '#%.0s' $(seq 1 $padding_len); printf '%s' "$message"; printf -- '#%.0s' $(seq 1 $padding_len); printf '\n'
+    printf -- '-%.0s' {1..80}; printf '\n'
+    printf -- '#%.0s' {1..80}; printf '\n\n'
+
+    set -x
+}
+
 # Add ssh key for deployment
 cp "$HOST_PUBLIC_KEYS" ~/.ssh/known_hosts
 cp "$KEY_FILE_VARIABLE" ~/.ssh/id_rsa
 
+export DEBIAN_FRONTEND=noninteractive
 apt-get update
 
-# Nodejs
+print_header "Install web tooling dependencies"
 apt-get install --no-install-recommends -y npm
 ./bootstrap-ubuntu.sh
+
+print_header "Install NPM stuff"
 npm install
 
+print_header "Build website with grunt"
 grunt build:dev --verbose
 grunt deploy:pre --verbose
 
 grunt build:prod --verbose
 
 # Check for broken internal links
+print_header "Check links"
 apt-get install -y linkchecker
 grunt connect:prod watch:prod &
 SERVER_PID="${!}"
 sleep 10 # While serve:prod starts up
-OUTPUT_FILE="$(mktemp -d)/linkchecker-out.csv"
+
+OUTPUT_DIR="$(mktemp -d)"
+OUTPUT_FILE="${OUTPUT_DIR}/linkchecker-out.csv"
+
 # linkchecker drops privileges to 'nobody' when run as root
-chown nobody "$(dirname "${OUTPUT_FILE}")"
+chown nobody "${OUTPUT_DIR}"
+
 # @Note: Only internal links are checked by default
 if ! linkchecker -q -F "csv/utf-8/${OUTPUT_FILE}" http://localhost:10000/ ; then
     echo "Linkchecker failed or found broken links"
     cat "${OUTPUT_FILE}"
     kill "${SERVER_PID}"
-    rm -rf "${OUTPUT_FILE}/.."
+    rm -rf "${OUTPUT_DIR}"
     sleep 5 # Let serve:prod stop
     exit 1
 else
-    rm -rf "${OUTPUT_FILE}/.."
+    rm -rf "${OUTPUT_DIR}"
     kill "${SERVER_PID}"
 fi
 
+print_header "Deploy website"
 grunt deploy:prod --verbose
 # EOF
index ac35fb515955ca662fc85202f4feb6716f501c0a..3d73a4d3ca74b528f7351d7a7b409e85cb1ecf8c 100755 (executable)
 
 set -exu
 
+print_header() {
+    set +x
+
+    local message=" $1 "
+    local message_len
+    local padding_len
+
+    message_len="${#message}"
+    padding_len=$(( (80 - (message_len)) / 2 ))
+
+    printf '\n'; printf -- '#%.0s' {1..80}; printf '\n'
+    printf -- '-%.0s' {1..80}; printf '\n'
+    printf -- '#%.0s' $(seq 1 $padding_len); printf '%s' "$message"; printf -- '#%.0s' $(seq 1 $padding_len); printf '\n'
+    printf -- '-%.0s' {1..80}; printf '\n'
+    printf -- '#%.0s' {1..80}; printf '\n\n'
+
+    set -x
+}
+
 # Add ssh key for deployment
 cp "$HOST_PUBLIC_KEYS" ~/.ssh/known_hosts
 cp "$KEY_FILE_VARIABLE" ~/.ssh/id_rsa
 
 # lttng-www dependencies
 export DPKG_FRONTEND=noninteractive
-# Nodejs
-# Using Debian, as root
 apt-get update
-apt-get install -y nodejs npm
-apt-get install -y ruby ruby-bundler ruby-dev
+
+print_header "Install web tooling dependencies"
+apt-get install -y nodejs node-grunt-cli npm ruby-bundler ruby-dev python3-pip python3-venv
+
 ruby -v
 
-apt-get install -y asciidoc xmlto python3 python3-pip doclifter
-npm install -g grunt-cli
-npm install -g sass
+apt-get install -y xmlto doclifter linkchecker
+
+python3 -m venv build_venv
+# shellcheck disable=SC1091
+source build_venv/bin/activate
 
 bundle config set --local path "vendor/bundle"
 
-./bootstrap.sh
+./bootstrap-debian.sh
 
-bundle exec grunt build:prod --network
+print_header "Build website with grunt"
+bundle exec grunt build:prod
 
-apt-get install -y linkchecker
+print_header "Check links"
 bundle exec grunt connect:prod watch:prod &
 SERVER_PID="${!}"
 sleep 10 # While serve:prod starts up
-OUTPUT_FILE="$(mktemp -d)/linkchecker-out.csv"
-chown nobody "$(dirname "${OUTPUT_FILE}")"
+
+OUTPUT_DIR="$(mktemp -d)"
+OUTPUT_FILE="${OUTPUT_DIR}/linkchecker-out.csv"
+
+# linkchecker drops privileges to 'nobody' when run as root
+chown nobody "${OUTPUT_DIR}"
+
 # @Note: Only internal links are checked by default
 if ! linkchecker -q -F "csv/utf-8/${OUTPUT_FILE}" http://localhost:10000/ ; then
     echo "Linkchecker failed or found broken links"
     cat "${OUTPUT_FILE}"
     kill "${SERVER_PID}"
-    rm -rf "${OUTPUT_FILE}/.."
+    rm -rf "${OUTPUT_DIR}"
     sleep 5 # Let serve:prod stop
     exit 1
 else
-    rm -rf "${OUTPUT_FILE}/.."
+    rm -rf "${OUTPUT_DIR}"
     kill "${SERVER_PID}"
 fi
 
+print_header "Deploy website"
 bundle exec grunt deploy:prod --network
 
 # EOF
This page took 0.031639 seconds and 4 git commands to generate.