Skip to content

Commit a6ff134

Browse files
mistickibanamachine
andcommitted
fix(NA): creation of multiple processes on production by splitting no_transpilation when setting up node env (#115246)
* fix(NA): adds no_transpilation_dist to avoid preserve_symlinks on dist * chore(NA): setup node env correctly on functional tests * chore(NA): try to fix tests * chore(NA): correctly separate split * chore(NA): check ensure preserve symlinks need * chore(NA): investigate path resolve result * chore(NA): investigate path resolve result #2 * chore(NA): comment out preserve symlinks * chore(NA): apply fs.realpathSync into the calculated REPO_ROOT paths on babel_register_for_test_plugins * chore(NA): removes debug code * chore(NA): move array definition * chore(NA): correctly import fs * chore(NA): add debug code * chore(NA): some more debug statements * chore(NA): remove ensure symlinks * chore(NA): trying to solve double symlinking * chore(NA): test mappings * chore(NA): process path * chore(NA): test a second map * chore(NA): using a different mappings * chore(NA): more debug cases * chore(NA): more debug logic * chore(NA): more debug cases * chore(NA): more debug cases * chore(NA): more debug cases * chore(NA): try to add realpathSync into require * chore(NA): try to add realpathSync into require * fix(NA): jenkins and buildkite run * chore(NA): add debug logs * chore(NA): correct path * chore(NA): correct path * chore(NA): add more test maps * chore(NA): add more test maps * chore(NA): add some more test maps experiments * chore(NA): try to remove another test map dep * chore(NA): try to remove another test map dep * chore(NA): try to remove another test map dep * chore(NA): try to remove another test map dep * chore(NA): try to remove another test map dep * chore(NA): try to remove another test map dep * chore(NA): try to remove another test map dep * chore(NA): try to remove another test map dep * chore(NA): include all correct transpilations for each jenkins path * chore(NA): include all correct transpilations for each used asset path * chore(NA): include all correct transpilations for each used asset path * chore(NA): remove jenkins support Co-authored-by: Kibana Machine <[email protected]>
1 parent e0f7275 commit a6ff134

File tree

4 files changed

+35
-20
lines changed

4 files changed

+35
-20
lines changed

packages/kbn-test/src/functional_tests/lib/babel_register_for_test_plugins.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,30 @@
66
* Side Public License, v 1.
77
*/
88

9+
const Fs = require('fs');
910
const Path = require('path');
1011

11-
const { REPO_ROOT } = require('@kbn/dev-utils');
12+
const { REPO_ROOT: REPO_ROOT_FOLLOWING_SYMLINKS } = require('@kbn/dev-utils');
13+
const BASE_REPO_ROOT = Path.resolve(
14+
Fs.realpathSync(Path.resolve(REPO_ROOT_FOLLOWING_SYMLINKS, 'package.json')),
15+
'..'
16+
);
17+
18+
const transpileKbnPaths = [
19+
'test',
20+
'x-pack/test',
21+
'examples',
22+
'x-pack/examples',
23+
// TODO: should should probably remove this link back to the source
24+
'x-pack/plugins/task_manager/server/config.ts',
25+
'src/core/utils/default_app_categories.ts',
26+
].map((path) => Path.resolve(BASE_REPO_ROOT, path));
1227

1328
// modifies all future calls to require() to automatically
1429
// compile the required source with babel
1530
require('@babel/register')({
1631
ignore: [/[\/\\](node_modules|target|dist)[\/\\]/],
17-
only: [
18-
Path.resolve(REPO_ROOT, 'test'),
19-
Path.resolve(REPO_ROOT, 'x-pack/test'),
20-
Path.resolve(REPO_ROOT, 'examples'),
21-
Path.resolve(REPO_ROOT, 'x-pack/examples'),
22-
// TODO: should should probably remove this link back to the source
23-
Path.resolve(REPO_ROOT, 'x-pack/plugins/task_manager/server/config.ts'),
24-
Path.resolve(REPO_ROOT, 'src/core/utils/default_app_categories.ts'),
25-
],
32+
only: transpileKbnPaths,
2633
babelrc: false,
2734
presets: [require.resolve('@kbn/babel-preset/node_preset')],
2835
extensions: ['.js', '.ts', '.tsx'],

src/setup_node_env/dist.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
* Side Public License, v 1.
77
*/
88

9-
require('./no_transpilation');
9+
require('./no_transpilation_dist');
1010
require('./polyfill');

src/setup_node_env/no_transpilation.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,4 @@
77
*/
88

99
require('./ensure_node_preserve_symlinks');
10-
11-
// The following require statements MUST be executed before any others - BEGIN
12-
require('./exit_on_warning');
13-
require('./harden');
14-
// The following require statements MUST be executed before any others - END
15-
16-
require('symbol-observable');
17-
require('source-map-support/register');
18-
require('./node_version_validator');
10+
require('./no_transpilation_dist');
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
5+
* in compliance with, at your election, the Elastic License 2.0 or the Server
6+
* Side Public License, v 1.
7+
*/
8+
9+
// The following require statements MUST be executed before any others - BEGIN
10+
require('./exit_on_warning');
11+
require('./harden');
12+
// The following require statements MUST be executed before any others - END
13+
14+
require('symbol-observable');
15+
require('source-map-support/register');
16+
require('./node_version_validator');

0 commit comments

Comments
 (0)