Skip to content

Commit 4f464f7

Browse files
delannikibanamachinemisticwatson
committed
[Ops] Bump Node.js to version 18 (elastic#160289)
## Summary Bumps node.js to 18.17.0 (replacement for PR elastic#144012 which was later reverted) As a result, these categorical additions were needed: - `node` evocations will need the `--openssl-legacy-provider` flag, wherever it would use certain crypto functionalities - tests required updating of the expected HTTPS Agent call arguments, `noDelay` seems to be a default - `window.[NAME]` fields cannot be written directly - some stricter typechecks This is using our in-house built node.js 18 versions through the URLs the proxy-cache. (built with elastic/kibana-custom-nodejs-builds#4) These urls are served from a bucket, where the RHEL7/Centos7 compatible node distributables are. (see: elastic/kibana-ci-proxy-cache#7) Further todos: - [x] check docs wording and consistency - [ ] update the dependency report - [x] explain custom builds in documentation - [x] node_sass prebuilts --------- Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Tiago Costa <[email protected]> Co-authored-by: Thomas Watson <[email protected]>
1 parent 144cbab commit 4f464f7

File tree

30 files changed

+134
-86
lines changed

30 files changed

+134
-86
lines changed

.ci/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# NOTE: This Dockerfile is ONLY used to run certain tasks in CI. It is not used to run Kibana or as a distributable.
22
# If you're looking for the Kibana Docker image distributable, please see: src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.ts
33

4-
ARG NODE_VERSION=16.20.1
4+
ARG NODE_VERSION=18.17.0
55

66
FROM node:${NODE_VERSION} AS base
77

.node-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.20.1
1+
18.17.0

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.20.1
1+
18.17.0

WORKSPACE.bazel

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ check_rules_nodejs_version(minimum_version_string = "3.8.0")
2727
# we can update that rule.
2828
node_repositories(
2929
node_repositories = {
30-
"16.20.1-darwin_amd64": ("node-v16.20.1-darwin-x64.tar.gz", "node-v16.20.1-darwin-x64", "d1f9c2a7c3a0fe09860f701af5fb8ff9ac72d72faa7ebabfeb5794503e79f955"),
31-
"16.20.1-darwin_arm64": ("node-v16.20.1-darwin-arm64.tar.gz", "node-v16.20.1-darwin-arm64", "5f6b31c5a75567d382ba67220f3d7a2d9bb0c03d8af9307cd35a9cb32a6fde9d"),
32-
"16.20.1-linux_arm64": ("node-v16.20.1-linux-arm64.tar.xz", "node-v16.20.1-linux-arm64", "7fce19f3d1c2952599a0b47f9f5d8f497265ad577f37f256a8c6a03be6353234"),
33-
"16.20.1-linux_amd64": ("node-v16.20.1-linux-x64.tar.xz", "node-v16.20.1-linux-x64", "b6c60e1e106ad7d8881e83945a5208c1b1d1b63e6901c04b9dafa607aff3a154"),
34-
"16.20.1-windows_amd64": ("node-v16.20.1-win-x64.zip", "node-v16.20.1-win-x64", "2a7fde996c57a969f0498742f99385a520eb14aac864e0eff9c32e3f3633ff0a"),
30+
"18.17.0-darwin_amd64": ("node-v18.17.0-darwin-x64.tar.gz", "node-v18.17.0-darwin-x64", "2f381442381f7fbde2ca644c3275bec9c9c2a8d361f467b40e39428acdd6ccff"),
31+
"18.17.0-darwin_arm64": ("node-v18.17.0-darwin-arm64.tar.gz", "node-v18.17.0-darwin-arm64", "19731ef427e77ad9c5f476eb62bfb02a7f179d3012feed0bbded62e45f23e679"),
32+
"18.17.0-linux_arm64": ("node-v18.17.0-linux-arm64.tar.xz", "node-v18.17.0-linux-arm64", "fbd2904178ee47da6e0386bc9704a12b1f613da6ad194878a517d4a69ba56544"),
33+
"18.17.0-linux_amd64": ("node-v18.17.0-linux-x64.tar.xz", "node-v18.17.0-linux-x64", "f36facda28c4d5ce76b3a1b4344e688d29d9254943a47f2f1909b1a10acb1959"),
34+
"18.17.0-windows_amd64": ("node-v18.17.0-win-x64.zip", "node-v18.17.0-win-x64", "06e30b4e70b18d794651ef132c39080e5eaaa1187f938721d57edae2824f4e96"),
3535
},
36-
node_version = "16.20.1",
36+
node_version = "18.17.0",
3737
node_urls = [
3838
"https://nodejs.org/dist/v{version}/{filename}",
3939
],

docs/user/setup.asciidoc

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ Windows. Since Kibana runs on Node.js, we include the necessary Node.js
2121
binaries for these platforms. Running Kibana against a separately maintained
2222
version of Node.js is not supported.
2323

24+
To support certain older Linux platforms (most notably CentOS7/RHEL7), {kib}
25+
for Linux ships with a custom build of Node.js with glibc 2.17 support. For
26+
details, see <<custom-nodejs-builds>>.
27+
2428
[float]
2529
[[elasticsearch-version]]
2630
== Elasticsearch version

package.json

+7-8
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"makelogs": "node scripts/makelogs",
5555
"spec_to_console": "node scripts/spec_to_console",
5656
"start": "node scripts/kibana --dev",
57-
"storybook": "node scripts/storybook",
57+
"storybook": "node --openssl-legacy-provider scripts/storybook",
5858
"test:ftr": "node scripts/functional_tests",
5959
"test:ftr:runner": "node scripts/functional_test_runner",
6060
"test:ftr:server": "node scripts/functional_tests_server",
@@ -66,7 +66,7 @@
6666
"url": "https://github.com/elastic/kibana.git"
6767
},
6868
"engines": {
69-
"node": "16.20.1",
69+
"node": "18.17.0",
7070
"yarn": "^1.21.1"
7171
},
7272
"resolutions": {
@@ -76,7 +76,8 @@
7676
"**/@babel/traverse": "^7.21.2",
7777
"**/@babel/types": "^7.21.2",
7878
"**/@types/babel__generator/@babel/types": "^7.21.0",
79-
"**/@types/node": "16.11.7",
79+
"**/@types/node": "18.17.1",
80+
"**/@types/react": "^16.14.25",
8081
"**/@types/react-dom": "^16.9.8",
8182
"**/chokidar": "^3.4.3",
8283
"**/globule/minimatch": "^3.1.2",
@@ -187,8 +188,6 @@
187188
"@turf/length": "^6.0.2",
188189
"@types/react-is": "^16.7.2",
189190
"JSONStream": "1.3.5",
190-
"abort-controller": "^3.0.0",
191-
"abortcontroller-polyfill": "^1.7.3",
192191
"antlr4ts": "^0.5.0-alpha.3",
193192
"archiver": "^5.2.0",
194193
"axios": "^0.27.2",
@@ -529,7 +528,7 @@
529528
"@types/ejs": "^3.0.6",
530529
"@types/elastic__datemath": "link:bazel-bin/packages/elastic-datemath/npm_module_types",
531530
"@types/elasticsearch": "^5.0.33",
532-
"@types/enzyme": "^3.10.8",
531+
"@types/enzyme": "^3.10.12",
533532
"@types/eslint": "^7.28.0",
534533
"@types/express": "^4.17.13",
535534
"@types/extract-zip": "^1.6.2",
@@ -581,8 +580,8 @@
581580
"@types/mustache": "^0.8.31",
582581
"@types/ncp": "^2.0.1",
583582
"@types/nock": "^10.0.3",
584-
"@types/node": "16.11.7",
585-
"@types/node-fetch": "^2.6.0",
583+
"@types/node": "18.17.1",
584+
"@types/node-fetch": "2.6.4",
586585
"@types/node-forge": "^1.3.1",
587586
"@types/nodemailer": "^6.4.0",
588587
"@types/normalize-path": "^3.0.0",

packages/kbn-es/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ NPM_MODULE_EXTRA_FILES = [
2929

3030
RUNTIME_DEPS = [
3131
"@npm//@elastic/elasticsearch",
32-
"@npm//abort-controller",
3332
"@npm//chalk",
3433
"@npm//dedent",
3534
"@npm//del",

packages/kbn-es/src/artifact.ts

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { pipeline, Transform } from 'stream';
1414
import { setTimeout } from 'timers/promises';
1515

1616
import fetch, { Headers } from 'node-fetch';
17-
import AbortController from 'abort-controller';
1817
import chalk from 'chalk';
1918
import { ToolingLog } from '@kbn/dev-utils';
2019

packages/kbn-monaco/BUILD.bazel

+4-1
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ webpack(
7171
"$(location webpack.config.js)",
7272
"--output-path",
7373
"$(@D)",
74-
"--env",
74+
"--env",
7575
"prod",
7676
"--stats=errors-only"
7777
],
78+
env = {
79+
"NODE_OPTIONS": "--openssl-legacy-provider"
80+
}
7881
)
7982

8083
ts_config(

packages/kbn-optimizer/src/optimizer/observe_worker.ts

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ function usingWorkerProc<T>(
7171
nodeOptions: [
7272
'--preserve-symlinks',
7373
'--preserve-symlinks-main',
74+
'--openssl-legacy-provider',
7475
...(inspectFlag && config.inspectWorkers
7576
? [`${inspectFlag}=${inspectPortCounter++}`]
7677
: []),

packages/kbn-plugin-helpers/src/integration_tests/build.test.ts

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ it('builds a generated plugin into a viable archive', async () => {
3939
process.execPath,
4040
['scripts/generate_plugin', '-y', '--name', 'fooTestPlugin'],
4141
{
42+
env: {
43+
NODE_OPTIONS: '--openssl-legacy-provider',
44+
},
4245
cwd: REPO_ROOT,
4346
all: true,
4447
}
@@ -61,6 +64,9 @@ it('builds a generated plugin into a viable archive', async () => {
6164
process.execPath,
6265
['../../scripts/plugin_helpers', 'build', '--kibana-version', '7.5.0'],
6366
{
67+
env: {
68+
NODE_OPTIONS: '--openssl-legacy-provider',
69+
},
6470
cwd: PLUGIN_DIR,
6571
all: true,
6672
}

packages/kbn-ui-shared-deps-npm/BUILD.bazel

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ RUNTIME_DEPS = [
3434
"@npm//@elastic/eui",
3535
"@npm//@elastic/numeral",
3636
"@npm//@emotion/react",
37-
"@npm//abortcontroller-polyfill",
3837
"@npm//babel-loader",
3938
"@npm//babel-plugin-transform-react-remove-prop-types",
4039
"@npm//core-js",
@@ -72,7 +71,6 @@ TYPES_DEPS = [
7271
"@npm//@elastic/eui",
7372
"@npm//@elastic/numeral",
7473
"@npm//@emotion/react",
75-
"@npm//abortcontroller-polyfill",
7674
"@npm//babel-loader",
7775
"@npm//core-js",
7876
"@npm//css-loader",
@@ -146,6 +144,9 @@ webpack(
146144
"$(@D)",
147145
"--stats=errors-only"
148146
],
147+
env = {
148+
"NODE_OPTIONS": "--openssl-legacy-provider"
149+
}
149150
)
150151

151152
js_library(

packages/kbn-ui-shared-deps-src/BUILD.bazel

+3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ webpack(
9999
"$(@D)",
100100
"--stats=errors-only"
101101
],
102+
env = {
103+
"NODE_OPTIONS": "--openssl-legacy-provider"
104+
}
102105
)
103106

104107
js_library(

src/core/public/apm_system.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
jest.mock('@elastic/apm-rum');
1010
import type { DeeplyMockedKeys, MockedKeys } from '@kbn/utility-types/jest';
11-
import { init, apm } from '@elastic/apm-rum';
11+
import { init, apm, Transaction } from '@elastic/apm-rum';
1212
import { ApmSystem } from './apm_system';
1313
import { Subject } from 'rxjs';
1414
import { InternalApplicationStart } from './application/types';

src/core/public/apm_system.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Side Public License, v 1.
77
*/
88

9-
import type { ApmBase, AgentConfigOptions } from '@elastic/apm-rum';
9+
import type { ApmBase, AgentConfigOptions, Transaction } from '@elastic/apm-rum';
1010
import { modifyUrl } from '@kbn/std';
1111
import { CachedResourceObserver } from './apm_resource_counter';
1212
import type { InternalApplicationStart } from './application';

src/core/public/chrome/chrome_service.test.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@ class FakeApp implements App {
3232
const store = new Map();
3333
const originalLocalStorage = window.localStorage;
3434

35-
(window as any).localStorage = {
36-
setItem: (key: string, value: string) => store.set(String(key), String(value)),
37-
getItem: (key: string) => store.get(String(key)),
38-
removeItem: (key: string) => store.delete(String(key)),
39-
};
35+
Object.defineProperty(window, 'localStorage', {
36+
value: {
37+
setItem: (key: string, value: string) => store.set(String(key), String(value)),
38+
getItem: (key: string) => store.get(String(key)),
39+
removeItem: (key: string) => store.delete(String(key)),
40+
},
41+
writable: true,
42+
});
4043

4144
function defaultStartDeps(availableApps?: App[]) {
4245
const deps = {

src/core/public/chrome/recently_accessed/recently_accessed_service.test.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ describe('RecentlyAccessed#start()', () => {
4444
let originalLocalStorage: Storage;
4545
beforeAll(() => {
4646
originalLocalStorage = window.localStorage;
47-
window.localStorage = new LocalStorageMock();
47+
Object.defineProperty(window, 'localStorage', {
48+
value: new LocalStorageMock(),
49+
writable: true,
50+
});
4851
});
4952
beforeEach(() => localStorage.clear());
5053
afterAll(() => (window.localStorage = originalLocalStorage));

src/dev/build/lib/download.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export async function downloadToDisk({
9696
const downloadedSha = hash.digest('hex');
9797
if (downloadedSha !== shaChecksum) {
9898
throw new Error(
99-
`Downloaded checksum ${downloadedSha} does not match the expected ${shaAlgorithm} checksum.`
99+
`Downloaded checksum ${downloadedSha} does not match the expected (${shaAlgorithm}) checksum ${shaChecksum}, for file: ${url}.`
100100
);
101101
}
102102
} catch (_error) {

src/dev/build/lib/integration_tests/download.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ describe('downloadToDisk', () => {
117117
shaAlgorithm: 'sha256',
118118
});
119119
await expect(promise).rejects.toMatchInlineSnapshot(
120-
`[Error: Downloaded checksum 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae does not match the expected sha256 checksum.]`
120+
`[Error: Downloaded checksum ${FOO_SHA256} does not match the expected (sha256) checksum bar, for file: ${serverUrl}.]`
121121
);
122122

123123
try {
@@ -175,7 +175,7 @@ describe('downloadToDisk', () => {
175175
" debg Deleting downloaded data at TMP_DIR/__tmp_download_js_test_file__",
176176
" info Retrying in 0.1 seconds",
177177
" debg [2/3] Attempting download of TEST_SERVER_URL sha256",
178-
" debg Download failed: Downloaded checksum fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9 does not match the expected sha256 checksum.",
178+
" debg Download failed: Downloaded checksum fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9 does not match the expected (sha256) checksum 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae, for file: TEST_SERVER_URL.",
179179
" debg Deleting downloaded data at TMP_DIR/__tmp_download_js_test_file__",
180180
" info Retrying in 0.2 seconds",
181181
" debg [3/3] Attempting download of TEST_SERVER_URL sha256",

src/dev/build/tasks/patch_native_modules_task.ts

+32-21
Original file line numberDiff line numberDiff line change
@@ -41,40 +41,51 @@ interface Package {
4141
const packages: Package[] = [
4242
{
4343
name: 're2',
44-
version: '1.16.0',
44+
version: '1.17.7',
4545
destinationPath: 'node_modules/re2/build/Release/re2.node',
4646
extractMethod: 'gunzip',
4747
archives: {
48-
'darwin-x64': {
49-
url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/darwin-x64-93.gz',
50-
sha256: 'a267c6202d86d08170eb4a833acf81d83660ce33e8981fcd5b7f6e0310961d56',
51-
},
5248
'linux-x64': {
53-
url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/linux-x64-93.gz',
54-
sha256: 'e0ca5d6527fe7ec0fe98b6960c47b66a5bb2823c3bebb3bf4ed4d58eed3d23c5',
49+
url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.7/linux-x64-108.gz',
50+
sha256: 'e0b62ff7c415c95f57232f2726711c0fd71056c848538f095ba3fa1126ef5e31',
5551
},
5652

57-
// ARM build is currently done manually as Github Actions used in upstream project
53+
// ARM builds are currently done manually as Github Actions used in upstream project
5854
// do not natively support an ARM target.
5955

60-
// From a AWS Graviton instance:
61-
// * checkout the node-re2 project,
62-
// * install Node using the same minor used by Kibana
63-
// * git submodule update --init --recursive to download re2
64-
// * npm install, which will also create a build
65-
// * gzip -c build/Release/re2.node > linux-arm64-83.gz
66-
// * upload to kibana-ci-proxy-cache bucket
56+
// From an AWS Graviton instance running Ubuntu or a GCE T2A instance running Debian:
57+
// * install build-essential package: `sudo apt-get update` + `sudo apt install build-essential`
58+
// * install nvm and the node version used by the Kibana repository
59+
// * `npm install [email protected]`
60+
// * re2 will build itself on install
61+
// * `cp node_modules/re2/build/Release/re2.node linux-arm64-$(node -e "console.log(process.versions.modules)")`
62+
// * `gzip linux-arm64-*`
63+
// * capture the sha256 with: `shasum -a 256 linux-arm64-*`
64+
// * upload the `linux-arm64-*.gz` artifact to the `yarn-prebuilt-artifacts` bucket in GCS using the correct version number
6765
'linux-arm64': {
68-
url: 'https://storage.googleapis.com/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.16.0/linux-arm64-93.gz',
69-
sha256: '7a786e0b75985e5aafdefa9af55cad8e85e69a3326f16d8c63d21d6b5b3bff1b',
66+
url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.7/linux-arm64-108.gz',
67+
sha256: 'e2025ead87be9f1ec4a9d892d1cce69c573101762720d56f52b1d52ed7ae0fef',
7068
},
69+
70+
'darwin-x64': {
71+
url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.7/darwin-x64-108.gz',
72+
sha256: '4ed378c5a7fe6134b717afe7642254aff1ed7a881cbcaa53a012ac3efab49f99',
73+
},
74+
75+
// A similar process is necessary for building on ARM macs:
76+
// * bootstrap and re2 will build itself on install
77+
// * `cp node_modules/re2/build/Release/re2.node darwin-arm64-$(node -e "console.log(process.versions.modules)")`
78+
// * `gzip darwin-arm64-*`
79+
// * capture the sha256 with: `shasum -a 256 darwin-arm64-*`
80+
// * upload the `darwin-arm64-*.gz` artifact to the `yarn-prebuilt-artifacts` bucket in GCS using the correct version number
7181
'darwin-arm64': {
72-
url: 'https://storage.googleapis.com/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.16.0/darwin-arm64-93.gz',
73-
sha256: '28b540cdddf13578f1bd28a03e29ffdc26a7f00ec859c369987b8d51ec6357c8',
82+
url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.7/darwin-arm64-108.gz',
83+
sha256: '42afc32137ff5c5bebae5d68347a9786906748c2f28e06194d8950707f2ae90e',
7484
},
85+
7586
'win32-x64': {
76-
url: 'https://github.com/uhop/node-re2/releases/download/1.16.0/win32-x64-93.gz',
77-
sha256: '37245ceb59a086b5e7e9de8746a3cdf148c383be9ae2580f92baea90d0d39947',
87+
url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.7/win32-x64-108.gz',
88+
sha256: 'ff72fe02de652262659c8e17e44a932f3c873362233756b40d1a97538d05de92',
7889
},
7990
},
8091
},

src/plugins/console/public/application/models/sense_editor/sense_editor.test.js

+17
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ describe('Editor', () => {
3131
input = create(document.querySelector('#ConAppEditor'));
3232
$(input.getCoreEditor().getContainer()).show();
3333
input.autocomplete._test.removeChangeListener();
34+
oldUrl = global.URL;
35+
olldWindow = { ...global.window };
36+
global.URL = URL;
37+
Object.defineProperty(global, 'window', {
38+
value: Object.create(window),
39+
writable: true,
40+
});
41+
Object.defineProperty(window, 'location', {
42+
value: {
43+
origin: 'http://localhost:5620',
44+
},
45+
});
46+
storage = createStorage({
47+
engine: global.window.localStorage,
48+
prefix: 'console_test',
49+
});
50+
setStorage(storage);
3451
});
3552
afterEach(function () {
3653
$(input.getCoreEditor().getContainer()).hide();

x-pack/plugins/actions/server/builtin_action_types/lib/request_oauth_client_credentials_token.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ describe('requestOAuthClientCredentialsToken', () => {
7474
"maxSockets": Infinity,
7575
"maxTotalSockets": Infinity,
7676
"options": Object {
77+
"noDelay": true,
7778
"path": null,
7879
"rejectUnauthorized": true,
7980
},

0 commit comments

Comments
 (0)