From c8856b6437be14d214e5fde1c982056f1666c2cb Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 23 Nov 2023 21:53:53 +0000 Subject: [PATCH 01/15] Revert "Revert "Upgrade to Node.js 20 (#162696)"" This reverts commit f51e6cd24864290aec4404cea934b8c2f9a89a0f. --- .buildkite/pipelines/artifacts.yml | 2 +- .ci/Dockerfile | 2 +- .node-version | 2 +- .nvmrc | 2 +- WORKSPACE.bazel | 12 ++--- package.json | 6 +-- .../discovery/plugin_manifest_parser.test.ts | 2 +- .../src/discovery/plugins_discovery.test.ts | 2 +- .../src/lib/archives/parse.test.ts | 2 +- .../integration_tests/__fixtures__/es_bin.js | 4 +- packages/kbn-es/src/utils/docker.test.ts | 15 +++--- packages/kbn-es/src/utils/docker.ts | 11 ++++- .../build/tasks/patch_native_modules_task.ts | 20 ++++---- .../create_streaming_batched_function.test.ts | 2 +- .../public/search/expressions/esdsl.test.ts | 2 +- src/setup_node_env/exit_on_warning.js | 7 +++ src/setup_node_env/heap_snapshot.js | 46 ------------------- src/setup_node_env/setup_env.js | 2 - .../user_actions/connector_id.test.ts | 6 +-- .../document_creation_logic.test.ts | 2 +- .../server/browsers/download/fetch.test.ts | 4 +- .../server/browsers/download/fetch.ts | 12 ++--- .../server/browsers/download/index.test.ts | 10 ++-- .../server/browsers/download/index.ts | 10 +++- .../server/browsers/extract/unzip.test.ts | 4 +- .../lib/check_for_json_errors.test.ts | 2 +- .../api/rules/import_rules/route.test.ts | 2 +- .../create_rules_stream_from_ndjson.test.ts | 4 +- .../server/saved_objects/migrations.test.ts | 2 +- yarn.lock | 15 ++++-- 30 files changed, 99 insertions(+), 115 deletions(-) delete mode 100644 src/setup_node_env/heap_snapshot.js diff --git a/.buildkite/pipelines/artifacts.yml b/.buildkite/pipelines/artifacts.yml index 4a52ee7402823c..5b219952c8cf11 100644 --- a/.buildkite/pipelines/artifacts.yml +++ b/.buildkite/pipelines/artifacts.yml @@ -88,7 +88,7 @@ steps: - exit_status: -1 agents: queue: n2-2 - timeout_in_minutes: 30 + timeout_in_minutes: 60 if: "build.env('RELEASE_BUILD') == null || build.env('RELEASE_BUILD') == '' || build.env('RELEASE_BUILD') == 'false'" retry: automatic: diff --git a/.ci/Dockerfile b/.ci/Dockerfile index 109b9ffab3cc56..91e0d5bf36a9d5 100644 --- a/.ci/Dockerfile +++ b/.ci/Dockerfile @@ -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=18.18.2 +ARG NODE_VERSION=20.9.0 FROM node:${NODE_VERSION} AS base diff --git a/.node-version b/.node-version index 87ec8842b158d2..f3f52b42d3da97 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -18.18.2 +20.9.0 diff --git a/.nvmrc b/.nvmrc index 87ec8842b158d2..f3f52b42d3da97 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18.18.2 +20.9.0 diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index e614bdff172f99..38802ebef5b1d8 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -22,13 +22,13 @@ load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install # Setup the Node.js toolchain for the architectures we want to support node_repositories( node_repositories = { - "18.18.2-darwin_amd64": ("node-v18.18.2-darwin-x64.tar.gz", "node-v18.18.2-darwin-x64", "5bb8da908ed590e256a69bf2862238c8a67bc4600119f2f7721ca18a7c810c0f"), - "18.18.2-darwin_arm64": ("node-v18.18.2-darwin-arm64.tar.gz", "node-v18.18.2-darwin-arm64", "9f982cc91b28778dd8638e4f94563b0c2a1da7aba62beb72bd427721035ab553"), - "18.18.2-linux_arm64": ("node-v18.18.2-linux-arm64.tar.xz", "node-v18.18.2-linux-arm64", "8a5a03f6a742159c9aa0ae3a99b368cd938cf62f3a5522a2e5acbe6313710efe"), - "18.18.2-linux_amd64": ("node-v18.18.2-linux-x64.tar.xz", "node-v18.18.2-linux-x64", "f7cf590bc7153f3beaa9e1138d00e50d74df223f0bec61f63e7df65f7315b76a"), - "18.18.2-windows_amd64": ("node-v18.18.2-win-x64.zip", "node-v18.18.2-win-x64", "3bb0e51e579a41a22b3bf6cb2f3e79c03801aa17acbe0ca00fc555d1282e7acd"), + "20.9.0-darwin_amd64": ("node-v20.9.0-darwin-x64.tar.gz", "node-v20.9.0-darwin-x64", "fc5b73f2a78c17bbe926cdb1447d652f9f094c79582f1be6471b4b38a2e1ccc8"), + "20.9.0-darwin_arm64": ("node-v20.9.0-darwin-arm64.tar.gz", "node-v20.9.0-darwin-arm64", "31d2d46ae8d8a3982f54e2ff1e60c2e4a8e80bf78a3e8b46dcaac95ac5d7ce6a"), + "20.9.0-linux_arm64": ("node-v20.9.0-linux-arm64.tar.xz", "node-v20.9.0-linux-arm64", "79c07c41c9f2410e35fd8dec61491ba63762e428bffa2ee0ff3aec1afe05d4b1"), + "20.9.0-linux_amd64": ("node-v20.9.0-linux-x64.tar.xz", "node-v20.9.0-linux-x64", "d11a5e06d6fda8d0cb1a759365d2b5e33c609f3c9f333fdc63e0522475dc0c89"), + "20.9.0-windows_amd64": ("node-v20.9.0-win-x64.zip", "node-v20.9.0-win-x64", "70d87dad2378c63216ff83d5a754c61d2886fc39d32ce0d2ea6de763a22d3780"), }, - node_version = "18.18.2", + node_version = "20.9.0", node_urls = [ "https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v{version}/{filename}", ], diff --git a/package.json b/package.json index 5e43d8bb910cf8..b3e625d1dafe16 100644 --- a/package.json +++ b/package.json @@ -74,12 +74,12 @@ "url": "https://github.com/elastic/kibana.git" }, "engines": { - "node": "18.18.2", + "node": "20.9.0", "yarn": "^1.22.19" }, "resolutions": { "**/@hello-pangea/dnd": "16.2.0", - "**/@types/node": "18.18.5", + "**/@types/node": "20.9.0", "**/@typescript-eslint/utils": "5.62.0", "**/chokidar": "^3.5.3", "**/globule/minimatch": "^3.1.2", @@ -1380,7 +1380,7 @@ "@types/multistream": "^4.1.0", "@types/mustache": "^0.8.31", "@types/nock": "^10.0.3", - "@types/node": "18.18.5", + "@types/node": "20.9.0", "@types/node-fetch": "2.6.4", "@types/node-forge": "^1.3.1", "@types/nodemailer": "^6.4.0", diff --git a/packages/core/plugins/core-plugins-server-internal/src/discovery/plugin_manifest_parser.test.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/plugin_manifest_parser.test.ts index f940e49805cd5a..202cef2ca09d41 100644 --- a/packages/core/plugins/core-plugins-server-internal/src/discovery/plugin_manifest_parser.test.ts +++ b/packages/core/plugins/core-plugins-server-internal/src/discovery/plugin_manifest_parser.test.ts @@ -59,7 +59,7 @@ test('return error when manifest content is not a valid JSON', async () => { }); await expect(parseManifest(pluginPath, packageInfo)).rejects.toMatchObject({ - message: `Unexpected token o in JSON at position 1 (invalid-manifest, ${pluginManifestPath})`, + message: `Unexpected token 'o', "not-json" is not valid JSON (invalid-manifest, ${pluginManifestPath})`, type: PluginDiscoveryErrorType.InvalidManifest, path: pluginManifestPath, }); diff --git a/packages/core/plugins/core-plugins-server-internal/src/discovery/plugins_discovery.test.ts b/packages/core/plugins/core-plugins-server-internal/src/discovery/plugins_discovery.test.ts index 9ab50d8786ccab..93657a1f2533e7 100644 --- a/packages/core/plugins/core-plugins-server-internal/src/discovery/plugins_discovery.test.ts +++ b/packages/core/plugins/core-plugins-server-internal/src/discovery/plugins_discovery.test.ts @@ -278,7 +278,7 @@ describe('plugins discovery system', () => { .toPromise(); expect(errors).toContain( - `Error: Unexpected token o in JSON at position 1 (invalid-manifest, ${manifestPath( + `Error: Unexpected token 'o', "not-json" is not valid JSON (invalid-manifest, ${manifestPath( 'plugin_a' )})` ); diff --git a/packages/kbn-es-archiver/src/lib/archives/parse.test.ts b/packages/kbn-es-archiver/src/lib/archives/parse.test.ts index b87e6f71400e0b..9e0d5c02238b84 100644 --- a/packages/kbn-es-archiver/src/lib/archives/parse.test.ts +++ b/packages/kbn-es-archiver/src/lib/archives/parse.test.ts @@ -98,7 +98,7 @@ describe('esArchiver createParseArchiveStreams', () => { ] as [Readable, ...Writable[]]); throw new Error('should have failed'); } catch (err) { - expect(err.message).toEqual(expect.stringContaining('Unexpected number')); + expect(err.message).toEqual(`Expected property name or '}' in JSON at position 1`); } }); }); diff --git a/packages/kbn-es/src/integration_tests/__fixtures__/es_bin.js b/packages/kbn-es/src/integration_tests/__fixtures__/es_bin.js index 5ef61456988115..0d44b8a775b25d 100644 --- a/packages/kbn-es/src/integration_tests/__fixtures__/es_bin.js +++ b/packages/kbn-es/src/integration_tests/__fixtures__/es_bin.js @@ -87,11 +87,11 @@ const { ES_KEY_PATH, ES_CERT_PATH } = require('@kbn/dev-utils'); } ); - // setup server auto close after 1 second of silence + // setup server auto close after 5 second of silence let serverCloseTimer; const delayServerClose = () => { clearTimeout(serverCloseTimer); - serverCloseTimer = setTimeout(() => server.close(), 1000); + serverCloseTimer = setTimeout(() => server.close(), 5000); }; server.on('request', delayServerClose); server.on('listening', delayServerClose); diff --git a/packages/kbn-es/src/utils/docker.test.ts b/packages/kbn-es/src/utils/docker.test.ts index b574447a20508b..ef015af7f32ef0 100644 --- a/packages/kbn-es/src/utils/docker.test.ts +++ b/packages/kbn-es/src/utils/docker.test.ts @@ -7,8 +7,7 @@ */ import mockFs from 'mock-fs'; -import { existsSync } from 'fs'; -import { stat } from 'fs/promises'; +import Fsp from 'fs/promises'; import { basename } from 'path'; import { @@ -115,7 +114,7 @@ const volumeCmdTest = async (volumeCmd: string[]) => { // extract only permission from mode // eslint-disable-next-line no-bitwise - expect((await stat(serverlessObjectStorePath)).mode & 0o777).toBe(0o777); + expect((await Fsp.stat(serverlessObjectStorePath)).mode & 0o777).toBe(0o777); }; describe('resolveDockerImage()', () => { @@ -508,7 +507,7 @@ describe('setupServerlessVolumes()', () => { const volumeCmd = await setupServerlessVolumes(log, { basePath: baseEsPath }); volumeCmdTest(volumeCmd); - expect(existsSync(serverlessObjectStorePath)).toBe(true); + await expect(Fsp.access(serverlessObjectStorePath)).resolves.not.toThrow(); }); test('should use an existing object store', async () => { @@ -517,7 +516,9 @@ describe('setupServerlessVolumes()', () => { const volumeCmd = await setupServerlessVolumes(log, { basePath: baseEsPath }); volumeCmdTest(volumeCmd); - expect(existsSync(`${serverlessObjectStorePath}/cluster_state/lease`)).toBe(true); + await expect( + Fsp.access(`${serverlessObjectStorePath}/cluster_state/lease`) + ).resolves.not.toThrow(); }); test('should remove an existing object store when clean is passed', async () => { @@ -526,7 +527,9 @@ describe('setupServerlessVolumes()', () => { const volumeCmd = await setupServerlessVolumes(log, { basePath: baseEsPath, clean: true }); volumeCmdTest(volumeCmd); - expect(existsSync(`${serverlessObjectStorePath}/cluster_state/lease`)).toBe(false); + await expect( + Fsp.access(`${serverlessObjectStorePath}/cluster_state/lease`) + ).rejects.toThrowError(); }); test('should add SSL and IDP metadata volumes when ssl and kibanaUrl are passed', async () => { diff --git a/packages/kbn-es/src/utils/docker.ts b/packages/kbn-es/src/utils/docker.ts index 73e5e1fc772884..d9d275c119a976 100644 --- a/packages/kbn-es/src/utils/docker.ts +++ b/packages/kbn-es/src/utils/docker.ts @@ -542,12 +542,19 @@ export async function setupServerlessVolumes(log: ToolingLog, options: Serverles log.info(chalk.bold(`Checking for local serverless ES object store at ${objectStorePath}`)); log.indent(4); - if (clean && fs.existsSync(objectStorePath)) { + let exists = null; + try { + await Fsp.access(objectStorePath); + exists = true; + } catch (e) { + exists = false; + } + if (clean && exists) { log.info('Cleaning existing object store.'); await Fsp.rm(objectStorePath, { recursive: true, force: true }); } - if (clean || !fs.existsSync(objectStorePath)) { + if (clean || !exists) { await Fsp.mkdir(objectStorePath, { recursive: true }).then(() => log.info('Created new object store.') ); diff --git a/src/dev/build/tasks/patch_native_modules_task.ts b/src/dev/build/tasks/patch_native_modules_task.ts index 24ab98d1322036..c928d8a5b4d062 100644 --- a/src/dev/build/tasks/patch_native_modules_task.ts +++ b/src/dev/build/tasks/patch_native_modules_task.ts @@ -47,8 +47,8 @@ const packages: Package[] = [ extractMethod: 'gunzip', archives: { 'linux-x64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.1/linux-x64-108.gz', - sha256: 'e14f274f73ede22f170bfe9e57a0645ebf7ed320042a27361fa158bc239a5563', + url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.1/linux-x64-115.gz', + sha256: '7a4821ef7e9ddbafe5bba6beb54b100c233242f0dbf5a7268f55beea5f845f97', }, // Linux ARM builds are currently done manually as Github Actions used in upstream project // do not natively support an Linux ARM target. @@ -63,20 +63,20 @@ const packages: Package[] = [ // * capture the sha256 with: `shasum -a 256 linux-arm64-*` // * upload the `linux-arm64-*.gz` artifact to the `yarn-prebuilt-artifacts` bucket in GCS using the correct version number 'linux-arm64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.1/linux-arm64-108.gz', - sha256: 'cbdf3f75a331c601ac0bd34715814d0a1fd17612c6d6b5269f176d46044defd5', + url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.1/linux-arm64-115.gz', + sha256: '8d753d6ac15d95d6d236dce2f986f4a6b2f9945ba0d927ab972eb82da68d14b1', }, 'darwin-x64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.1/darwin-x64-108.gz', - sha256: 'f88c09e98f152ac15c593b3b923b7fbe28d448cfde5986da40c34461bede5a09', + url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.1/darwin-x64-115.gz', + sha256: '91823077c510c6da9c428038bfd210846373bcd0ab6851f7408add67864785a9', }, 'darwin-arm64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.1/darwin-arm64-108.gz', - sha256: '80700aecbe63052149aba721449a8ce30c24d884e414025124bb4602efe708be', + url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.1/darwin-arm64-115.gz', + sha256: '935e2a5590e93e6f52f41d40ae4115fbd2f130a4d61afb0a6549ed17adb1dd84', }, 'win32-x64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.1/win32-x64-108.gz', - sha256: 'cadc4713907f3ad1de45f470810ec8e13e08f32c1a1e45e5d5ab5e9d7fcb9763', + url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.1/win32-x64-115.gz', + sha256: '120c2663bcab4803f8405d9aa2cb97fa181d90b4ff176827cc7295667aa2e9c2', }, }, }, diff --git a/src/plugins/bfetch/public/batching/create_streaming_batched_function.test.ts b/src/plugins/bfetch/public/batching/create_streaming_batched_function.test.ts index fb9db4490144b0..f4eeca4bc5ba63 100644 --- a/src/plugins/bfetch/public/batching/create_streaming_batched_function.test.ts +++ b/src/plugins/bfetch/public/batching/create_streaming_batched_function.test.ts @@ -744,7 +744,7 @@ describe('createStreamingBatchedFunction()', () => { const [, error1] = await promise1; const [result1] = await promise2; expect(error1).toMatchObject({ - message: 'Unexpected token N in JSON at position 0', + message: `Unexpected token 'N', "Not a JSON\n" is not valid JSON`, code: 'STREAM', }); expect(result1).toMatchObject({ diff --git a/src/plugins/data/public/search/expressions/esdsl.test.ts b/src/plugins/data/public/search/expressions/esdsl.test.ts index 2bf2ef1148507d..603dbf1e8f3eb4 100644 --- a/src/plugins/data/public/search/expressions/esdsl.test.ts +++ b/src/plugins/data/public/search/expressions/esdsl.test.ts @@ -63,7 +63,7 @@ describe('esdsl', () => { } catch (error) { errorMessage = error.message; } - expect(errorMessage).toEqual('Unexpected token i in JSON at position 0'); + expect(errorMessage).toEqual(`Unexpected token 'i', "invalid json" is not valid JSON`); }); test('adds filters', async () => { diff --git a/src/setup_node_env/exit_on_warning.js b/src/setup_node_env/exit_on_warning.js index 5e7bae8254c04e..dc6e3210742246 100644 --- a/src/setup_node_env/exit_on_warning.js +++ b/src/setup_node_env/exit_on_warning.js @@ -46,6 +46,13 @@ var IGNORE_WARNINGS = [ // We need to discard that warning name: 'ProductNotSupportedSecurityError', }, + // https://github.com/browserify/browserify-rsa/pull/20 + { + name: 'DeprecationWarning', + code: 'DEP0170', + message: + 'The URL https://github.com:crypto-browserify/browserify-rsa.git is invalid. Future versions of Node.js will throw an error.', + }, ]; if (process.noProcessWarnings !== true) { diff --git a/src/setup_node_env/heap_snapshot.js b/src/setup_node_env/heap_snapshot.js deleted file mode 100644 index 94e4b35e2f8870..00000000000000 --- a/src/setup_node_env/heap_snapshot.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -var getopts = require('getopts'); -var path = require('path'); -var v8 = require('node:v8'); -var worker = require('node:worker_threads'); - -var execOpts = getopts(process.execArgv); -var envOpts = getopts(process.env.NODE_OPTIONS ? process.env.NODE_OPTIONS.split(/\s+/) : []); -var diagnosticDir = execOpts['diagnostic-dir'] || envOpts['diagnostic-dir']; -var heapSnapshotSignal = execOpts['heapsnapshot-signal'] || envOpts['heapsnapshot-signal']; -var heapSnapshotSerial = 0; - -function getHeapSnapshotPath() { - var now = new Date(); - - var year = now.getFullYear(); - var month = String(now.getMonth() + 1).padStart(2, '0'); - var day = String(now.getDate()).padStart(2, '0'); - var hours = String(now.getHours()).padStart(2, '0'); - var minutes = String(now.getMinutes()).padStart(2, '0'); - var seconds = String(now.getSeconds()).padStart(2, '0'); - - var date = `${year}${month}${day}`; - var time = `${hours}${minutes}${seconds}`; - var pid = process.pid; - var threadId = worker.threadId; - var serial = (++heapSnapshotSerial).toString().padStart(3, '0'); - - return path.join(diagnosticDir, `Heap.${date}.${time}.${pid}.${threadId}.${serial}.heapsnapshot`); -} - -if (diagnosticDir && heapSnapshotSignal) { - process.removeAllListeners(heapSnapshotSignal); - - process.on(heapSnapshotSignal, function () { - var heapSnapshotPath = getHeapSnapshotPath(); - v8.writeHeapSnapshot(heapSnapshotPath); - }); -} diff --git a/src/setup_node_env/setup_env.js b/src/setup_node_env/setup_env.js index d3076a2c3b9cf5..7b37d98011cfb8 100644 --- a/src/setup_node_env/setup_env.js +++ b/src/setup_node_env/setup_env.js @@ -11,8 +11,6 @@ require('./exit_on_warning'); require('./harden'); // The following require statements MUST be executed before any others - END -// @todo Remove when migrated to Node 20 (#162696) -require('./heap_snapshot'); require('symbol-observable'); require('source-map-support').install(); require('./node_version_validator'); diff --git a/x-pack/plugins/cases/server/saved_object_types/migrations/user_actions/connector_id.test.ts b/x-pack/plugins/cases/server/saved_object_types/migrations/user_actions/connector_id.test.ts index ed43cc40649c64..2ed37837f5100a 100644 --- a/x-pack/plugins/cases/server/saved_object_types/migrations/user_actions/connector_id.test.ts +++ b/x-pack/plugins/cases/server/saved_object_types/migrations/user_actions/connector_id.test.ts @@ -254,7 +254,7 @@ describe('user action migrations', () => { const log = context.log as jest.Mocked; expect(log.error.mock.calls[0]).toMatchInlineSnapshot(` Array [ - "Failed to migrate user action connector with doc id: 1 version: 8.0.0 error: Unexpected token a in JSON at position 1", + "Failed to migrate user action connector with doc id: 1 version: 8.0.0 error: Expected property name or '}' in JSON at position 1", Object { "migrations": Object { "userAction": Object { @@ -448,7 +448,7 @@ describe('user action migrations', () => { const log = context.log as jest.Mocked; expect(log.error.mock.calls[0]).toMatchInlineSnapshot(` Array [ - "Failed to migrate user action connector with doc id: 1 version: 8.0.0 error: Unexpected token b in JSON at position 1", + "Failed to migrate user action connector with doc id: 1 version: 8.0.0 error: Expected property name or '}' in JSON at position 1", Object { "migrations": Object { "userAction": Object { @@ -644,7 +644,7 @@ describe('user action migrations', () => { const log = context.log as jest.Mocked; expect(log.error.mock.calls[0]).toMatchInlineSnapshot(` Array [ - "Failed to migrate user action connector with doc id: 1 version: 8.0.0 error: Unexpected token e in JSON at position 1", + "Failed to migrate user action connector with doc id: 1 version: 8.0.0 error: Unexpected token 'e', \\"new json value\\" is not valid JSON", Object { "migrations": Object { "userAction": Object { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts index 3e39c50ff8de70..925f5af35ff48c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/document_creation/document_creation_logic.test.ts @@ -404,7 +404,7 @@ describe('DocumentCreationLogic', () => { DocumentCreationLogic.actions.onSubmitJson(); expect(DocumentCreationLogic.actions.setErrors).toHaveBeenCalledWith([ - 'Unexpected token i in JSON at position 0', + `Unexpected token 'i', "invalid JSON" is not valid JSON`, ]); expect(DocumentCreationLogic.actions.uploadDocuments).not.toHaveBeenCalled(); }); diff --git a/x-pack/plugins/screenshotting/server/browsers/download/fetch.test.ts b/x-pack/plugins/screenshotting/server/browsers/download/fetch.test.ts index cc22f152216afd..b32f98aeffe206 100644 --- a/x-pack/plugins/screenshotting/server/browsers/download/fetch.test.ts +++ b/x-pack/plugins/screenshotting/server/browsers/download/fetch.test.ts @@ -8,7 +8,7 @@ import mockFs from 'mock-fs'; import axios from 'axios'; import { createHash } from 'crypto'; -import { readFileSync } from 'fs'; +import { readFile } from 'fs/promises'; import { resolve as resolvePath } from 'path'; import { Readable } from 'stream'; import { fetch } from './fetch'; @@ -38,7 +38,7 @@ describe('fetch', () => { test('downloads the url to the path', async () => { await fetch('url', TEMP_FILE); - expect(readFileSync(TEMP_FILE, 'utf8')).toEqual('foobar'); + await expect(readFile(TEMP_FILE, 'utf8')).resolves.toBe('foobar'); }); test('returns the md5 hex hash of the http body', async () => { diff --git a/x-pack/plugins/screenshotting/server/browsers/download/fetch.ts b/x-pack/plugins/screenshotting/server/browsers/download/fetch.ts index ba3e083816937c..e248aad94c14e6 100644 --- a/x-pack/plugins/screenshotting/server/browsers/download/fetch.ts +++ b/x-pack/plugins/screenshotting/server/browsers/download/fetch.ts @@ -7,7 +7,8 @@ import Axios from 'axios'; import { createHash } from 'crypto'; -import { closeSync, mkdirSync, openSync, writeSync } from 'fs'; +import { mkdir, open } from 'fs/promises'; +import { writeSync } from 'fs'; import { dirname } from 'path'; import { finished, Readable } from 'stream'; import { promisify } from 'util'; @@ -21,9 +22,8 @@ export async function fetch(url: string, path: string, logger?: Logger): Promise const hash = createHash('md5'); - mkdirSync(dirname(path), { recursive: true }); - const handle = openSync(path, 'w'); - + await mkdir(dirname(path), { recursive: true }); + const handle = await open(path, 'w'); try { const response = await Axios.request({ url, @@ -32,7 +32,7 @@ export async function fetch(url: string, path: string, logger?: Logger): Promise }); response.data.on('data', (chunk: Buffer) => { - writeSync(handle, chunk); + writeSync(handle.fd, chunk); hash.update(chunk); }); @@ -43,7 +43,7 @@ export async function fetch(url: string, path: string, logger?: Logger): Promise throw new Error(`Unable to download ${url}: ${error}`); } finally { - closeSync(handle); + await handle.close(); } return hash.digest('hex'); diff --git a/x-pack/plugins/screenshotting/server/browsers/download/index.test.ts b/x-pack/plugins/screenshotting/server/browsers/download/index.test.ts index 887a631a2c1d71..8b8115c5a61642 100644 --- a/x-pack/plugins/screenshotting/server/browsers/download/index.test.ts +++ b/x-pack/plugins/screenshotting/server/browsers/download/index.test.ts @@ -7,7 +7,7 @@ import path from 'path'; import mockFs from 'mock-fs'; -import { existsSync, readdirSync } from 'fs'; +import { access, readdir } from 'fs/promises'; import { ChromiumArchivePaths, PackageInfo } from '../chromium'; import { fetch } from './fetch'; import { md5 } from './checksum'; @@ -55,8 +55,8 @@ describe('ensureDownloaded', () => { await download(paths, pkg); - expect(existsSync(unexpectedPath1)).toBe(false); - expect(existsSync(unexpectedPath2)).toBe(false); + await expect(access(unexpectedPath1)).rejects.toThrow(); + await expect(access(unexpectedPath2)).rejects.toThrow(); }); it('should reject when download fails', async () => { @@ -84,14 +84,14 @@ describe('ensureDownloaded', () => { await download(paths, pkg); expect(fetch).not.toHaveBeenCalled(); - expect(readdirSync(path.resolve(`${paths.archivesPath}/x64`))).toEqual( + await expect(readdir(path.resolve(`${paths.archivesPath}/x64`))).resolves.toEqual( expect.arrayContaining([ 'chrome-mac.zip', 'chrome-win.zip', expect.stringMatching(/^chromium-[0-9a-f]{7}-locales-linux_x64\.zip$/), ]) ); - expect(readdirSync(path.resolve(`${paths.archivesPath}/arm64`))).toEqual( + await expect(readdir(path.resolve(`${paths.archivesPath}/arm64`))).resolves.toEqual( expect.arrayContaining([ 'chrome-mac.zip', expect.stringMatching(/^chromium-[0-9a-f]{7}-locales-linux_arm64\.zip$/), diff --git a/x-pack/plugins/screenshotting/server/browsers/download/index.ts b/x-pack/plugins/screenshotting/server/browsers/download/index.ts index ff8de66df743a2..61b46ac84c588c 100644 --- a/x-pack/plugins/screenshotting/server/browsers/download/index.ts +++ b/x-pack/plugins/screenshotting/server/browsers/download/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { existsSync } from 'fs'; +import { access } from 'fs/promises'; import del from 'del'; import type { Logger } from '@kbn/core/server'; import type { ChromiumArchivePaths, PackageInfo } from '../chromium'; @@ -42,7 +42,13 @@ export async function download( const resolvedPath = paths.resolvePath(pkg); const foundChecksum = await md5(resolvedPath).catch(() => 'MISSING'); - const pathExists = existsSync(resolvedPath); + let pathExists = null; + try { + await access(resolvedPath); + pathExists = true; + } catch (e) { + pathExists = false; + } if (pathExists && foundChecksum === archiveChecksum) { logger?.debug( `Browser archive for ${pkg.platform}/${pkg.architecture} already found in ${resolvedPath} with matching checksum.` diff --git a/x-pack/plugins/screenshotting/server/browsers/extract/unzip.test.ts b/x-pack/plugins/screenshotting/server/browsers/extract/unzip.test.ts index 4af457a0c3a6e3..08eac21450f262 100644 --- a/x-pack/plugins/screenshotting/server/browsers/extract/unzip.test.ts +++ b/x-pack/plugins/screenshotting/server/browsers/extract/unzip.test.ts @@ -6,7 +6,7 @@ */ import mockFs from 'mock-fs'; -import { readFileSync } from 'fs'; +import { readFile } from 'fs/promises'; import { ExtractError } from './extract_error'; import { unzip } from './unzip'; @@ -28,7 +28,7 @@ describe('unzip', () => { it('should extract zipped contents', async () => { await unzip('/test.zip', '/output'); - expect(readFileSync('/output/test.txt').toString()).toEqual('test'); + await expect(readFile('/output/test.txt', 'utf8')).resolves.toBe('test'); }); it('should reject on invalid archive', async () => { diff --git a/x-pack/plugins/searchprofiler/public/application/lib/check_for_json_errors.test.ts b/x-pack/plugins/searchprofiler/public/application/lib/check_for_json_errors.test.ts index ccd8761c031b23..606b302fc85594 100644 --- a/x-pack/plugins/searchprofiler/public/application/lib/check_for_json_errors.test.ts +++ b/x-pack/plugins/searchprofiler/public/application/lib/check_for_json_errors.test.ts @@ -12,7 +12,7 @@ describe('checkForParseErrors', function () { it('returns error from bad JSON', function () { const json = '{"foo": {"bar": {"baz": "buzz}}}'; const result = checkForParseErrors(json); - expect(result.error.message).to.be(`Unexpected end of JSON input`); + expect(result.error.message).to.be(`Unterminated string in JSON at position 32`); }); it('returns parsed value from good JSON', function () { diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/api/rules/import_rules/route.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/api/rules/import_rules/route.test.ts index f383a9d11cc00a..da4f9e67d7b8f1 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/api/rules/import_rules/route.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/api/rules/import_rules/route.test.ts @@ -167,7 +167,7 @@ describe('Import rules route', () => { errors: [ { error: { - message: 'Unexpected token h in JSON at position 1', + message: `Unexpected token 'h', "this is not"... is not valid JSON`, status_code: 400, }, rule_id: '(unknown id)', diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/import/create_rules_stream_from_ndjson.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/import/create_rules_stream_from_ndjson.test.ts index be9561598fd084..50b8d5e7ee6fc9 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/import/create_rules_stream_from_ndjson.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_management/logic/import/create_rules_stream_from_ndjson.test.ts @@ -234,7 +234,9 @@ describe('create_rules_stream_from_ndjson', () => { type: 'query', immutable: false, }); - expect(resultOrError[1].message).toEqual('Unexpected token , in JSON at position 1'); + expect(resultOrError[1].message).toEqual( + `Expected property name or '}' in JSON at position 1` + ); expect(resultOrError[2]).toEqual({ rule_id: 'rule-2', output_index: '.siem-signals', diff --git a/x-pack/plugins/task_manager/server/saved_objects/migrations.test.ts b/x-pack/plugins/task_manager/server/saved_objects/migrations.test.ts index 081918673d82af..794a9c466906ff 100644 --- a/x-pack/plugins/task_manager/server/saved_objects/migrations.test.ts +++ b/x-pack/plugins/task_manager/server/saved_objects/migrations.test.ts @@ -282,7 +282,7 @@ describe('handles errors during migrations', () => { migration800(taskInstance, migrationContext); }).toThrowError(); expect(migrationContext.log.error).toHaveBeenCalledWith( - `savedObject 8.0.0 migration failed for task instance ${taskInstance.id} with error: Unexpected token s in JSON at position 2`, + `savedObject 8.0.0 migration failed for task instance ${taskInstance.id} with error: Expected property name or '}' in JSON at position 2`, { migrations: { taskInstanceDocument: { diff --git a/yarn.lock b/yarn.lock index 6eba5c6fe3da0d..90e6922bb199d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9553,10 +9553,12 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@18.18.5", "@types/node@>= 8", "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@>=8.9.0", "@types/node@^10.1.0", "@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0", "@types/node@^18.11.18", "@types/node@^18.17.5": - version "18.18.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.18.5.tgz#afc0fd975df946d6e1add5bbf98264225b212244" - integrity sha512-4slmbtwV59ZxitY4ixUZdy1uRLf9eSIvBWPQxNjhHYWEtn0FryfKpyS2cvADYXTayWdKEIsJengncrVvkI4I6A== +"@types/node@*", "@types/node@20.9.0", "@types/node@>= 8", "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@>=8.9.0", "@types/node@^10.1.0", "@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0", "@types/node@^18.11.18", "@types/node@^18.17.5": + version "20.9.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298" + integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw== + dependencies: + undici-types "~5.26.4" "@types/nodemailer@^6.4.0": version "6.4.0" @@ -29388,6 +29390,11 @@ unc-path-regex@^0.1.2: resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" integrity sha1-5z3T17DXxe2G+6xrCufYxqadUPo= +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + undici@^5.21.2, undici@^5.22.1: version "5.26.3" resolved "https://registry.yarnpkg.com/undici/-/undici-5.26.3.tgz#ab3527b3d5bb25b12f898dfd22165d472dd71b79" From a49cdff0c091027e7486afbbe7af8792d9fa9355 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 23 Nov 2023 22:08:16 +0000 Subject: [PATCH 02/15] chore(NA): use node v20.10.0 instead --- .ci/Dockerfile | 2 +- .node-version | 2 +- .nvmrc | 2 +- WORKSPACE.bazel | 10 +++++----- package.json | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.ci/Dockerfile b/.ci/Dockerfile index 91e0d5bf36a9d5..1bc561ba65a601 100644 --- a/.ci/Dockerfile +++ b/.ci/Dockerfile @@ -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=20.9.0 +ARG NODE_VERSION=20.10.0 FROM node:${NODE_VERSION} AS base diff --git a/.node-version b/.node-version index f3f52b42d3da97..d5a159609d095a 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -20.9.0 +20.10.0 diff --git a/.nvmrc b/.nvmrc index f3f52b42d3da97..d5a159609d095a 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -20.9.0 +20.10.0 diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 38802ebef5b1d8..af8425ab7395af 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -22,11 +22,11 @@ load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install # Setup the Node.js toolchain for the architectures we want to support node_repositories( node_repositories = { - "20.9.0-darwin_amd64": ("node-v20.9.0-darwin-x64.tar.gz", "node-v20.9.0-darwin-x64", "fc5b73f2a78c17bbe926cdb1447d652f9f094c79582f1be6471b4b38a2e1ccc8"), - "20.9.0-darwin_arm64": ("node-v20.9.0-darwin-arm64.tar.gz", "node-v20.9.0-darwin-arm64", "31d2d46ae8d8a3982f54e2ff1e60c2e4a8e80bf78a3e8b46dcaac95ac5d7ce6a"), - "20.9.0-linux_arm64": ("node-v20.9.0-linux-arm64.tar.xz", "node-v20.9.0-linux-arm64", "79c07c41c9f2410e35fd8dec61491ba63762e428bffa2ee0ff3aec1afe05d4b1"), - "20.9.0-linux_amd64": ("node-v20.9.0-linux-x64.tar.xz", "node-v20.9.0-linux-x64", "d11a5e06d6fda8d0cb1a759365d2b5e33c609f3c9f333fdc63e0522475dc0c89"), - "20.9.0-windows_amd64": ("node-v20.9.0-win-x64.zip", "node-v20.9.0-win-x64", "70d87dad2378c63216ff83d5a754c61d2886fc39d32ce0d2ea6de763a22d3780"), + "20.10.0-darwin_amd64": ("node-v20.10.0-darwin-x64.tar.gz", "node-v20.10.0-darwin-x64", "5ff5e8abd3eea6e5f507eb6677554f5b2188eedef654096aa4168a9941e91a32"), + "20.10.0-darwin_arm64": ("node-v20.10.0-darwin-arm64.tar.gz", "node-v20.10.0-darwin-arm64", "68b93099451d77aac116cf8fce179cabcf53fec079508dc6b39d3a086fb461a8"), + "20.10.0-linux_arm64": ("node-v20.10.0-linux-arm64.tar.xz", "node-v20.10.0-linux-arm64", "21f19d1f9d2345c5a4ed416c21d89cec20fe4b0715255d49463a4d37e283b4c6"), + "20.10.0-linux_amd64": ("node-v20.10.0-linux-x64.tar.xz", "node-v20.10.0-linux-x64", "3fe4ec5d70c8b4ffc1461dec83ab23fc70124e137c4cbbe1ccc9d6ae6ec04a7d"), + "20.10.0-windows_amd64": ("node-v20.10.0-win-x64.zip", "node-v20.10.0-win-x64", "e5b861814a97e28ae7ac06a34e88fd5e0565b447d270c26e20b5ef60bf0aaaf9"), }, node_version = "20.9.0", node_urls = [ diff --git a/package.json b/package.json index b3e625d1dafe16..dfc43424b89911 100644 --- a/package.json +++ b/package.json @@ -74,12 +74,12 @@ "url": "https://github.com/elastic/kibana.git" }, "engines": { - "node": "20.9.0", + "node": "20.10.0", "yarn": "^1.22.19" }, "resolutions": { "**/@hello-pangea/dnd": "16.2.0", - "**/@types/node": "20.9.0", + "**/@types/node": "20.10.0", "**/@typescript-eslint/utils": "5.62.0", "**/chokidar": "^3.5.3", "**/globule/minimatch": "^3.1.2", @@ -1380,7 +1380,7 @@ "@types/multistream": "^4.1.0", "@types/mustache": "^0.8.31", "@types/nock": "^10.0.3", - "@types/node": "20.9.0", + "@types/node": "20.10.0", "@types/node-fetch": "2.6.4", "@types/node-forge": "^1.3.1", "@types/nodemailer": "^6.4.0", From 60860eca6ec32b6ae10e9e0608803bd69c9a0bff Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 23 Nov 2023 22:09:41 +0000 Subject: [PATCH 03/15] chore(NA): use node v20.10.0 instead --- WORKSPACE.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index af8425ab7395af..4e2e4ae49c6724 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -28,7 +28,7 @@ node_repositories( "20.10.0-linux_amd64": ("node-v20.10.0-linux-x64.tar.xz", "node-v20.10.0-linux-x64", "3fe4ec5d70c8b4ffc1461dec83ab23fc70124e137c4cbbe1ccc9d6ae6ec04a7d"), "20.10.0-windows_amd64": ("node-v20.10.0-win-x64.zip", "node-v20.10.0-win-x64", "e5b861814a97e28ae7ac06a34e88fd5e0565b447d270c26e20b5ef60bf0aaaf9"), }, - node_version = "20.9.0", + node_version = "20.10.0", node_urls = [ "https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v{version}/{filename}", ], From 1809b4280cd930e6efc58ed13baf43a0da07be0f Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 24 Nov 2023 00:13:58 +0000 Subject: [PATCH 04/15] chore(NA): use node v20.10.0 instead --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dfc43424b89911..77d977b2ab34a5 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ }, "resolutions": { "**/@hello-pangea/dnd": "16.2.0", - "**/@types/node": "20.10.0", + "**/@types/node": "20.9.5", "**/@typescript-eslint/utils": "5.62.0", "**/chokidar": "^3.5.3", "**/globule/minimatch": "^3.1.2", @@ -1380,7 +1380,7 @@ "@types/multistream": "^4.1.0", "@types/mustache": "^0.8.31", "@types/nock": "^10.0.3", - "@types/node": "20.10.0", + "@types/node": "20.9.5", "@types/node-fetch": "2.6.4", "@types/node-forge": "^1.3.1", "@types/nodemailer": "^6.4.0", From 60a36acc8a735043571c1965ed08c555713c360a Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Sat, 16 Dec 2023 03:05:48 +0000 Subject: [PATCH 05/15] chore(NA): replace node version --- WORKSPACE.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 4e2e4ae49c6724..8f47561585fd0d 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -25,7 +25,7 @@ node_repositories( "20.10.0-darwin_amd64": ("node-v20.10.0-darwin-x64.tar.gz", "node-v20.10.0-darwin-x64", "5ff5e8abd3eea6e5f507eb6677554f5b2188eedef654096aa4168a9941e91a32"), "20.10.0-darwin_arm64": ("node-v20.10.0-darwin-arm64.tar.gz", "node-v20.10.0-darwin-arm64", "68b93099451d77aac116cf8fce179cabcf53fec079508dc6b39d3a086fb461a8"), "20.10.0-linux_arm64": ("node-v20.10.0-linux-arm64.tar.xz", "node-v20.10.0-linux-arm64", "21f19d1f9d2345c5a4ed416c21d89cec20fe4b0715255d49463a4d37e283b4c6"), - "20.10.0-linux_amd64": ("node-v20.10.0-linux-x64.tar.xz", "node-v20.10.0-linux-x64", "3fe4ec5d70c8b4ffc1461dec83ab23fc70124e137c4cbbe1ccc9d6ae6ec04a7d"), + "20.10.0-linux_amd64": ("node-v20.10.0-linux-x64.tar.xz", "node-v20.10.0-linux-x64", "9c0fbc8cc7be9a6543af4b9afb05759c538c0f81015c388d63277b0158507697"), "20.10.0-windows_amd64": ("node-v20.10.0-win-x64.zip", "node-v20.10.0-win-x64", "e5b861814a97e28ae7ac06a34e88fd5e0565b447d270c26e20b5ef60bf0aaaf9"), }, node_version = "20.10.0", From 627af3a175644a4ecd26aca7fe354a448533f5fd Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Sat, 16 Dec 2023 03:56:17 +0000 Subject: [PATCH 06/15] chore(NA): update yarn lock file --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 50134a162662d9..25850f1b151554 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9651,10 +9651,10 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@20.9.0", "@types/node@>= 8", "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@>=8.9.0", "@types/node@^10.1.0", "@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0", "@types/node@^18.11.18", "@types/node@^18.17.5": - version "20.9.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298" - integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw== +"@types/node@*", "@types/node@20.9.5", "@types/node@>= 8", "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@>=8.9.0", "@types/node@^10.1.0", "@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0", "@types/node@^18.11.18", "@types/node@^18.17.5": + version "20.9.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.5.tgz#bb441014bcb91c63742b0e1fe25b902f5d581faa" + integrity sha512-Uq2xbNq0chGg+/WQEU0LJTSs/1nKxz6u1iemLcGomkSnKokbW1fbLqc3HOqCf2JP7KjlL4QkS7oZZTrOQHQYgQ== dependencies: undici-types "~5.26.4" From ac80fa9910f3b0826f5ef0c49ad86d7e8b58a605 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Mon, 18 Dec 2023 04:40:19 +0000 Subject: [PATCH 07/15] chore(NA): update re2 builds bundled into the distributable --- src/dev/build/tasks/patch_native_modules_task.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/dev/build/tasks/patch_native_modules_task.ts b/src/dev/build/tasks/patch_native_modules_task.ts index d36fe4eca01ee1..e83dd51d6e0c42 100644 --- a/src/dev/build/tasks/patch_native_modules_task.ts +++ b/src/dev/build/tasks/patch_native_modules_task.ts @@ -47,8 +47,8 @@ const packages: Package[] = [ extractMethod: 'gunzip', archives: { 'linux-x64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.9/linux-x64-108.gz', - sha256: '136b6cf61b54bf610071a950400518add65d44a4923f11ef658769df1a037f0b', + url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.9/linux-x64-115.gz', + sha256: 'b88183fe7bc8afa260d22cd909f496ab5636aace7075b54ac345d33ea32aedc0', }, // Linux ARM builds are currently done manually as Github Actions used in upstream project // do not natively support an Linux ARM target. @@ -63,19 +63,19 @@ const packages: Package[] = [ // * capture the sha256 with: `shasum -a 256 linux-arm64-*` // * upload the `linux-arm64-*.gz` artifact to the `yarn-prebuilt-artifacts` bucket in GCS using the correct version number 'linux-arm64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.9/linux-arm64-108.gz', - sha256: '311822ac689bd49a534ecf400b4732a288ad218f711b0e593e41dd3a6b739d97', + url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.9/linux-arm64-115.gz', + sha256: '6c04136a6658df3dcc5b8ac0041641c227d232bed385fe55f62c8470f8db041d', }, 'darwin-x64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.9/darwin-x64-108.gz', + url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.9/darwin-x64-115.gz', sha256: '215b6ffb1e5d124439a7dbdd09e4ed1263e065839354a6ad67091ce00d14ee9b', }, 'darwin-arm64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.9/darwin-arm64-108.gz', + url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.9/darwin-arm64-115.gz', sha256: '0a8bc28150c9efd04f3b52ac214cc7898bde1b8e1f8e6900ae711b03665ff657', }, 'win32-x64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.9/win32-x64-108.gz', + url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.9/win32-x64-115.gz', sha256: '117872144e4a2bb61611aacc51ac9fd24e494c209cf63366f236099a662316eb', }, }, From cc78d150bc9bcd9cf8b0dd16181471ad2a1da80f Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 19 Dec 2023 04:03:40 +0000 Subject: [PATCH 08/15] test(NA): add waitFor on artifact_entries_list ftr test --- .../apps/integrations/artifact_entries_list.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts b/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts index 802cbf8be16fc8..d2840011a59d04 100644 --- a/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts +++ b/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts @@ -237,9 +237,10 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await createArtifact(testData, { policyId: policyInfo.packagePolicy.id }); // Check new artifact is in the list for (const checkResult of testData.create.checkResults) { - expect(await testSubjects.getVisibleText(checkResult.selector)).to.equal( - checkResult.value - ); + await retry.waitForWithTimeout('entry is added in list', 10000, async () => { + const currentValue = await testSubjects.getVisibleText(checkResult.selector); + return currentValue === checkResult.value; + }); } await pageObjects.common.closeToast(); From 3db1c03ec4297e8b0b150a46264cb3e571e7e9cd Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 19 Dec 2023 05:02:43 +0000 Subject: [PATCH 09/15] test(NA): add waitFor on artifact_entries_list ftr test --- .../apps/integrations/artifact_entries_list.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts b/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts index d2840011a59d04..366e91db92ae70 100644 --- a/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts +++ b/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts @@ -73,7 +73,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { ) => { // Check edited artifact is in the list with new values (wait for list to be updated) let updatedArtifact: ArtifactElasticsearchProperties | undefined; - await retry.waitForWithTimeout('fleet artifact is updated', 120_000, async () => { + await retry.waitForWithTimeout('fleet artifact is updated', 200_000, async () => { const artifacts = await endpointArtifactsTestResources.getArtifacts(); const manifestArtifact = artifacts.find((artifact) => { From b4536cbfb385c9d7253c1b9da14ca1f63fdcd835 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 19 Dec 2023 17:13:06 +0000 Subject: [PATCH 10/15] Revert "test(NA): add waitFor on artifact_entries_list ftr test" This reverts commit 3db1c03ec4297e8b0b150a46264cb3e571e7e9cd. --- .../apps/integrations/artifact_entries_list.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts b/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts index 366e91db92ae70..d2840011a59d04 100644 --- a/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts +++ b/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts @@ -73,7 +73,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { ) => { // Check edited artifact is in the list with new values (wait for list to be updated) let updatedArtifact: ArtifactElasticsearchProperties | undefined; - await retry.waitForWithTimeout('fleet artifact is updated', 200_000, async () => { + await retry.waitForWithTimeout('fleet artifact is updated', 120_000, async () => { const artifacts = await endpointArtifactsTestResources.getArtifacts(); const manifestArtifact = artifacts.find((artifact) => { From b06e0a096cca53bbe05a242d574e941bd1b9f83f Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 19 Dec 2023 17:13:15 +0000 Subject: [PATCH 11/15] Revert "test(NA): add waitFor on artifact_entries_list ftr test" This reverts commit cc78d150bc9bcd9cf8b0dd16181471ad2a1da80f. --- .../apps/integrations/artifact_entries_list.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts b/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts index d2840011a59d04..802cbf8be16fc8 100644 --- a/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts +++ b/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts @@ -237,10 +237,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await createArtifact(testData, { policyId: policyInfo.packagePolicy.id }); // Check new artifact is in the list for (const checkResult of testData.create.checkResults) { - await retry.waitForWithTimeout('entry is added in list', 10000, async () => { - const currentValue = await testSubjects.getVisibleText(checkResult.selector); - return currentValue === checkResult.value; - }); + expect(await testSubjects.getVisibleText(checkResult.selector)).to.equal( + checkResult.value + ); } await pageObjects.common.closeToast(); From 6273984c01a59feb03e457a3265a7199d7cb3a15 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 21 Dec 2023 03:41:27 +0000 Subject: [PATCH 12/15] chore(NA): update shasum on patch native modules task --- src/dev/build/tasks/patch_native_modules_task.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dev/build/tasks/patch_native_modules_task.ts b/src/dev/build/tasks/patch_native_modules_task.ts index e83dd51d6e0c42..df851036b79ed5 100644 --- a/src/dev/build/tasks/patch_native_modules_task.ts +++ b/src/dev/build/tasks/patch_native_modules_task.ts @@ -68,15 +68,15 @@ const packages: Package[] = [ }, 'darwin-x64': { url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.9/darwin-x64-115.gz', - sha256: '215b6ffb1e5d124439a7dbdd09e4ed1263e065839354a6ad67091ce00d14ee9b', + sha256: '1e0d79983c94222c414a5410444ec0ccf37614fd0e45187d0f313a19b203702c', }, 'darwin-arm64': { url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.9/darwin-arm64-115.gz', - sha256: '0a8bc28150c9efd04f3b52ac214cc7898bde1b8e1f8e6900ae711b03665ff657', + sha256: '192c8e036062504b818941989c44ddb799efe0419d039f7089caedb09d49a597', }, 'win32-x64': { url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.20.9/win32-x64-115.gz', - sha256: '117872144e4a2bb61611aacc51ac9fd24e494c209cf63366f236099a662316eb', + sha256: '01ae2df89f976f4097e50e121d7ec6ac62ec8050c838107dcfb976d037a60d59', }, }, }, From 35a17e4c66ef8275d4beabf279f4da8f44ff721e Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 07:52:40 -0600 Subject: [PATCH 13/15] fix conflict --- .ci/Dockerfile | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 .ci/Dockerfile diff --git a/.ci/Dockerfile b/.ci/Dockerfile deleted file mode 100644 index 1bc561ba65a601..00000000000000 --- a/.ci/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -# 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=20.10.0 - -FROM node:${NODE_VERSION} AS base - -RUN apt-get update && \ - apt-get -y install xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \ - libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \ - libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \ - libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \ - libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget openjdk-11-jre && \ - rm -rf /var/lib/apt/lists/* - -RUN curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \ - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ - && apt-get update \ - && apt-get install -y rsync jq bsdtar google-chrome-stable \ - --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -RUN LATEST_VAULT_RELEASE=$(curl -s https://api.github.com/repos/hashicorp/vault/tags | jq --raw-output .[0].name[1:]) \ - && curl -L https://releases.hashicorp.com/vault/${LATEST_VAULT_RELEASE}/vault_${LATEST_VAULT_RELEASE}_linux_amd64.zip -o vault.zip \ - && unzip vault.zip \ - && rm vault.zip \ - && chmod +x vault \ - && mv vault /usr/local/bin/vault - -RUN groupadd -r kibana && useradd -r -g kibana kibana && mkdir /home/kibana && chown kibana:kibana /home/kibana - -COPY ./bash_standard_lib.sh /usr/local/bin/bash_standard_lib.sh -RUN chmod +x /usr/local/bin/bash_standard_lib.sh - -COPY ./runbld /usr/local/bin/runbld -RUN chmod +x /usr/local/bin/runbld - -USER kibana From 9cb79703953c9f20ecb12353b4fd004a3de9ae3f Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 08:01:52 -0600 Subject: [PATCH 14/15] fix arm checksum --- WORKSPACE.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 8f47561585fd0d..932d5c0ff50608 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -24,7 +24,7 @@ node_repositories( node_repositories = { "20.10.0-darwin_amd64": ("node-v20.10.0-darwin-x64.tar.gz", "node-v20.10.0-darwin-x64", "5ff5e8abd3eea6e5f507eb6677554f5b2188eedef654096aa4168a9941e91a32"), "20.10.0-darwin_arm64": ("node-v20.10.0-darwin-arm64.tar.gz", "node-v20.10.0-darwin-arm64", "68b93099451d77aac116cf8fce179cabcf53fec079508dc6b39d3a086fb461a8"), - "20.10.0-linux_arm64": ("node-v20.10.0-linux-arm64.tar.xz", "node-v20.10.0-linux-arm64", "21f19d1f9d2345c5a4ed416c21d89cec20fe4b0715255d49463a4d37e283b4c6"), + "20.10.0-linux_arm64": ("node-v20.10.0-linux-arm64.tar.xz", "node-v20.10.0-linux-arm64", "a5c22683890d5d244f3afd488ef44e573b5b8287f8911b9a1b061ed3f20a5e6d"), "20.10.0-linux_amd64": ("node-v20.10.0-linux-x64.tar.xz", "node-v20.10.0-linux-x64", "9c0fbc8cc7be9a6543af4b9afb05759c538c0f81015c388d63277b0158507697"), "20.10.0-windows_amd64": ("node-v20.10.0-win-x64.zip", "node-v20.10.0-win-x64", "e5b861814a97e28ae7ac06a34e88fd5e0565b447d270c26e20b5ef60bf0aaaf9"), }, From 54fcc9ff0e8b098651c6ca79c4408410026e6034 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 26 Dec 2023 08:03:42 -0600 Subject: [PATCH 15/15] update types --- package.json | 4 ++-- yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index ebde731118c067..cc98643533661d 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ }, "resolutions": { "**/@hello-pangea/dnd": "16.2.0", - "**/@types/node": "20.9.5", + "**/@types/node": "20.10.5", "**/@typescript-eslint/utils": "5.62.0", "**/chokidar": "^3.5.3", "**/globule/minimatch": "^3.1.2", @@ -1412,7 +1412,7 @@ "@types/multistream": "^4.1.0", "@types/mustache": "^0.8.31", "@types/nock": "^10.0.3", - "@types/node": "20.9.5", + "@types/node": "20.10.5", "@types/node-fetch": "2.6.4", "@types/node-forge": "^1.3.10", "@types/nodemailer": "^6.4.0", diff --git a/yarn.lock b/yarn.lock index b9e6616d95fa0e..e316b9b4f7d020 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9670,10 +9670,10 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@20.9.5", "@types/node@>= 8", "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@>=8.9.0", "@types/node@^10.1.0", "@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0", "@types/node@^18.11.18", "@types/node@^18.17.5": - version "20.9.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.5.tgz#bb441014bcb91c63742b0e1fe25b902f5d581faa" - integrity sha512-Uq2xbNq0chGg+/WQEU0LJTSs/1nKxz6u1iemLcGomkSnKokbW1fbLqc3HOqCf2JP7KjlL4QkS7oZZTrOQHQYgQ== +"@types/node@*", "@types/node@20.10.5", "@types/node@>= 8", "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@>=8.9.0", "@types/node@^10.1.0", "@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0", "@types/node@^18.11.18", "@types/node@^18.17.5": + version "20.10.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.10.5.tgz#47ad460b514096b7ed63a1dae26fad0914ed3ab2" + integrity sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw== dependencies: undici-types "~5.26.4"