Skip to content

Commit dc659a3

Browse files
[9.1] [CI] Disable moon cache for build (#238404) (#238424)
# Backport This will backport the following commits from `main` to `9.1`: - [[CI] Disable moon cache for build (#238404)](#238404) <!--- 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-10-10T11:15:38Z","message":"[CI] Disable moon cache for build (#238404)\n\n## Summary\nKibana's build seems to be breaking on a `yarn` command, it's not quite\nclear how/why, but this attempts to disable cache for that step, to get\nit working.","sha":"f9749b59a1e4dc1464e8b5176522aa61bbaa0d70","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:all-open","v9.3.0"],"title":"[CI] Disable moon cache for build","number":238404,"url":"https://github.com/elastic/kibana/pull/238404","mergeCommit":{"message":"[CI] Disable moon cache for build (#238404)\n\n## Summary\nKibana's build seems to be breaking on a `yarn` command, it's not quite\nclear how/why, but this attempts to disable cache for that step, to get\nit working.","sha":"f9749b59a1e4dc1464e8b5176522aa61bbaa0d70"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/238404","number":238404,"mergeCommit":{"message":"[CI] Disable moon cache for build (#238404)\n\n## Summary\nKibana's build seems to be breaking on a `yarn` command, it's not quite\nclear how/why, but this attempts to disable cache for that step, to get\nit working.","sha":"f9749b59a1e4dc1464e8b5176522aa61bbaa0d70"}}]}] BACKPORT--> Co-authored-by: Alex Szabo <alex.szabo@elastic.co>
1 parent eb1ac84 commit dc659a3

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

kbn_pm/src/commands/build_shared_packages.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import { run } from '../lib/spawn.mjs';
1111

12-
/** @type {import("../lib/command").Command} */
12+
/** @type {import('../lib/command').Command} */
1313
export const command = {
1414
name: 'build-shared',
1515
intro: 'Builds shared packages with webpack',
@@ -35,6 +35,10 @@ export const command = {
3535
[':build-webpack'].concat(!cache ? ['-u'] : []).concat(dist ? ['--', '--dist'] : []),
3636
{
3737
pipe: !quiet,
38+
env: {
39+
...process.env,
40+
...(!cache ? { MOON_CACHE: 'off' } : {}),
41+
},
3842
}
3943
);
4044

src/dev/build/tasks/build_packages_task.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export const BuildPackages: Task = {
109109
await buildWebpackBundles({
110110
quiet: false,
111111
dist: true,
112+
noCache: true,
112113
});
113114

114115
const transformConfig: TransformConfig = {
@@ -307,8 +308,20 @@ export const BuildPackages: Task = {
307308
},
308309
};
309310

310-
export async function buildWebpackBundles({ quiet, dist }: { quiet: boolean; dist: boolean }) {
311-
const options = [quiet ? ['--quiet'] : [], dist ? ['--dist'] : []].flat();
311+
export async function buildWebpackBundles({
312+
quiet,
313+
dist,
314+
noCache,
315+
}: {
316+
quiet: boolean;
317+
dist: boolean;
318+
noCache?: boolean;
319+
}) {
320+
const options = [
321+
quiet ? ['--quiet'] : [],
322+
dist ? ['--dist'] : [],
323+
noCache ? ['--no-cache'] : [],
324+
].flat();
312325
const stdio: StdioOption[] = quiet
313326
? ['ignore', 'pipe', 'pipe']
314327
: ['inherit', 'inherit', 'inherit'];

0 commit comments

Comments
 (0)