From ba00ca62da07606697ba5fde47a4bc277742faae Mon Sep 17 00:00:00 2001 From: Spencer Date: Fri, 19 Jul 2019 21:24:48 -0700 Subject: [PATCH] Use kibana-ci-proxy-cache for chrome and gecko drivers (#41581) * [ci] download chromedriver and geckodriver through a caching proxy * restore chromedriver and geckodriver caching in bootstrap cache --- .ci/packer_cache.sh | 13 ++++++++++++- src/dev/ci_setup/setup.sh | 26 +++----------------------- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/.ci/packer_cache.sh b/.ci/packer_cache.sh index 3dc2b1da658cb..b697f22c009d1 100755 --- a/.ci/packer_cache.sh +++ b/.ci/packer_cache.sh @@ -25,6 +25,16 @@ 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 + # archive cacheable directories mkdir -p "$HOME/.kibana/bootstrap_cache" tar -cf "$HOME/.kibana/bootstrap_cache/$branch.tar" \ @@ -35,7 +45,8 @@ tar -cf "$HOME/.kibana/bootstrap_cache/$branch.tar" \ x-pack/legacy/plugins/reporting/.chromium \ test/plugin_functional/plugins/*/node_modules \ .es \ - .chromedriver; + .chromedriver \ + .geckodriver; echo "created $HOME/.kibana/bootstrap_cache/$branch.tar" diff --git a/src/dev/ci_setup/setup.sh b/src/dev/ci_setup/setup.sh index ce31c3cc1caa5..e5bfe27d7bfdb 100755 --- a/src/dev/ci_setup/setup.sh +++ b/src/dev/ci_setup/setup.sh @@ -113,29 +113,9 @@ yarn config set yarn-offline-mirror "$cacheDir/yarn-offline-cache" yarnGlobalDir="$(yarn global bin)" export PATH="$PATH:$yarnGlobalDir" -### -### use the chromedriver cache if it exists -### -if [ -d "$dir/.chromedriver" ]; then - branchPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.chromedriver)")" - cachedPkgVersion="$(cat "$dir/.chromedriver/pkgVersion")" - if [ "$cachedPkgVersion" == "$branchPkgVersion" ]; then - export CHROMEDRIVER_FILEPATH="$dir/.chromedriver/chromedriver.zip" - export CHROMEDRIVER_SKIP_DOWNLOAD=true - echo " -- Using chromedriver cache at $CHROMEDRIVER_FILEPATH" - else - echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - echo " SKIPPING CHROMEDRIVER CACHE: cached($cachedPkgVersion) branch($branchPkgVersion)" - echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - fi -else - echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - echo " CHROMEDRIVER CACHE NOT FOUND" - echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" -fi - -# use a proxy to fetch geckodriver asset -export GECKODRIVER_CDNURL="https://us-central1-elastic-kibana-184716.cloudfunctions.net/geckodriver_cache" +# use a proxy to fetch chromedriver/geckodriver asset +export GECKODRIVER_CDNURL="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache" +export CHROMEDRIVER_CDNURL="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache" ### ### install dependencies