Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.15] [ci] Reuse .yarn-local-mirror (#198613) #198872

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .buildkite/scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ if [[ "${BOOTSTRAP_ALWAYS_FORCE_INSTALL:-}" ]]; then
BOOTSTRAP_PARAMS+=(--force-install)
fi

# Use the node_modules that is baked into the agent image, if it exists, as a cache
# Use the packages that are baked into the agent image, if they exist, as a cache
# But only for agents not mounting the workspace on a local ssd or in memory
# It actually ends up being slower to move all of the tiny files between the disks vs extracting archives from the yarn cache
if [[ -d ~/.kibana/node_modules && "$(pwd)" != *"/local-ssd/"* && "$(pwd)" != "/dev/shm"* ]]; then
echo "Using ~/.kibana/node_modules as a starting point"
mv ~/.kibana/node_modules ./
if [[ "$(pwd)" != *"/local-ssd/"* && "$(pwd)" != "/dev/shm"* ]]; then
if [[ -d ~/.kibana/node_modules ]]; then
echo "Using ~/.kibana/node_modules as a starting point"
mv ~/.kibana/node_modules ./
fi
if [[ -d ~/.kibana/.yarn-local-mirror ]]; then
echo "Using ~/.kibana/.yarn-local-mirror as a starting point"
mv ~/.kibana/.yarn-local-mirror ./
fi
fi

if ! yarn kbn bootstrap "${BOOTSTRAP_PARAMS[@]}"; then
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/scripts/common/setup_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ NODE_VERSION="$(cat "$KIBANA_DIR/.node-version")"
export NODE_VERSION
export NODE_DIR="$CACHE_DIR/node/$NODE_VERSION"
export NODE_BIN_DIR="$NODE_DIR/bin"
export YARN_OFFLINE_CACHE="$CACHE_DIR/yarn-offline-cache"

## Install node for whatever the current os/arch are
hostArch="$(command uname -m)"
Expand Down Expand Up @@ -68,8 +67,6 @@ if [[ ! $(which yarn) || $(yarn --version) != "$YARN_VERSION" ]]; then
npm_install_global yarn "^$YARN_VERSION"
fi

yarn config set yarn-offline-mirror "$YARN_OFFLINE_CACHE"

YARN_GLOBAL_BIN=$(yarn global bin)
export YARN_GLOBAL_BIN
export PATH="$PATH:$YARN_GLOBAL_BIN"