Skip to content

Commit 0006496

Browse files
delannikibanamachinemisticwatson
authored andcommitted
[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 dc953de commit 0006496

File tree

38 files changed

+378
-108
lines changed

38 files changed

+378
-108
lines changed

.ci/Dockerfile

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.20.1
1+
18.17.0

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.20.1
1+
18.17.0

WORKSPACE.bazel

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install
2222
# Setup the Node.js toolchain for the architectures we want to support
2323
node_repositories(
2424
node_repositories = {
25-
"16.20.1-darwin_amd64": ("node-v16.20.1-darwin-x64.tar.gz", "node-v16.20.1-darwin-x64", "d1f9c2a7c3a0fe09860f701af5fb8ff9ac72d72faa7ebabfeb5794503e79f955"),
26-
"16.20.1-darwin_arm64": ("node-v16.20.1-darwin-arm64.tar.gz", "node-v16.20.1-darwin-arm64", "5f6b31c5a75567d382ba67220f3d7a2d9bb0c03d8af9307cd35a9cb32a6fde9d"),
27-
"16.20.1-linux_arm64": ("node-v16.20.1-linux-arm64.tar.xz", "node-v16.20.1-linux-arm64", "7fce19f3d1c2952599a0b47f9f5d8f497265ad577f37f256a8c6a03be6353234"),
28-
"16.20.1-linux_amd64": ("node-v16.20.1-linux-x64.tar.xz", "node-v16.20.1-linux-x64", "b6c60e1e106ad7d8881e83945a5208c1b1d1b63e6901c04b9dafa607aff3a154"),
29-
"16.20.1-windows_amd64": ("node-v16.20.1-win-x64.zip", "node-v16.20.1-win-x64", "2a7fde996c57a969f0498742f99385a520eb14aac864e0eff9c32e3f3633ff0a"),
25+
"18.17.0-darwin_amd64": ("node-v18.17.0-darwin-x64.tar.gz", "node-v18.17.0-darwin-x64", "2f381442381f7fbde2ca644c3275bec9c9c2a8d361f467b40e39428acdd6ccff"),
26+
"18.17.0-darwin_arm64": ("node-v18.17.0-darwin-arm64.tar.gz", "node-v18.17.0-darwin-arm64", "19731ef427e77ad9c5f476eb62bfb02a7f179d3012feed0bbded62e45f23e679"),
27+
"18.17.0-linux_arm64": ("node-v18.17.0-linux-arm64.tar.xz", "node-v18.17.0-linux-arm64", "fbd2904178ee47da6e0386bc9704a12b1f613da6ad194878a517d4a69ba56544"),
28+
"18.17.0-linux_amd64": ("node-v18.17.0-linux-x64.tar.xz", "node-v18.17.0-linux-x64", "f36facda28c4d5ce76b3a1b4344e688d29d9254943a47f2f1909b1a10acb1959"),
29+
"18.17.0-windows_amd64": ("node-v18.17.0-win-x64.zip", "node-v18.17.0-win-x64", "06e30b4e70b18d794651ef132c39080e5eaaa1187f938721d57edae2824f4e96"),
3030
},
31-
node_version = "16.20.1",
31+
node_version = "18.17.0",
3232
node_urls = [
3333
"https://nodejs.org/dist/v{version}/{filename}",
3434
],

docs/developer/advanced/upgrading-nodejs.asciidoc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ These files must be updated when upgrading Node.js:
1717
- {kib-repo}blob/{branch}/WORKSPACE.bazel[`WORKSPACE.bazel`] - The version is specified in the `node_version` property.
1818
Besides this property, the list of files under `node_repositories` must be updated along with their respective SHA256 hashes.
1919
These can be found on the https://nodejs.org[nodejs.org] website.
20-
Example for Node.js v16.20.1: https://nodejs.org/dist/v16.20.1/SHASUMS256.txt.asc
20+
Example for Node.js v18.17.0: https://nodejs.org/dist/v18.17.0/SHASUMS256.txt.asc
2121

2222
See PR {kib-repo}pull/128123[#128123] for an example of how the Node.js version has been upgraded previously.
2323

@@ -30,6 +30,13 @@ When upgrading to a new major version of Node.js, the following extra steps must
3030
You can change which Node.js major version to view, by changing the selected branch.
3131
If Node.js has dropped support for platform still supported by Kibana, appropriate steps must be taken as soon as possible to deprecate support for this platform. This way support for it can be dropped before the currently used major version of Node.js https://github.com/nodejs/release#release-schedule[reaches End-of-Life].
3232

33+
[[custom-nodejs-builds]]
34+
=== Custom builds of Node.js
35+
36+
Due to Node.js 16 coming to an https://nodejs.org/en/blog/announcements/nodejs16-eol[early End-of-Life] and Node.js 18 no longer supporting the same platforms that {kib} supports (most notably CentOS7/RHEL7), we cannot bundle the official Node.js binaries with the Linux distributable of {kib}.
37+
To keep support for these older platforms, we're bundling the Linux distributable of {kib} with a https://github.com/elastic/kibana-custom-nodejs-builds[custom build of Node.js] with extended backwards compatibility.
38+
The only difference between the offical Node.js build and our custom build, is the version of `glibc` that it's compiled against.
39+
3340
=== Backporting
3441

3542
The following rules are not set in stone.

docs/user/setup.asciidoc

Lines changed: 4 additions & 0 deletions
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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"serverless-security": "node scripts/kibana --dev --serverless=security",
6262
"spec_to_console": "node scripts/spec_to_console",
6363
"start": "node scripts/kibana --dev",
64-
"storybook": "node scripts/storybook",
64+
"storybook": "node --openssl-legacy-provider scripts/storybook",
6565
"test:ftr": "node scripts/functional_tests",
6666
"test:ftr:runner": "node scripts/functional_test_runner",
6767
"test:ftr:server": "node scripts/functional_tests_server",
@@ -73,11 +73,11 @@
7373
"url": "https://github.com/elastic/kibana.git"
7474
},
7575
"engines": {
76-
"node": "16.20.1",
76+
"node": "18.17.0",
7777
"yarn": "^1.22.19"
7878
},
7979
"resolutions": {
80-
"**/@types/node": "16.11.68",
80+
"**/@types/node": "18.17.1",
8181
"**/chokidar": "^3.5.3",
8282
"**/globule/minimatch": "^3.1.2",
8383
"**/hoist-non-react-statics": "^3.3.2",
@@ -788,7 +788,6 @@
788788
"@turf/length": "^6.0.2",
789789
"@xstate/react": "^3.2.2",
790790
"JSONStream": "1.3.5",
791-
"abort-controller": "^3.0.0",
792791
"adm-zip": "^0.5.9",
793792
"ajv": "^8.12.0",
794793
"antlr4ts": "^0.5.0-alpha.3",
@@ -929,7 +928,7 @@
929928
"query-string": "^6.13.2",
930929
"rbush": "^3.0.1",
931930
"re-resizable": "^6.9.9",
932-
"re2": "1.17.4",
931+
"re2": "1.17.7",
933932
"react": "^17.0.2",
934933
"react-ace": "^7.0.5",
935934
"react-beautiful-dnd": "^13.1.0",
@@ -1298,8 +1297,8 @@
12981297
"@types/multistream": "^4.1.0",
12991298
"@types/mustache": "^0.8.31",
13001299
"@types/nock": "^10.0.3",
1301-
"@types/node": "16.11.68",
1302-
"@types/node-fetch": "^2.6.0",
1300+
"@types/node": "18.17.1",
1301+
"@types/node-fetch": "2.6.4",
13031302
"@types/node-forge": "^1.3.1",
13041303
"@types/nodemailer": "^6.4.0",
13051304
"@types/normalize-path": "^3.0.0",

packages/core/chrome/core-chrome-browser-internal/src/chrome_service.test.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,14 @@ class FakeApp implements App {
3636
const store = new Map();
3737
const originalLocalStorage = window.localStorage;
3838

39-
(window as any).localStorage = {
40-
setItem: (key: string, value: string) => store.set(String(key), String(value)),
41-
getItem: (key: string) => store.get(String(key)),
42-
removeItem: (key: string) => store.delete(String(key)),
43-
};
39+
Object.defineProperty(window, 'localStorage', {
40+
value: {
41+
setItem: (key: string, value: string) => store.set(String(key), String(value)),
42+
getItem: (key: string) => store.get(String(key)),
43+
removeItem: (key: string) => store.delete(String(key)),
44+
},
45+
writable: true,
46+
});
4447

4548
function defaultStartDeps(availableApps?: App[]) {
4649
const deps = {

packages/core/chrome/core-chrome-browser-internal/src/recently_accessed/recently_accessed_service.test.ts

Lines changed: 4 additions & 1 deletion
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));

packages/core/elasticsearch/core-elasticsearch-client-server-internal/src/agent_manager.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import { AgentManager } from './agent_manager';
1616
jest.mock('http');
1717
jest.mock('https');
1818

19-
const HttpAgentMock = HttpAgent as jest.Mock<HttpAgent>;
20-
const HttpsAgentMock = HttpsAgent as jest.Mock<HttpsAgent>;
19+
const HttpAgentMock = HttpAgent as unknown as jest.Mock<HttpAgent>;
20+
const HttpsAgentMock = HttpsAgent as unknown as jest.Mock<HttpsAgent>;
2121

2222
describe('AgentManager', () => {
2323
let logger: MockedLogger;

0 commit comments

Comments
 (0)