From 8bf08bfee6fe15d13054bf8de7f6bc8476b9de73 Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 18 Oct 2024 08:00:57 -0500 Subject: [PATCH] [ci] Use es snapshot cache for jest integration tests (#196695) --- .buildkite/scripts/copy_es_snapshot_cache.sh | 14 ++++++++++++++ .buildkite/scripts/steps/functional/common.sh | 12 +----------- .buildkite/scripts/steps/test/jest_integration.sh | 1 + 3 files changed, 16 insertions(+), 11 deletions(-) create mode 100755 .buildkite/scripts/copy_es_snapshot_cache.sh diff --git a/.buildkite/scripts/copy_es_snapshot_cache.sh b/.buildkite/scripts/copy_es_snapshot_cache.sh new file mode 100755 index 000000000000..d2b325168482 --- /dev/null +++ b/.buildkite/scripts/copy_es_snapshot_cache.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# If cached snapshots are baked into the agent, copy them into our workspace first +# We are doing this rather than simply changing the ES base path because many workers +# run with the workspace mounted in memory or on a local ssd +cacheDir="$ES_CACHE_DIR/cache" +if [[ -d "$cacheDir" ]]; then + mkdir -p .es/cache + echo "--- Copying ES snapshot cache" + echo "Copying cached snapshots from $cacheDir to .es/cache" + cp -R "$cacheDir"/* .es/cache/ +fi diff --git a/.buildkite/scripts/steps/functional/common.sh b/.buildkite/scripts/steps/functional/common.sh index edb618f69209..5a58594404b1 100755 --- a/.buildkite/scripts/steps/functional/common.sh +++ b/.buildkite/scripts/steps/functional/common.sh @@ -8,17 +8,7 @@ source .buildkite/scripts/common/util.sh .buildkite/scripts/bootstrap.sh .buildkite/scripts/download_build_artifacts.sh - -# If cached snapshots are baked into the agent, copy them into our workspace first -# We are doing this rather than simply changing the ES base path because many workers -# run with the workspace mounted in memory or on a local ssd -cacheDir="$ES_CACHE_DIR/cache" -if [[ -d "$cacheDir" ]]; then - mkdir -p .es/cache - echo "--- Copying ES snapshot cache" - echo "Copying cached snapshots from $cacheDir to .es/cache" - cp -R "$cacheDir"/* .es/cache/ -fi +.buildkite/scripts/copy_es_snapshot_cache.sh is_test_execution_step diff --git a/.buildkite/scripts/steps/test/jest_integration.sh b/.buildkite/scripts/steps/test/jest_integration.sh index fd7b9a1d6ad5..83f9509f362c 100755 --- a/.buildkite/scripts/steps/test/jest_integration.sh +++ b/.buildkite/scripts/steps/test/jest_integration.sh @@ -7,6 +7,7 @@ source .buildkite/scripts/common/util.sh is_test_execution_step .buildkite/scripts/bootstrap.sh +.buildkite/scripts/copy_es_snapshot_cache.sh echo '--- Jest Integration Tests' .buildkite/scripts/steps/test/jest_parallel.sh jest.integration.config.js