]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-website: setup nodejs for building the website 2320/head
authorNizamudeen A <nia@redhat.com>
Mon, 3 Feb 2025 09:04:36 +0000 (14:34 +0530)
committerNizamudeen A <nia@redhat.com>
Tue, 11 Feb 2025 08:14:34 +0000 (13:44 +0530)
Signed-off-by: Nizamudeen A <nia@redhat.com>
ceph-website-prs/build/build
ceph-website-prs/config/definitions/ceph-website-prs.yml
ceph-website/build/build
ceph-website/config/definitions/ceph-website.yml
scripts/ceph-website/install-deps.sh [new file with mode: 0755]

index 1bdb6547807792a4e38d86293d9be047e4803118..85fb6086032c2884730e738bc0c61d94352eb3f0 100755 (executable)
@@ -5,6 +5,14 @@ env
 
 BRANCH=$(echo $GIT_BRANCH | sed 's:.*/::')
 
+set +e
+export NVM_DIR="$HOME/.nvm"
+[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
+[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
+set -e
+
+echo "Using node version $(node -v)"
+
 # https://docs.npmjs.com/cli/v7/commands/npm-ci
 npm ci
 
index 97e0d0a86f4f81541815b4c2268d5ee61dc160cf..25db651668226e083d20e7f2a265fbe091ed05e9 100644 (file)
@@ -55,4 +55,5 @@
     builders:
       - shell:
           !include-raw:
+            - ../../../scripts/ceph-website/install-deps.sh
             - ../../build/build
index d2af5f097120cbcd48e8b618a115f194dd450ae0..6d2f64e49b39efa22d882f490b2caae117a2f0b7 100755 (executable)
@@ -3,6 +3,14 @@ set -ex
 
 env
 
+set +e
+export NVM_DIR="$HOME/.nvm"
+[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
+[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
+set -e
+
+echo "Using node version $(node -v)"
+
 npm install
 
 npm run build:production
index a61bf6d19f034f1f40530e97e18b768e56bee1bc..12cf24384b87dd28b0a44cc675312c7f477c3129 100644 (file)
@@ -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 (executable)
index 0000000..c3e35fd
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -x
+
+# install nvm
+if [[ ! $(command -v nvm) ]]; then
+    # install nvm
+    LATEST_NVM_VERSION=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name')
+    echo "Installing nvm version ${LATEST_NVM_VERSION}"
+
+    curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/${LATEST_NVM_VERSION}/install.sh | bash
+
+    export NVM_DIR="$HOME/.nvm"
+    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
+    [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
+fi
+
+echo "Installing nodejs from nvm with version $(cat .nvmrc)"
+nvm install
+nvm use