2018-11-16 07:39:53 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-11-29 11:59:22 +01:00
|
|
|
set -e
|
|
|
|
|
2019-03-08 22:25:01 +01:00
|
|
|
branch="$(git rev-parse --abbrev-ref HEAD 2> /dev/null)"
|
|
|
|
|
2018-11-17 01:40:14 +01:00
|
|
|
# run setup script that gives us node, yarn, and bootstraps the project
|
2018-11-29 16:20:29 +01:00
|
|
|
source src/dev/ci_setup/setup.sh;
|
2018-11-17 01:40:14 +01:00
|
|
|
|
2018-11-26 19:33:33 +01:00
|
|
|
# download es snapshots
|
2018-11-17 01:40:14 +01:00
|
|
|
node scripts/es snapshot --download-only;
|
2019-03-07 01:31:51 +01:00
|
|
|
node scripts/es snapshot --license=oss --download-only;
|
2018-11-17 01:40:14 +01:00
|
|
|
|
2018-11-26 19:33:33 +01:00
|
|
|
# download reporting browsers
|
2019-03-09 23:55:58 +01:00
|
|
|
(cd "x-pack" && yarn gulp prepare);
|
2018-11-26 19:33:33 +01:00
|
|
|
|
2019-03-29 23:12:32 +01:00
|
|
|
# cache the chromedriver archive
|
2019-03-05 21:03:07 +01:00
|
|
|
chromedriverDistVersion="$(node -e "console.log(require('chromedriver').version)")"
|
|
|
|
chromedriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.chromedriver)")"
|
|
|
|
if [ -z "$chromedriverDistVersion" ] || [ -z "$chromedriverPkgVersion" ]; then
|
|
|
|
echo "UNABLE TO DETERMINE CHROMEDRIVER VERSIONS"
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-04-01 03:13:10 +02:00
|
|
|
mkdir -p .chromedriver
|
2019-03-08 22:25:01 +01:00
|
|
|
curl "https://chromedriver.storage.googleapis.com/$chromedriverDistVersion/chromedriver_linux64.zip" > .chromedriver/chromedriver.zip
|
|
|
|
echo "$chromedriverPkgVersion" > .chromedriver/pkgVersion
|
2019-03-05 21:03:07 +01:00
|
|
|
|
2019-07-20 06:24:48 +02:00
|
|
|
# cache the geckodriver archive
|
|
|
|
geckodriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.geckodriver)")"
|
|
|
|
if [ -z "$geckodriverPkgVersion" ]; then
|
|
|
|
echo "UNABLE TO DETERMINE geckodriver VERSIONS"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
mkdir -p ".geckodriver"
|
|
|
|
cp "node_modules/geckodriver/geckodriver.tar.gz" .geckodriver/geckodriver.tar.gz
|
|
|
|
echo "$geckodriverPkgVersion" > .geckodriver/pkgVersion
|
|
|
|
|
2020-06-01 20:41:30 +02:00
|
|
|
echo "Creating bootstrap_cache archive"
|
|
|
|
|
2018-11-17 01:40:14 +01:00
|
|
|
# archive cacheable directories
|
|
|
|
mkdir -p "$HOME/.kibana/bootstrap_cache"
|
2019-03-08 22:25:01 +01:00
|
|
|
tar -cf "$HOME/.kibana/bootstrap_cache/$branch.tar" \
|
2020-06-04 00:40:56 +02:00
|
|
|
x-pack/plugins/reporting/.chromium \
|
2019-03-05 21:03:07 +01:00
|
|
|
.es \
|
2019-07-20 06:24:48 +02:00
|
|
|
.chromedriver \
|
|
|
|
.geckodriver;
|
2019-03-08 22:25:01 +01:00
|
|
|
|
2020-06-01 20:41:30 +02:00
|
|
|
echo "Adding node_modules"
|
|
|
|
# Find all of the node_modules directories that aren't test fixtures, and aren't inside other node_modules directories, and append them to the tar
|
|
|
|
find . -type d -name node_modules -not -path '*__fixtures__*' -prune -print0 | xargs -0I % tar -rf "$HOME/.kibana/bootstrap_cache/$branch.tar" "%"
|
|
|
|
|
2019-03-08 22:25:01 +01:00
|
|
|
echo "created $HOME/.kibana/bootstrap_cache/$branch.tar"
|
2019-03-09 17:48:46 +01:00
|
|
|
|
|
|
|
if [ "$branch" == "master" ]; then
|
2019-03-09 20:03:06 +01:00
|
|
|
echo "Creating bootstrap cache for 7.x";
|
2019-03-09 17:48:46 +01:00
|
|
|
|
|
|
|
git clone https://github.com/elastic/kibana.git --branch 7.x --depth 1 /tmp/kibana-7.x
|
2019-03-09 20:03:06 +01:00
|
|
|
(cd /tmp/kibana-7.x && ./.ci/packer_cache.sh);
|
2019-03-09 17:48:46 +01:00
|
|
|
rm -rf /tmp/kibana-7.x;
|
|
|
|
fi
|