Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
Use kibana-ci-proxy-cache for chrome and gecko drivers (elastic#41581)
Browse files Browse the repository at this point in the history
* [ci] download chromedriver and geckodriver through a caching proxy

* restore chromedriver and geckodriver caching in bootstrap cache
  • Loading branch information
Spencer committed Jul 20, 2019
1 parent aa3f00e commit ba00ca6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
13 changes: 12 additions & 1 deletion .ci/packer_cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand All @@ -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"

Expand Down
26 changes: 3 additions & 23 deletions src/dev/ci_setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ba00ca6

Please sign in to comment.