From 20764b6914e6775c4b6fb0db75361841eb9f41f4 Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Thu, 12 Jun 2025 10:58:05 +0200 Subject: [PATCH] add es-cache to cleaned folders (#223373) ## Summary Currently, `yarn kbn clean` nor `yarn kbn reset` won't remove cached ES snapshot builds. This might cause issues for developers when switching between branches with major changes. (see: https://elastic.slack.com/archives/C5UDAFZQU/p1749628993034289) This PR adds a softer and a harder clean to `clean` and `reset` respectively. --- kbn_pm/src/commands/clean_command.mjs | 7 ++++++- kbn_pm/src/commands/reset_command.mjs | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kbn_pm/src/commands/clean_command.mjs b/kbn_pm/src/commands/clean_command.mjs index 0c0c3cae311d..24efdc63854b 100644 --- a/kbn_pm/src/commands/clean_command.mjs +++ b/kbn_pm/src/commands/clean_command.mjs @@ -11,6 +11,8 @@ import { dedent } from '../lib/indent.mjs'; import { cleanPaths } from '../lib/clean.mjs'; import * as Bazel from '../lib/bazel.mjs'; import { findPluginCleanPaths } from '../lib/find_clean_paths.mjs'; +import Path from 'path'; +import { REPO_ROOT } from '../lib/paths.mjs'; /** @type {import('../lib/command').Command} */ export const command = { @@ -33,7 +35,10 @@ export const command = { you might need to run 'yarn kbn reset'. `); - await cleanPaths(log, await findPluginCleanPaths(log)); + await cleanPaths(log, [ + ...(await findPluginCleanPaths(log)), + Path.resolve(REPO_ROOT, '.es', 'cache'), + ]); // Runs Bazel soft clean if (await Bazel.isInstalled(log)) { diff --git a/kbn_pm/src/commands/reset_command.mjs b/kbn_pm/src/commands/reset_command.mjs index 1a54d7e22dde..568cb99fb98e 100644 --- a/kbn_pm/src/commands/reset_command.mjs +++ b/kbn_pm/src/commands/reset_command.mjs @@ -38,6 +38,7 @@ export const command = { Path.resolve(REPO_ROOT, 'node_modules'), Path.resolve(REPO_ROOT, 'x-pack/node_modules'), Path.resolve(REPO_ROOT, 'data'), + Path.resolve(REPO_ROOT, '.es'), ...readCleanPatterns(REPO_ROOT), ...(await findPluginCleanPaths(log)), ]);