Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ceph-website: setup nodejs for building the website #2320

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ceph-website-prs/config/definitions/ceph-website-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@
builders:
- shell:
!include-raw:
- ../../../scripts/ceph-website/install-deps.sh
- ../../build/build
1 change: 1 addition & 0 deletions ceph-website/config/definitions/ceph-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@
builders:
- shell:
!include-raw:
- ../../../scripts/ceph-website/install-deps.sh
- ../../build/build
30 changes: 30 additions & 0 deletions scripts/ceph-website/install-deps.sh
Original file line number Diff line number Diff line change
@@ -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