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

Upgrade Node.js to version 12 #61587

Merged
merged 33 commits into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1090098
Bump @types/webpack-env to v1.15.3 for compatibility with Node.js 12
watson Oct 29, 2020
cf4f127
Improve ignore-logic in exit-on-warning guard
watson Apr 2, 2020
4f13293
Bump Node.js version from 10.19.0 to 12.19.0
watson Mar 27, 2020
7eada67
Bump @types/node version from 10.17.17 to 12.19.3
watson Mar 27, 2020
ff14353
Fix TypeScript errors related to new @types/node version
watson Mar 27, 2020
f8bcaa7
Ignore deprecation warning in 'superagent' package
watson Apr 2, 2020
34737a9
Never manually emit errors on streams
watson Nov 9, 2020
436bdc2
Add outcome of yarn kbn run build -i @kbn/pm
watson Mar 27, 2020
a9351f7
Add outcome of node scripts/check_published_api_changes.js --accept
watson Mar 27, 2020
6ac8598
[test] Fix tests
watson Mar 27, 2020
2b7d5aa
[test] Avoid 'no cipher match' in http_server test
watson Apr 6, 2020
6875919
[test] Fix sense editor tests in Node.js 12
watson Apr 6, 2020
c3a4d07
[test] V8 array sorting algorithm changed in Node.js 12
watson Oct 29, 2020
3177892
[test] Fix more tests
watson Oct 29, 2020
7cd23b0
[test] Fix weird Node.js 12 bug
watson Oct 30, 2020
d170410
[test] Fix CSV reporting tests
watson Oct 31, 2020
cf8c135
[test] fix timing related test failures
watson Nov 9, 2020
4bc1da5
[test] skip possibly broken test
watson Nov 9, 2020
4e2f8ed
Merge branch 'master' into bump-node
watson Nov 10, 2020
eb5f413
Address review comments
watson Nov 10, 2020
c33e36d
[docs] list new ciphers in documentation
watson Nov 10, 2020
b40e498
Merge branch 'master' into bump-node
watson Nov 10, 2020
50a25c2
[docs] update link to correct version of OpenSSL
watson Nov 10, 2020
d9975ab
Merge branch 'master' into bump-node
watson Nov 11, 2020
9d9a1b8
Un-skip test fixed in master
watson Nov 11, 2020
5ffbd5b
Finalize support for TLSv1.3
watson Nov 11, 2020
a28d9dc
[test] Fix snapshots related to the TLSv1.3 change
watson Nov 12, 2020
5a30a73
Merge branch 'master' into bump-node
watson Nov 12, 2020
f2f52ee
Merge branch 'master' into bump-node
watson Nov 12, 2020
5d8b622
Merge branch 'master' into bump-node
watson Nov 12, 2020
df9041b
Merge branch 'master' into bump-node
watson Nov 12, 2020
374d6f4
Bump @types/node to v12.19.4 and ensure it's pinned
watson Nov 12, 2020
f5d6572
Fix TypeScript errors not showing up in CI
watson Nov 12, 2020
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
2 changes: 1 addition & 1 deletion .ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NOTE: This Dockerfile is ONLY used to run certain tasks in CI. It is not used to run Kibana or as a distributable.
# If you're looking for the Kibana Docker image distributable, please see: src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.ts

ARG NODE_VERSION=10.22.1
ARG NODE_VERSION=12.19.0

FROM node:${NODE_VERSION} AS base

Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.22.1
12.19.0
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.22.1
12.19.0
6 changes: 3 additions & 3 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,8 @@ In addition to this setting, trusted certificates may be specified via <<server-

| `server.ssl.cipherSuites:`
| Details on the format, and the valid options, are available via the
https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT[OpenSSL cipher list format documentation].
*Default: `ECDHE-RSA-AES128-GCM-SHA256, ECDHE-ECDSA-AES128-GCM-SHA256, ECDHE-RSA-AES256-GCM-SHA384, ECDHE-ECDSA-AES256-GCM-SHA384, DHE-RSA-AES128-GCM-SHA256, ECDHE-RSA-AES128-SHA256, DHE-RSA-AES128-SHA256, ECDHE-RSA-AES256-SHA384, DHE-RSA-AES256-SHA384, ECDHE-RSA-AES256-SHA256, DHE-RSA-AES256-SHA256, HIGH,!aNULL, !eNULL, !EXPORT, !DES, !RC4, !MD5, !PSK, !SRP, !CAMELLIA`*.
https://www.openssl.org/docs/man1.1.1/man1/ciphers.html#CIPHER-LIST-FORMAT[OpenSSL cipher list format documentation].
*Default: `TLS_AES_256_GCM_SHA384 TLS_CHACHA20_POLY1305_SHA256 TLS_AES_128_GCM_SHA256 ECDHE-RSA-AES128-GCM-SHA256, ECDHE-ECDSA-AES128-GCM-SHA256, ECDHE-RSA-AES256-GCM-SHA384, ECDHE-ECDSA-AES256-GCM-SHA384, DHE-RSA-AES128-GCM-SHA256, ECDHE-RSA-AES128-SHA256, DHE-RSA-AES128-SHA256, ECDHE-RSA-AES256-SHA384, DHE-RSA-AES256-SHA384, ECDHE-RSA-AES256-SHA256, DHE-RSA-AES256-SHA256, HIGH,!aNULL, !eNULL, !EXPORT, !DES, !RC4, !MD5, !PSK, !SRP, !CAMELLIA`*.

| `server.ssl.clientAuthentication:`
| Controls the behavior in {kib} for requesting a certificate from client
Expand Down Expand Up @@ -571,7 +571,7 @@ all http requests to https over the port configured as <<server-port, `server.po

| `server.ssl.supportedProtocols:`
| An array of supported protocols with versions.
Valid protocols: `TLSv1`, `TLSv1.1`, `TLSv1.2`. *Default: TLSv1.1, TLSv1.2*
Valid protocols: `TLSv1`, `TLSv1.1`, `TLSv1.2`, `TLSv1.3`. *Default: TLSv1.1, TLSv1.2, TLSv1.3*

| [[settings-xsrf-whitelist]] `server.xsrf.whitelist:`
| It is not recommended to disable protections for
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"**/@types/hapi__boom": "^7.4.1",
"**/@types/hapi__hapi": "^18.2.6",
"**/@types/hapi__mimos": "4.1.0",
"**/@types/node": ">=10.17.17 <10.20.0",
"**/@types/node": "12.19.4",
"**/cross-fetch/node-fetch": "^2.6.1",
"**/deepmerge": "^4.2.2",
"**/fast-deep-equal": "^3.1.1",
Expand All @@ -97,7 +97,7 @@
"**/typescript": "4.0.2"
},
"engines": {
"node": "10.22.1",
"node": "12.19.0",
"yarn": "^1.21.1"
},
"dependencies": {
Expand Down Expand Up @@ -497,7 +497,7 @@
"@types/mustache": "^0.8.31",
"@types/ncp": "^2.0.1",
"@types/nock": "^10.0.3",
"@types/node": ">=10.17.17 <10.20.0",
"@types/node": "12.19.4",
"@types/node-fetch": "^2.5.7",
"@types/node-forge": "^0.9.5",
"@types/nodemailer": "^6.2.1",
Expand Down Expand Up @@ -560,7 +560,7 @@
"@types/vinyl-fs": "^2.4.11",
"@types/watchpack": "^1.1.5",
"@types/webpack": "^4.41.3",
"@types/webpack-env": "^1.15.2",
"@types/webpack-env": "^1.15.3",
"@types/webpack-merge": "^4.1.5",
"@types/write-pkg": "^3.1.0",
"@types/xml-crypto": "^1.4.1",
Expand Down
8 changes: 7 additions & 1 deletion packages/kbn-config-schema/src/types/stream_type.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ test('includes namespace in failure', () => {
describe('#defaultValue', () => {
test('returns default when undefined', () => {
const value = new Stream();
expect(schema.stream({ defaultValue: value }).validate(undefined)).toStrictEqual(value);
expect(schema.stream({ defaultValue: value }).validate(undefined)).toMatchInlineSnapshot(`
mshustov marked this conversation as resolved.
Show resolved Hide resolved
Stream {
"_events": Object {},
"_eventsCount": 0,
"_maxListeners": undefined,
}
`);
});

test('returns value when specified', () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/kbn-dev-utils/src/proc_runner/proc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ export function startProc(name: string, options: ProcOptions, log: ToolingLog) {
});

if (stdin) {
childProcess.stdin.end(stdin, 'utf8');
childProcess.stdin!.end(stdin, 'utf8'); // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdin will not be null
} else {
childProcess.stdin.end();
childProcess.stdin!.end(); // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdin will not be null
}

let stopCalled = false;
Expand Down Expand Up @@ -123,8 +123,8 @@ export function startProc(name: string, options: ProcOptions, log: ToolingLog) {
).pipe(share());

const lines$ = Rx.merge(
observeLines(childProcess.stdout),
observeLines(childProcess.stderr)
observeLines(childProcess.stdout!), // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null
observeLines(childProcess.stderr!) // TypeScript note: As long as the proc stdio[1] is 'pipe', then stderr will not be null
).pipe(
tap((line) => log.write(` ${chalk.gray('proc')} [${chalk.gray(name)}] ${line}`)),
share()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/kbn-es-archiver/src/actions/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
// are not listened for
const pipeline = (...streams: Readable[]) =>
streams.reduce((source, dest) =>
source.once('error', (error) => dest.emit('error', error)).pipe(dest as any)
source.once('error', (error) => dest.destroy(error)).pipe(dest as any)
);

export async function loadAction({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('concatStreamProviders() helper', () => {
() =>
new Readable({
read() {
this.emit('error', new Error('foo'));
this.destroy(new Error('foo'));
},
}),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function concatStreamProviders(

source
// proxy errors from the source to the destination
.once('error', (error) => destination.emit('error', error))
.once('error', (error) => destination.destroy(error))
// pipe the source to the destination but only proxy the
// end event if this is the last source
.pipe(destination, { end: isLast });
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-i18n/src/__snapshots__/loader.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ const expectFileMatchesSnapshotWithCompression = (filePath: string, snapshotLabe

// Verify the brotli variant matches
expect(
// @ts-expect-error @types/node is missing the brotli functions
Zlib.brotliDecompressSync(
Fs.readFileSync(Path.resolve(MOCK_REPO_DIR, `${filePath}.br`))
).toString()
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/src/optimizer/get_mtimes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import * as Rx from 'rxjs';
import { mergeMap, map, catchError } from 'rxjs/operators';
import { allValuesFrom } from '../common';

const stat$ = Rx.bindNodeCallback(Fs.stat);
const stat$ = Rx.bindNodeCallback<Fs.PathLike, Fs.Stats>(Fs.stat);

/**
* get mtimes of referenced paths concurrently, limit concurrency to 100
Expand Down
6 changes: 4 additions & 2 deletions packages/kbn-optimizer/src/optimizer/observe_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ export function observeWorker(
type: 'worker started',
bundles,
}),
observeStdio$(proc.stdout).pipe(
// TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null
observeStdio$(proc.stdout!).pipe(
map(
(line): WorkerStdio => ({
type: 'worker stdio',
Expand All @@ -173,7 +174,8 @@ export function observeWorker(
})
)
),
observeStdio$(proc.stderr).pipe(
// TypeScript note: As long as the proc stdio[2] is 'pipe', then stderr will not be null
observeStdio$(proc.stderr!).pipe(
map(
(line): WorkerStdio => ({
type: 'worker stdio',
Expand Down
9 changes: 6 additions & 3 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32273,8 +32273,10 @@ function spawnStreaming(command, args, opts, {
mergeMultiline: true,
tag: color.bold(prefix)
});
spawned.stdout.pipe(prefixedStdout).pipe(streamToLog(debug));
spawned.stderr.pipe(prefixedStderr).pipe(streamToLog(debug));
spawned.stdout.pipe(prefixedStdout).pipe(streamToLog(debug)); // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null

spawned.stderr.pipe(prefixedStderr).pipe(streamToLog(debug)); // TypeScript note: As long as the proc stdio[2] is 'pipe', then stderr will not be null

return spawned;
}

Expand Down Expand Up @@ -51377,7 +51379,8 @@ const WatchCommand = {
await Object(_utils_parallelize__WEBPACK_IMPORTED_MODULE_2__["parallelizeBatches"])(batchedProjects, async pkg => {
const completionHint = await Object(_utils_watch__WEBPACK_IMPORTED_MODULE_4__["waitUntilWatchIsReady"])(pkg.runScriptStreaming(watchScriptName, {
debug: false
}).stdout);
}).stdout // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null
);
_utils_log__WEBPACK_IMPORTED_MODULE_1__["log"].success(`[${pkg.name}] Initial build completed (${completionHint}).`);
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-pm/src/commands/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const WatchCommand: ICommand = {
const completionHint = await waitUntilWatchIsReady(
pkg.runScriptStreaming(watchScriptName, {
debug: false,
}).stdout
}).stdout! // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null
);

log.success(`[${pkg.name}] Initial build completed (${completionHint}).`);
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-pm/src/utils/child_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export function spawnStreaming(
const prefixedStdout = logTransformer({ tag: color.bold(prefix) });
const prefixedStderr = logTransformer({ mergeMultiline: true, tag: color.bold(prefix) });

spawned.stdout.pipe(prefixedStdout).pipe(streamToLog(debug));
spawned.stderr.pipe(prefixedStderr).pipe(streamToLog(debug));
spawned.stdout!.pipe(prefixedStdout).pipe(streamToLog(debug)); // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null
spawned.stderr!.pipe(prefixedStderr).pipe(streamToLog(debug)); // TypeScript note: As long as the proc stdio[2] is 'pipe', then stderr will not be null

return spawned;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export function observeContainerLogs(name: string, containerId: string, log: Too
const logLine$ = new Rx.Subject<string>();

Rx.merge(
observeLines(logsProc.stdout).pipe(tap((line) => log.info(`[docker:${name}] ${line}`))),
observeLines(logsProc.stderr).pipe(tap((line) => log.error(`[docker:${name}] ${line}`)))
observeLines(logsProc.stdout!).pipe(tap((line) => log.info(`[docker:${name}] ${line}`))), // TypeScript note: As long as the proc stdio[1] is 'pipe', then stdout will not be null
observeLines(logsProc.stderr!).pipe(tap((line) => log.error(`[docker:${name}] ${line}`))) // TypeScript note: As long as the proc stdio[2] is 'pipe', then stderr will not be null
).subscribe(logLine$);

return logLine$.asObservable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ describe('with randomness', () => {
);

await phase.trigger();

// `phase.trigger()` uses `Math.random` to sort the internal array of
// handlers. But since the sorting algorithm used internally in
// `Array.prototype.sort` is not spec'ed, it can change between Node.js
// versions, and as a result the expected output below might not match if
// you up/downgrade Node.js.
expect(order).toMatchInlineSnapshot(`
Array [
"one",
"three",
"two",
"one",
]
`);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-test/src/kbn/kbn_test_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export const kbnTestConfig = new (class KbnTestConfig {
const testKibanaUrl = url.parse(process.env.TEST_KIBANA_URL);
return {
protocol: testKibanaUrl.protocol?.slice(0, -1),
hostname: testKibanaUrl.hostname,
hostname: testKibanaUrl.hostname === null ? undefined : testKibanaUrl.hostname,
port: testKibanaUrl.port ? parseInt(testKibanaUrl.port, 10) : undefined,
auth: testKibanaUrl.auth,
auth: testKibanaUrl.auth === null ? undefined : testKibanaUrl.auth,
username: testKibanaUrl.auth?.split(':')[0],
password: testKibanaUrl.auth?.split(':')[1],
};
Expand Down
30 changes: 24 additions & 6 deletions src/cli/repl/__snapshots__/repl.test.js.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions src/cli/serve/integration_tests/reload_logging_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,15 @@ describe('Server logging configuration', function () {
'--verbose',
]);

const message$ = Rx.fromEvent(child.stdout, 'data').pipe(
// TypeScript note: As long as the child stdio[1] is 'pipe', then stdout will not be null
const message$ = Rx.fromEvent(child.stdout!, 'data').pipe(
map((messages) => String(messages).split('\n').filter(Boolean))
);

await message$
.pipe(
// We know the sighup handler will be registered before this message logged
filter((messages) => messages.some((m) => m.includes('setting up root'))),
filter((messages: string[]) => messages.some((m) => m.includes('setting up root'))),
take(1)
)
.toPromise();
Expand Down Expand Up @@ -189,14 +190,15 @@ describe('Server logging configuration', function () {

child = Child.spawn(process.execPath, [kibanaPath, '--oss', '--config', configFilePath]);

const message$ = Rx.fromEvent(child.stdout, 'data').pipe(
// TypeScript note: As long as the child stdio[1] is 'pipe', then stdout will not be null
const message$ = Rx.fromEvent(child.stdout!, 'data').pipe(
map((messages) => String(messages).split('\n').filter(Boolean))
);

await message$
.pipe(
// We know the sighup handler will be registered before this message logged
filter((messages) => messages.some((m) => m.includes('setting up root'))),
filter((messages: string[]) => messages.some((m) => m.includes('setting up root'))),
take(1)
)
.toPromise();
Expand Down
19 changes: 13 additions & 6 deletions src/core/public/http/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,19 @@ export interface HttpRequestInit {

/** @public */
export interface HttpFetchQuery {
[key: string]:
| string
| number
| boolean
| undefined
| Array<string | number | boolean | undefined>;
/**
* TypeScript note: Technically we should use this interface instead, but @types/node uses the below stricter
* definition, so to avoid TypeScript errors, we'll restrict our version.
*
* [key: string]:
* | string
* | number
* | boolean
* | Array<string | number | boolean>
* | undefined
* | null;
*/
[key: string]: string | number | boolean | string[] | number[] | boolean[] | undefined | null;
watson marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,7 @@ export interface HttpFetchOptionsWithPath extends HttpFetchOptions {

// @public (undocumented)
export interface HttpFetchQuery {
// (undocumented)
[key: string]: string | number | boolean | undefined | Array<string | number | boolean | undefined>;
[key: string]: string | number | boolean | string[] | number[] | boolean[] | undefined | null;
}

// @public
Expand Down
Loading