diff --git a/dev-tools/ci b/dev-tools/ci index 611f30c6ab5..994699bd820 100755 --- a/dev-tools/ci +++ b/dev-tools/ci @@ -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