Skip to content

Commit

Permalink
[ci] Cache chromedriver (elastic#196614)
Browse files Browse the repository at this point in the history
Chromedriver is currently downloaded at runtime on each agent. We know
the expected version of Chrome at image build time, and can re-use the
matching driver already installed instead.

This sets `XDG_CACHE_HOME` to `$HOME/.cache` to persist the chromedriver
installation. Details on the specification can be found at
https://specifications.freedesktop.org/basedir-spec/latest/. Other
packages, including cypress, playwright, bazelisk and yarn also respect
this environment variable, but are already falling back to the
`$HOME/.cache` directory.

This also removes `CHROMEDRIVER_FORCE_DOWNLOAD`, which I believe is an
artifact of legacy code:
https://github.com/elastic/kibana/blob/6.7/.ci/packer_cache.sh#L17-L26.
At one point node_modules was initially loaded from an archive to speed
up bootstrap times. The intent was to redownload chromedriver because
the Chrome version on the agent image was upgraded independently of the
bootstrap cache, potentially causing version mismatches. The impact of
re-downloading was also less significant, as there was less
parallelization in favor of large machines running parallel jobs.

(cherry picked from commit b89941f)
  • Loading branch information
jbudz committed Oct 22, 2024
1 parent 747a713 commit 64c4758
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .buildkite/scripts/common/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ KIBANA_DIR=$(pwd)
export KIBANA_DIR
export XPACK_DIR="$KIBANA_DIR/x-pack"

export XDG_CACHE_HOME="$HOME/.cache"
export CACHE_DIR="$HOME/.kibana"
export ES_CACHE_DIR="$HOME/.es-snapshot-cache"
PARENT_DIR="$(cd "$KIBANA_DIR/.."; pwd)"
Expand Down Expand Up @@ -94,7 +95,6 @@ export TEST_CORS_SERVER_PORT=6105
if [[ "$(which google-chrome-stable)" || "$(which google-chrome)" ]]; then
echo "Chrome detected, setting DETECT_CHROMEDRIVER_VERSION=true"
export DETECT_CHROMEDRIVER_VERSION=true
export CHROMEDRIVER_FORCE_DOWNLOAD=true
else
echo "Chrome not detected, installing default chromedriver binary for the package version"
fi
Expand Down

0 comments on commit 64c4758

Please sign in to comment.