Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dev/ci_setup] generalize jenkins_setup script for other CI environme…
…nts (#15178) * [dev/ci_setup] generalize jenkins_setup script for other CI environments * [dev/ci_setup] accept more general `CACHE_DIR` env arg * [dev/ci_setup] node.js install might not be invalid
- Loading branch information
Showing
5 changed files
with
56 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
dir="$(pwd)" | ||
cacheDir="${CACHE_DIR:-"/tmp/kibana"}" | ||
|
||
|
||
### | ||
### check that we seem to be in a kibana project | ||
### | ||
if [ -f "$dir/package.json" ] && [ -f "$dir/.node-version" ]; then | ||
echo "Setting up node.js and npm in $dir" | ||
else | ||
echo "src/dev/ci_setup/setup.sh must be run within a kibana repo" | ||
exit 1 | ||
fi | ||
|
||
|
||
### | ||
### download node | ||
### | ||
nodeVersion="$(cat $dir/.node-version)" | ||
nodeUrl="https://nodejs.org/download/release/v$nodeVersion/node-v$nodeVersion-linux-x64.tar.gz" | ||
nodeDir="$cacheDir/node/$nodeVersion" | ||
echo " -- node: version=v${nodeVersion} dir=$nodeDir" | ||
|
||
echo " -- setting up node.js" | ||
if [ -x "$nodeDir/bin/node" ] && [ "$($nodeDir/bin/node --version)" == "v$nodeVersion" ]; then | ||
echo " -- reusing node.js install" | ||
else | ||
if [ -d "$nodeDir" ]; then | ||
echo " -- clearing previous node.js install" | ||
rm -rf "$nodeDir" | ||
fi | ||
|
||
echo " -- downloading node.js from $nodeUrl" | ||
mkdir -p "$nodeDir" | ||
curl --silent "$nodeUrl" | tar -xz -C "$nodeDir" --strip-components=1 | ||
fi | ||
|
||
|
||
### | ||
### "install" node by extending the path with it's bin directory | ||
### | ||
export PATH="$nodeDir/bin:$PATH" | ||
|
||
|
||
### | ||
### install dependencies | ||
### | ||
echo " -- installing node.js dependencies" | ||
npm install --cache "$cacheDir/npm" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
source "$(dirname $0)/_jenkins_setup.sh" | ||
source "$(dirname $0)/../../src/dev/ci_setup/setup.sh" | ||
|
||
"$(npm bin)/grunt" jenkins:docs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
source "$(dirname $0)/_jenkins_setup.sh" | ||
source "$(dirname $0)/../../src/dev/ci_setup/setup.sh" | ||
|
||
xvfb-run "$(npm bin)/grunt" jenkins:unit; |