kibana/.ci/packer_cache_for_branch.sh
Tyler Smalley afe785b43a
[build] Creates Linux aarch64 archive (#69165)
- Updates Linux Chromium builds to accept architecture argument (defaults to x64) for arm64 support.
  - Example: `python ~/chromium/build_chromium/build.py 312d84c8ce62810976feda0d3457108a6dfff9e6 arm64`
- Updates all Chromium builds to include architecture in filename. 
  - `chromium-312d84c-linux_arm64.zip` _(new)_
  - `chromium-312d84c-linux.zip` > `chromium-312d84c-linux_x64.zip`
- Moves Chromium install from data directory to `x-pack/plugins/reporting/chromium`
- Moves Chromium download cache from `x-pack/plugins/reporting/.chromium` to `.chromium`
- Installs Chromium during build (closes #53664)
- Updates build to be architecture aware (x64 and aarch64)
- Removed Chromium debug logs, they were not helpful and can not be written inside the Kibana root. If we were to keep them, we would need to write to `logging.dist`.

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2020-07-09 19:42:48 -07:00

62 lines
2.1 KiB
Bash
Executable file

#!/usr/bin/env bash
set -e
branch="$1"
checkoutDir="$(pwd)"
if [[ "$branch" != "master" ]]; then
checkoutDir="/tmp/kibana-$branch"
git clone https://github.com/elastic/kibana.git --branch "$branch" --depth 1 "$checkoutDir"
cd "$checkoutDir"
fi
source src/dev/ci_setup/setup.sh;
# download es snapshots
node scripts/es snapshot --download-only;
node scripts/es snapshot --license=oss --download-only;
# download reporting browsers
(cd "x-pack" && yarn gulp prepare);
# cache the chromedriver archive
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
mkdir -p .chromedriver
curl "https://chromedriver.storage.googleapis.com/$chromedriverDistVersion/chromedriver_linux64.zip" > .chromedriver/chromedriver.zip
echo "$chromedriverPkgVersion" > .chromedriver/pkgVersion
# 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
echo "Creating bootstrap_cache archive"
# archive cacheable directories
mkdir -p "$HOME/.kibana/bootstrap_cache"
tar -cf "$HOME/.kibana/bootstrap_cache/$branch.tar" \
.chromium \
.es \
.chromedriver \
.geckodriver;
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" "%"
echo "created $HOME/.kibana/bootstrap_cache/$branch.tar"
if [[ "$branch" != "master" ]]; then
rm --preserve-root -rf "$checkoutDir"
fi