[8.x] [ci] Use es snapshot cache for jest integration tests (#196695) (#196875)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ci] Use es snapshot cache for jest integration tests
(#196695)](https://github.com/elastic/kibana/pull/196695)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Jon","email":"jon@elastic.co"},"sourceCommit":{"committedDate":"2024-10-18T13:00:57Z","message":"[ci]
Use es snapshot cache for jest integration tests
(#196695)","sha":"8bf08bfee6fe15d13054bf8de7f6bc8476b9de73","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Operations","release_note:skip","v9.0.0","backport:all-open"],"title":"[ci]
Use es snapshot cache for jest integration
tests","number":196695,"url":"https://github.com/elastic/kibana/pull/196695","mergeCommit":{"message":"[ci]
Use es snapshot cache for jest integration tests
(#196695)","sha":"8bf08bfee6fe15d13054bf8de7f6bc8476b9de73"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196695","number":196695,"mergeCommit":{"message":"[ci]
Use es snapshot cache for jest integration tests
(#196695)","sha":"8bf08bfee6fe15d13054bf8de7f6bc8476b9de73"}}]}]
BACKPORT-->

Co-authored-by: Jon <jon@elastic.co>
This commit is contained in:
Kibana Machine 2024-10-19 03:47:28 +11:00 committed by GitHub
parent ef9f373008
commit 559484c16f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 11 deletions

View file

@ -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

View file

@ -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

View file

@ -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