ci: install the correct node.js version via nvm (elastic/elasticsearch#3229)

This will ensure that CI runs the Kibana plugin tests with the
appropriate version of node.js.

Original commit: elastic/x-pack-elasticsearch@aeb7399f91
This commit is contained in:
Court Ewing 2016-09-12 14:32:12 -04:00 committed by GitHub
parent 7ee44825a9
commit 877d5feff7
1 changed files with 26 additions and 3 deletions

View File

@ -4,9 +4,13 @@
# It will attempt to check out 'elasticsearch' into a sibling directory
# unless the environment variable `USE_EXISTING_ES` has a value
#
# It will also attempt to install the appropriate version of node.js
# for the Kibana plugin tests using nvm. Set a custom nvm directory
# using the `NVM_DIR` environment variable.
#
# Turn on semi-strict mode
set -euf pipefail
set -e pipefail
SCRIPT="$0"
@ -51,11 +55,30 @@ else
fi
fi
# back to base directory
cd "$BASE_DIR"
# install the correct node.js version
if [ -z ${NVM_DIR:+x} ]; then
export NVM_DIR="/var/lib/jenkins/.nvm";
fi
NVM_SCRIPT="$NVM_DIR/nvm.sh"
if [ -s "$NVM_SCRIPT" ]; then
. "$NVM_SCRIPT" # load nvm
else
echo "Unable to find the nvm script at \"$NVM_SCRIPT\""
exit 1
fi
echo "Installing node.js version $(cat ./kibana/.node-version)..."
nvm install "$(cat ./kibana/.node-version)"
echo "Running X-Plugins tests..."
cd "$BASE_DIR" && echo "Running in $PWD"
echo "Running in $PWD"
# output the commands
set -x
set -xuf
# clean
gradle --stacktrace clean