Skip to content

Commit 85007d2

Browse files
author
Dane Pilcher
committed
ci: set node version for gen 2 tests
1 parent b4c4af5 commit 85007d2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

shared-scripts.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,27 @@ function _lint {
180180
chmod +x .codebuild/scripts/lint_pr.sh && ./.codebuild/scripts/lint_pr.sh
181181
}
182182

183+
function _setupNodeVersion {
184+
local version=$1 # Version number passed as an argument
185+
186+
echo "Installing NVM and setting Node.js version to $version"
187+
188+
# Install NVM
189+
curl -o - https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
190+
191+
# Load NVM
192+
export NVM_DIR="$HOME/.nvm"
193+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
194+
195+
# Install and use the specified Node.js version
196+
nvm install "$version"
197+
nvm use "$version"
198+
199+
# Verify the Node.js version in use
200+
echo "Node.js version in use:"
201+
node -v
202+
}
203+
183204
function _publishToLocalRegistry {
184205
echo "Publish To Local Registry"
185206
loadCacheFromLinuxBuildJob
@@ -274,6 +295,8 @@ function _setupE2ETestsWindows {
274295

275296
function _setupGen2E2ETestsLinux {
276297
echo "Setup Gen2 E2E Tests Linux"
298+
# Set Node.js version to v18.20.6 because execa requires later version
299+
_setupNodeVersion v18.20.4
277300
loadCacheFromLinuxBuildJob
278301
loadCache verdaccio-cache $CODEBUILD_SRC_DIR/../verdaccio-cache
279302
_loadTestAccountCredentials
@@ -282,6 +305,8 @@ function _setupGen2E2ETestsLinux {
282305

283306
function _setupGen2E2ETestsWindows {
284307
echo "Setup Gen2 E2E Tests Windows"
308+
# Set Node.js version to v18.20.6 because execa requires later version
309+
_setupNodeVersion v18.20.4
285310
loadCacheFromWindowsBuildJob
286311
loadCache verdaccio-cache $CODEBUILD_SRC_DIR/../verdaccio-cache windows
287312
_loadTestAccountCredentials

0 commit comments

Comments
 (0)