[8.19] add es-cache to cleaned folders (#223373) (#223510)

# Backport

This will backport the following commits from `main` to `8.19`:
- [add es-cache to cleaned folders
(#223373)](https://github.com/elastic/kibana/pull/223373)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Alex
Szabo","email":"alex.szabo@elastic.co"},"sourceCommit":{"committedDate":"2025-06-12T08:58:05Z","message":"add
es-cache to cleaned folders (#223373)\n\n## Summary\nCurrently, `yarn
kbn clean` nor `yarn kbn reset` won't remove cached ES\nsnapshot builds.
This might cause issues for developers when switching\nbetween branches
with major changes.
(see:\nhttps://elastic.slack.com/archives/C5UDAFZQU/p1749628993034289)\n\nThis
PR adds a softer and a harder clean to `clean` and
`reset`\nrespectively.","sha":"20764b6914e6775c4b6fb0db75361841eb9f41f4","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Operations","release_note:skip","skip-ci","backport:all-open","v9.1.0"],"title":"add
es-cache to cleaned
folders","number":223373,"url":"https://github.com/elastic/kibana/pull/223373","mergeCommit":{"message":"add
es-cache to cleaned folders (#223373)\n\n## Summary\nCurrently, `yarn
kbn clean` nor `yarn kbn reset` won't remove cached ES\nsnapshot builds.
This might cause issues for developers when switching\nbetween branches
with major changes.
(see:\nhttps://elastic.slack.com/archives/C5UDAFZQU/p1749628993034289)\n\nThis
PR adds a softer and a harder clean to `clean` and
`reset`\nrespectively.","sha":"20764b6914e6775c4b6fb0db75361841eb9f41f4"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/223373","number":223373,"mergeCommit":{"message":"add
es-cache to cleaned folders (#223373)\n\n## Summary\nCurrently, `yarn
kbn clean` nor `yarn kbn reset` won't remove cached ES\nsnapshot builds.
This might cause issues for developers when switching\nbetween branches
with major changes.
(see:\nhttps://elastic.slack.com/archives/C5UDAFZQU/p1749628993034289)\n\nThis
PR adds a softer and a harder clean to `clean` and
`reset`\nrespectively.","sha":"20764b6914e6775c4b6fb0db75361841eb9f41f4"}}]}]
BACKPORT-->

Co-authored-by: Alex Szabo <alex.szabo@elastic.co>
This commit is contained in:
Kibana Machine 2025-06-12 12:43:42 +02:00 committed by GitHub
parent 1bd23b8db0
commit c6934a545d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

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

View file

@ -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)),
]);