diff --git a/ceph-website-prs/config/definitions/ceph-website-prs.yml b/ceph-website-prs/config/definitions/ceph-website-prs.yml index 97e0d0a86..25db65166 100644 --- a/ceph-website-prs/config/definitions/ceph-website-prs.yml +++ b/ceph-website-prs/config/definitions/ceph-website-prs.yml @@ -55,4 +55,5 @@ builders: - shell: !include-raw: + - ../../../scripts/ceph-website/install-deps.sh - ../../build/build diff --git a/ceph-website/config/definitions/ceph-website.yml b/ceph-website/config/definitions/ceph-website.yml index a61bf6d19..12cf24384 100644 --- a/ceph-website/config/definitions/ceph-website.yml +++ b/ceph-website/config/definitions/ceph-website.yml @@ -32,4 +32,5 @@ builders: - shell: !include-raw: + - ../../../scripts/ceph-website/install-deps.sh - ../../build/build diff --git a/scripts/ceph-website/install-deps.sh b/scripts/ceph-website/install-deps.sh new file mode 100755 index 000000000..3f42236e1 --- /dev/null +++ b/scripts/ceph-website/install-deps.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -ex + +# install node.js +NODEJS_MAJOR_VERSION=20 +DISTRO="$(lsb_release -cs)" +if [[ ! $(command -v node) || $(node --version | grep -oE "v([0-9])+" | cut -c 2-) < ${NODEJS_MAJOR_VERSION} ]]; then + NODEJS_KEYRING=/usr/share/keyrings/nodesource.gpg + NODESOURCE_PATH=/etc/apt/sources.list.d/nodesource.list + + # remove the manually installed node from the system + sudo rm -f /usr/local/bin/node + sudo rm -f /usr/local/bin/npm + sudo rm -rf /usr/local/lib/node_modules/ + sudo rm -f ${NODESOURCE_PATH} + + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee "${NODEJS_KEYRING}" >/dev/null + gpg --no-default-keyring --keyring "${NODEJS_KEYRING}" --list-keys + + NODEJS_VERSION="node_${NODEJS_MAJOR_VERSION}.x" + echo "deb [signed-by=${NODEJS_KEYRING}] https://deb.nodesource.com/${NODEJS_VERSION} ${DISTRO} main" | sudo tee ${NODESOURCE_PATH} + echo "deb-src [signed-by=${NODEJS_KEYRING}] https://deb.nodesource.com/${NODEJS_VERSION} ${DISTRO} main" | sudo tee -a ${NODESOURCE_PATH} + + sudo apt update -y + sudo apt install -y nodejs + sudo rm -f ${NODESOURCE_PATH} +fi + +# print the version of node +node --version