From 04c329894e3499c75bee24d8fecc99699f5a5a72 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 26 Oct 2022 12:01:35 +0200 Subject: [PATCH 01/17] Upgrade Node.js from v16.18.1 to v18.13.0 --- .ci/Dockerfile | 2 +- .node-version | 2 +- .nvmrc | 2 +- WORKSPACE.bazel | 12 ++++++------ package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.ci/Dockerfile b/.ci/Dockerfile index 88966aa5062ac..4f5236c733bc3 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=16.18.1 +ARG NODE_VERSION=18.13.0 FROM node:${NODE_VERSION} AS base diff --git a/.node-version b/.node-version index 5397c87fabfd3..d939939b25962 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -16.18.1 +18.13.0 diff --git a/.nvmrc b/.nvmrc index 5397c87fabfd3..d939939b25962 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.18.1 +18.13.0 diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 0a7f9596abdd8..2e0916692591a 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 = { - "16.18.1-darwin_amd64": ("node-v16.18.1-darwin-x64.tar.gz", "node-v16.18.1-darwin-x64", "c190e106d4ac6177d1db3a5a739d39dd68bd276ba17f3d3c84039a93717e081e"), - "16.18.1-darwin_arm64": ("node-v16.18.1-darwin-arm64.tar.gz", "node-v16.18.1-darwin-arm64", "71720bb0a80cf158d8fdf492def08048befd953ad45e2458b1d095e32c612ba7"), - "16.18.1-linux_arm64": ("node-v16.18.1-linux-arm64.tar.xz", "node-v16.18.1-linux-arm64", "98d81a2d08f88646541d282b7ccc32429f8706ddcb30943fc3779ef9674ebb93"), - "16.18.1-linux_amd64": ("node-v16.18.1-linux-x64.tar.xz", "node-v16.18.1-linux-x64", "de2c694e7081c37022817d27a65b02f69ecf4c49699d65585e8e24431b7bc920"), - "16.18.1-windows_amd64": ("node-v16.18.1-win-x64.zip", "node-v16.18.1-win-x64", "db6a81de8e8ca3444495f1bcf04a883c076b4325d0fbaa032a190f88b38b30c5"), + "18.13.0-darwin_amd64": ("node-v18.13.0-darwin-x64.tar.gz", "node-v18.13.0-darwin-x64", "8b57c4da4ff6cca19d5ef7953f8816e3406d1508a2e4ee7f997984b3b1d11b77"), + "18.13.0-darwin_arm64": ("node-v18.13.0-darwin-arm64.tar.gz", "node-v18.13.0-darwin-arm64", "418d535e64dbcbd628715180c2de4ffcecb8a84b81f233c60e6ab9f0d795c249"), + "18.13.0-linux_arm64": ("node-v18.13.0-linux-arm64.tar.xz", "node-v18.13.0-linux-arm64", "5b338667822341d1ea3b18d5b37d442a655829b9eafdc5f9008f00b8451ac148"), + "18.13.0-linux_amd64": ("node-v18.13.0-linux-x64.tar.xz", "node-v18.13.0-linux-x64", "7f5d6922a91986ef059ba8a4396aa435440adacfe6fc6fab60a857c8f2cf5e7a"), + "18.13.0-windows_amd64": ("node-v18.13.0-win-x64.zip", "node-v18.13.0-win-x64", "29c99ad1167ddbd72f2b15e91b560e36ac785b1873ba6791ab50d9d62f1957e2"), }, - node_version = "16.18.1", + node_version = "18.13.0", node_urls = [ "https://nodejs.org/dist/v{version}/{filename}", ], diff --git a/package.json b/package.json index ad4230c99f9ae..63d7d78391d03 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "url": "https://github.com/elastic/kibana.git" }, "engines": { - "node": "16.18.1", + "node": "18.13.0", "yarn": "^1.22.19" }, "resolutions": { From d9ccb6cc49a9061849b1032c338f3f507a57b2db Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 26 Oct 2022 14:40:18 +0200 Subject: [PATCH 02/17] Upgrade @types/node v16.11.41 to v18.11.18 --- package.json | 4 ++-- yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 63d7d78391d03..146daee7707da 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "yarn": "^1.22.19" }, "resolutions": { - "**/@types/node": "16.11.41", + "**/@types/node": "18.11.18", "**/chokidar": "^3.5.3", "**/deepmerge": "^4.2.2", "**/fast-deep-equal": "^3.1.1", @@ -931,7 +931,7 @@ "@types/multistream": "^4.1.0", "@types/mustache": "^0.8.31", "@types/nock": "^10.0.3", - "@types/node": "16.11.41", + "@types/node": "18.11.18", "@types/node-fetch": "^2.6.0", "@types/node-forge": "^1.3.1", "@types/nodemailer": "^6.4.0", diff --git a/yarn.lock b/yarn.lock index df194baa6095c..64980dedca30f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7384,10 +7384,10 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@16.11.41", "@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@^14.14.31": - version "16.11.41" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.41.tgz#88eb485b1bfdb4c224d878b7832239536aa2f813" - integrity sha512-mqoYK2TnVjdkGk8qXAVGc/x9nSaTpSrFaGFm43BUH3IdoBV0nta6hYaGmdOvIMlbHJbUEVen3gvwpwovAZKNdQ== +"@types/node@*", "@types/node@18.11.18", "@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@^14.14.31": + version "18.11.18" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.18.tgz#8dfb97f0da23c2293e554c5a50d61ef134d7697f" + integrity sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA== "@types/nodemailer@^6.4.0": version "6.4.0" From 0beb3acaa455e466fdd6ece0ae7274cd5aaa8e4f Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 26 Oct 2022 13:46:13 +0200 Subject: [PATCH 03/17] Upgrade source-map v0.7.3 to v0.7.4 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 146daee7707da..187e39ac9506a 100644 --- a/package.json +++ b/package.json @@ -1154,7 +1154,7 @@ "simple-git": "^3.15.1", "sinon": "^7.4.2", "sort-package-json": "^1.53.1", - "source-map": "^0.7.3", + "source-map": "^0.7.4", "string-replace-loader": "^2.2.0", "style-loader": "^1.1.3", "stylelint": "^14.9.1", diff --git a/yarn.lock b/yarn.lock index 64980dedca30f..f62b908168bb3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -25051,10 +25051,10 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@^0.7.3: - version "0.7.3" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== +source-map@^0.7.3, source-map@^0.7.4: + version "0.7.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" + integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== source-map@^0.8.0-beta.0: version "0.8.0-beta.0" From 283887dca43d5f09bf1d8f0fea37b74b27f78431 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 26 Oct 2022 14:32:20 +0200 Subject: [PATCH 04/17] Fix webpack builds for Node.js 17+ For certain webpack builds we need to use the `--openssl-legacy-provider` flag for Node.js because webpack@4 isn't fully compatibule with Node.js 18. This has been fixed in webpack@5, so once we upgrade to that we can revert this commit. For more info see: https://github.com/webpack/webpack/issues/14532 --- packages/kbn-monaco/BUILD.bazel | 2 ++ packages/kbn-ui-shared-deps-npm/BUILD.bazel | 2 ++ packages/kbn-ui-shared-deps-src/BUILD.bazel | 2 ++ 3 files changed, 6 insertions(+) diff --git a/packages/kbn-monaco/BUILD.bazel b/packages/kbn-monaco/BUILD.bazel index 8d13702e74588..2ca10b073fd18 100644 --- a/packages/kbn-monaco/BUILD.bazel +++ b/packages/kbn-monaco/BUILD.bazel @@ -56,9 +56,11 @@ webpack_cli( env = select({ "//:dist": { "NODE_ENV": "production", + "NODE_OPTIONS": "--openssl-legacy-provider", }, "//conditions:default": { "NODE_ENV": "development", + "NODE_OPTIONS": "--openssl-legacy-provider", }, }), visibility = ["//visibility:public"], diff --git a/packages/kbn-ui-shared-deps-npm/BUILD.bazel b/packages/kbn-ui-shared-deps-npm/BUILD.bazel index 2b49f1e5a92f1..a45f183ff80ef 100644 --- a/packages/kbn-ui-shared-deps-npm/BUILD.bazel +++ b/packages/kbn-ui-shared-deps-npm/BUILD.bazel @@ -83,9 +83,11 @@ webpack_cli( env = select({ "//:dist": { "NODE_ENV": "production", + "NODE_OPTIONS": "--openssl-legacy-provider", }, "//conditions:default": { "NODE_ENV": "development", + "NODE_OPTIONS": "--openssl-legacy-provider", }, }) ) diff --git a/packages/kbn-ui-shared-deps-src/BUILD.bazel b/packages/kbn-ui-shared-deps-src/BUILD.bazel index 0b350c51331ff..49c2cc62dcfe5 100644 --- a/packages/kbn-ui-shared-deps-src/BUILD.bazel +++ b/packages/kbn-ui-shared-deps-src/BUILD.bazel @@ -45,9 +45,11 @@ webpack_cli( env = select({ "//:dist": { "NODE_ENV": "production", + "NODE_OPTIONS": "--openssl-legacy-provider", }, "//conditions:default": { "NODE_ENV": "development", + "NODE_OPTIONS": "--openssl-legacy-provider", }, }), visibility = ["//visibility:public"], From b5aeb71efe5764da2040187a1c585c43e661d0c5 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 26 Oct 2022 14:40:35 +0200 Subject: [PATCH 05/17] Improve upgrading-nodejs documentation --- docs/developer/advanced/upgrading-nodejs.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/developer/advanced/upgrading-nodejs.asciidoc b/docs/developer/advanced/upgrading-nodejs.asciidoc index 348a43c0595ff..16e8502450c17 100644 --- a/docs/developer/advanced/upgrading-nodejs.asciidoc +++ b/docs/developer/advanced/upgrading-nodejs.asciidoc @@ -13,11 +13,11 @@ These files must be updated when upgrading Node.js: If they are not, and the update is urgent, you can skip this file and update it later once Docker Hub has been updated. - {kib-repo}blob/{branch}/.node-version[`.node-version`] - {kib-repo}blob/{branch}/.nvmrc[`.nvmrc`] - - {kib-repo}blob/{branch}/package.json[`package.json`] - The version is specified in the `engines.node` field. + - {kib-repo}blob/{branch}/package.json[`package.json`] - The version is specified in the `engines.node` field (if possible, also upgrade `@types/node` to match the new version, both under `devDependencies` and `resolutions`). - {kib-repo}blob/{branch}/WORKSPACE.bazel[`WORKSPACE.bazel`] - The version is specified in the `node_version` property. Besides this property, the list of files under `node_repositories` must be updated along with their respective SHA256 hashes. These can be found on the https://nodejs.org[nodejs.org] website. - Example for Node.js v16.18.1: https://nodejs.org/dist/v16.18.1/SHASUMS256.txt.asc + Example for Node.js v18.13.0: https://nodejs.org/dist/v18.13.0/SHASUMS256.txt.asc See PR {kib-repo}pull/128123[#128123] for an example of how the Node.js version has been upgraded previously. From 64341f59de7778f537a8348e2d5d38af559f32f1 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 26 Oct 2022 15:19:11 +0200 Subject: [PATCH 06/17] Upgrade @types/minipass v2.2.0 to v3.3.5 --- yarn.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index f62b908168bb3..c0f4ed37b432d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7323,11 +7323,11 @@ integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== "@types/minipass@*": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@types/minipass/-/minipass-2.2.0.tgz#51ad404e8eb1fa961f75ec61205796807b6f9651" - integrity sha512-wuzZksN4w4kyfoOv/dlpov4NOunwutLA/q7uc00xU02ZyUY+aoM5PWIXEKBMnm0NHd4a+N71BMjq+x7+2Af1fg== + version "3.3.5" + resolved "https://registry.yarnpkg.com/@types/minipass/-/minipass-3.3.5.tgz#ba65aaae3fe7318520bd4a40bc71c53fc8826e45" + integrity sha512-M2BLHQdEmDmH671h0GIlOQQJrgezd1vNqq7PVj1VOsHZ2uQQb4iPiQIl0SlMdhxZPUsLIfEklmeEHXg8DJRewA== dependencies: - "@types/node" "*" + minipass "*" "@types/mock-fs@^4.13.1": version "4.13.1" @@ -19904,7 +19904,7 @@ minipass-sized@^1.0.3: dependencies: minipass "^3.0.0" -minipass@^3.0.0, minipass@^3.1.0, minipass@^3.1.1, minipass@^3.1.3, minipass@^3.1.6: +minipass@*, minipass@^3.0.0, minipass@^3.1.0, minipass@^3.1.1, minipass@^3.1.3, minipass@^3.1.6: version "3.3.4" resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.4.tgz#ca99f95dd77c43c7a76bf51e6d200025eee0ffae" integrity sha512-I9WPbWHCGu8W+6k1ZiGpPu0GkoKBeorkfKNuAFBNS1HNFJvke82sxvI5bzcCNpWPorkOO5QQ+zomzzwRxejXiw== From afd74bd12f2c963690cfe2d8811c18a3e7c740cb Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 26 Oct 2022 15:49:04 +0200 Subject: [PATCH 07/17] Upgrade chai v4.3.1 to v4.3.3 inside .buildkite --- .buildkite/package-lock.json | 16 ++++++++-------- .buildkite/package.json | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.buildkite/package-lock.json b/.buildkite/package-lock.json index cc303035b972e..d28509d0de482 100644 --- a/.buildkite/package-lock.json +++ b/.buildkite/package-lock.json @@ -16,12 +16,12 @@ "tslib": "*" }, "devDependencies": { - "@types/chai": "^4.2.10", + "@types/chai": "^4.3.3", "@types/js-yaml": "^4.0.5", "@types/minimatch": "^3.0.5", "@types/mocha": "^10.0.1", "@types/node": "^15.12.2", - "chai": "^4.2.0", + "chai": "^4.3.6", "mocha": "^10.2.0", "nock": "^12.0.2", "ts-node": "^10.7.0", @@ -242,9 +242,9 @@ "dev": true }, "node_modules/@types/chai": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.1.tgz", - "integrity": "sha512-/zPMqDkzSZ8t3VtxOa4KPq7uzzW978M9Tvh+j7GHKuo6k6GTLxPJ4J5gE5cjfJ26pnXst0N5Hax8Sr0T2Mi9zQ==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.3.tgz", + "integrity": "sha512-hC7OMnszpxhZPduX+m+nrx+uFoLkWOMiR4oa/AZF3MuSETYTZmFfJAHqZEM8MVlvfG7BEUcgvtwoCTxBp6hm3g==", "dev": true }, "node_modules/@types/js-yaml": { @@ -1847,9 +1847,9 @@ "dev": true }, "@types/chai": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.1.tgz", - "integrity": "sha512-/zPMqDkzSZ8t3VtxOa4KPq7uzzW978M9Tvh+j7GHKuo6k6GTLxPJ4J5gE5cjfJ26pnXst0N5Hax8Sr0T2Mi9zQ==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.3.tgz", + "integrity": "sha512-hC7OMnszpxhZPduX+m+nrx+uFoLkWOMiR4oa/AZF3MuSETYTZmFfJAHqZEM8MVlvfG7BEUcgvtwoCTxBp6hm3g==", "dev": true }, "@types/js-yaml": { diff --git a/.buildkite/package.json b/.buildkite/package.json index 620345b081410..2dbcbc3c0082f 100644 --- a/.buildkite/package.json +++ b/.buildkite/package.json @@ -15,12 +15,12 @@ "tslib": "*" }, "devDependencies": { - "@types/chai": "^4.2.10", + "@types/chai": "^4.3.3", "@types/js-yaml": "^4.0.5", "@types/minimatch": "^3.0.5", "@types/mocha": "^10.0.1", "@types/node": "^15.12.2", - "chai": "^4.2.0", + "chai": "^4.3.6", "mocha": "^10.2.0", "nock": "^12.0.2", "ts-node": "^10.7.0", From ec9a884e839457b655b3b6dfcbc1ccbf62854de8 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 26 Oct 2022 16:58:20 +0200 Subject: [PATCH 08/17] Upgrade @types/tar v4.0.5 to v6.1.3 --- package.json | 2 +- yarn.lock | 25 +++++++++---------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 187e39ac9506a..214d89b0ab280 100644 --- a/package.json +++ b/package.json @@ -978,7 +978,7 @@ "@types/styled-components": "^5.1.0", "@types/supertest": "^2.0.5", "@types/tapable": "^1.0.6", - "@types/tar": "^4.0.5", + "@types/tar": "^6.1.3", "@types/tempy": "^0.2.0", "@types/testing-library__jest-dom": "^5.14.5", "@types/tinycolor2": "^1.4.1", diff --git a/yarn.lock b/yarn.lock index c0f4ed37b432d..0ddd053211661 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7322,13 +7322,6 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== -"@types/minipass@*": - version "3.3.5" - resolved "https://registry.yarnpkg.com/@types/minipass/-/minipass-3.3.5.tgz#ba65aaae3fe7318520bd4a40bc71c53fc8826e45" - integrity sha512-M2BLHQdEmDmH671h0GIlOQQJrgezd1vNqq7PVj1VOsHZ2uQQb4iPiQIl0SlMdhxZPUsLIfEklmeEHXg8DJRewA== - dependencies: - minipass "*" - "@types/mock-fs@^4.13.1": version "4.13.1" resolved "https://registry.yarnpkg.com/@types/mock-fs/-/mock-fs-4.13.1.tgz#9201554ceb23671badbfa8ac3f1fa9e0706305be" @@ -7872,13 +7865,13 @@ resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.6.tgz#a9ca4b70a18b270ccb2bc0aaafefd1d486b7ea74" integrity sha512-W+bw9ds02rAQaMvaLYxAbJ6cvguW/iJXNT6lTssS1ps6QdrMKttqEAMEG/b5CR8TZl3/L7/lH0ZV5nNR1LXikA== -"@types/tar@^4.0.5": - version "4.0.5" - resolved "https://registry.yarnpkg.com/@types/tar/-/tar-4.0.5.tgz#5f953f183e36a15c6ce3f336568f6051b7b183f3" - integrity sha512-cgwPhNEabHaZcYIy5xeMtux2EmYBitfqEceBUi2t5+ETy4dW6kswt6WX4+HqLeiiKOo42EXbGiDmVJ2x+vi37Q== +"@types/tar@^6.1.3": + version "6.1.3" + resolved "https://registry.yarnpkg.com/@types/tar/-/tar-6.1.3.tgz#46a2ce7617950c4852dfd7e9cd41aa8161b9d750" + integrity sha512-YzDOr5kdAeqS8dcO6NTTHTMJ44MUCBDoLEIyPtwEn7PssKqUYL49R1iCVJPeiPzPlKi6DbH33eZkpeJ27e4vHg== dependencies: - "@types/minipass" "*" "@types/node" "*" + minipass "^3.3.5" "@types/tempy@^0.2.0": version "0.2.0" @@ -19904,10 +19897,10 @@ minipass-sized@^1.0.3: dependencies: minipass "^3.0.0" -minipass@*, minipass@^3.0.0, minipass@^3.1.0, minipass@^3.1.1, minipass@^3.1.3, minipass@^3.1.6: - version "3.3.4" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.4.tgz#ca99f95dd77c43c7a76bf51e6d200025eee0ffae" - integrity sha512-I9WPbWHCGu8W+6k1ZiGpPu0GkoKBeorkfKNuAFBNS1HNFJvke82sxvI5bzcCNpWPorkOO5QQ+zomzzwRxejXiw== +minipass@^3.0.0, minipass@^3.1.0, minipass@^3.1.1, minipass@^3.1.3, minipass@^3.1.6, minipass@^3.3.5: + version "3.3.6" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.6.tgz#7bba384db3a1520d18c9c0e5251c3444e95dd94a" + integrity sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw== dependencies: yallist "^4.0.0" From 0fbfdc4996229730f601c6680744d3feb2228bb4 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 26 Oct 2022 22:20:10 +0200 Subject: [PATCH 09/17] Fix TypeScript errors related to @types/tar --- .../server/services/epm/archive/extract.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/fleet/server/services/epm/archive/extract.ts b/x-pack/plugins/fleet/server/services/epm/archive/extract.ts index 03caf8901f40b..84c2457f4dafe 100644 --- a/x-pack/plugins/fleet/server/services/epm/archive/extract.ts +++ b/x-pack/plugins/fleet/server/services/epm/archive/extract.ts @@ -5,6 +5,8 @@ * 2.0. */ +import { finished } from 'stream/promises'; + import tar from 'tar'; import yauzl from 'yauzl'; @@ -16,19 +18,20 @@ export async function untarBuffer( buffer: Buffer, filter = (entry: ArchiveEntry): boolean => true, onEntry = (entry: ArchiveEntry): void => {} -): Promise { +) { const deflatedStream = bufferToStream(buffer); // use tar.list vs .extract to avoid writing to disk - const inflateStream = tar.list().on('entry', (entry: tar.FileStat) => { - const path = entry.header.path || ''; + const inflateStream = tar.list().on('entry', (entry) => { + const path = entry.path || ''; if (!filter({ path })) return; - streamToBuffer(entry).then((entryBuffer) => onEntry({ buffer: entryBuffer, path })); + streamToBuffer(entry as unknown as NodeJS.ReadableStream).then((entryBuffer) => + onEntry({ buffer: entryBuffer, path }) + ); }); - return new Promise((resolve, reject) => { - inflateStream.on('end', resolve).on('error', reject); - deflatedStream.pipe(inflateStream); - }); + deflatedStream.pipe(inflateStream); + + await finished(inflateStream); } export async function unzipBuffer( From 292f64e5db5f485c2702107d03230fc3cc9fb639 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 27 Oct 2022 07:40:35 +0200 Subject: [PATCH 10/17] Update inline snapshots to match new Node.js version --- .../server/lib/request_oauth_client_credentials_token.test.ts | 1 + .../plugins/actions/server/lib/request_oauth_jwt_token.test.ts | 1 + x-pack/plugins/actions/server/lib/request_oauth_token.test.ts | 1 + .../server/connector_types/email/send_email_graph_api.test.ts | 3 +++ 4 files changed, 6 insertions(+) diff --git a/x-pack/plugins/actions/server/lib/request_oauth_client_credentials_token.test.ts b/x-pack/plugins/actions/server/lib/request_oauth_client_credentials_token.test.ts index 20896e2691f10..223c8c28b55bc 100644 --- a/x-pack/plugins/actions/server/lib/request_oauth_client_credentials_token.test.ts +++ b/x-pack/plugins/actions/server/lib/request_oauth_client_credentials_token.test.ts @@ -74,6 +74,7 @@ describe('requestOAuthClientCredentialsToken', () => { "maxSockets": Infinity, "maxTotalSockets": Infinity, "options": Object { + "noDelay": true, "path": null, "rejectUnauthorized": true, }, diff --git a/x-pack/plugins/actions/server/lib/request_oauth_jwt_token.test.ts b/x-pack/plugins/actions/server/lib/request_oauth_jwt_token.test.ts index 318775762bbbd..af65bcf67d3db 100644 --- a/x-pack/plugins/actions/server/lib/request_oauth_jwt_token.test.ts +++ b/x-pack/plugins/actions/server/lib/request_oauth_jwt_token.test.ts @@ -75,6 +75,7 @@ describe('requestOAuthJWTToken', () => { "maxSockets": Infinity, "maxTotalSockets": Infinity, "options": Object { + "noDelay": true, "path": null, "rejectUnauthorized": true, }, diff --git a/x-pack/plugins/actions/server/lib/request_oauth_token.test.ts b/x-pack/plugins/actions/server/lib/request_oauth_token.test.ts index cc9ea6a74517a..9843783aadf8d 100644 --- a/x-pack/plugins/actions/server/lib/request_oauth_token.test.ts +++ b/x-pack/plugins/actions/server/lib/request_oauth_token.test.ts @@ -82,6 +82,7 @@ describe('requestOAuthToken', () => { "maxSockets": Infinity, "maxTotalSockets": Infinity, "options": Object { + "noDelay": true, "path": null, "rejectUnauthorized": true, }, diff --git a/x-pack/plugins/stack_connectors/server/connector_types/email/send_email_graph_api.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/email/send_email_graph_api.test.ts index 4ab03837f416b..199681a13e968 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/email/send_email_graph_api.test.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/email/send_email_graph_api.test.ts @@ -90,6 +90,7 @@ describe('sendEmailGraphApi', () => { "maxSockets": Infinity, "maxTotalSockets": Infinity, "options": Object { + "noDelay": true, "path": null, "rejectUnauthorized": true, }, @@ -180,6 +181,7 @@ describe('sendEmailGraphApi', () => { "maxSockets": Infinity, "maxTotalSockets": Infinity, "options": Object { + "noDelay": true, "path": null, "rejectUnauthorized": true, }, @@ -269,6 +271,7 @@ describe('sendEmailGraphApi', () => { "maxSockets": Infinity, "maxTotalSockets": Infinity, "options": Object { + "noDelay": true, "path": null, "rejectUnauthorized": true, }, From d131aad31050f6ab16dcb38065731154a06e6254 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 27 Oct 2022 09:23:33 +0200 Subject: [PATCH 11/17] Allow @kbn/optimizer to run with --openssl-legacy-provider flag --- packages/kbn-optimizer/src/optimizer/observe_worker.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/kbn-optimizer/src/optimizer/observe_worker.ts b/packages/kbn-optimizer/src/optimizer/observe_worker.ts index cf250a7deef6e..49c150fbf2dcb 100644 --- a/packages/kbn-optimizer/src/optimizer/observe_worker.ts +++ b/packages/kbn-optimizer/src/optimizer/observe_worker.ts @@ -60,6 +60,7 @@ function usingWorkerProc(config: OptimizerConfig, fn: (proc: ChildProcess) => (): ProcResource => { const proc = fork(require.resolve('../worker/run_worker'), [], { execArgv: [ + '--openssl-legacy-provider', `--require=@kbn/babel-register/install`, ...(inspectFlag && config.inspectWorkers ? [`${inspectFlag}=${inspectPortCounter++}`] From e3a175c03c124c3536364a81240331a6ebc65129 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 27 Oct 2022 11:38:30 +0200 Subject: [PATCH 12/17] Upgrade re2 v1.17.4 to v1.17.7 --- package.json | 2 +- .../build/tasks/patch_native_modules_task.ts | 36 ++++++------- yarn.lock | 51 ++++++++++++++----- 3 files changed, 56 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 214d89b0ab280..541ba8ec94238 100644 --- a/package.json +++ b/package.json @@ -620,7 +620,7 @@ "query-string": "^6.13.2", "rbush": "^3.0.1", "re-resizable": "^6.1.1", - "re2": "1.17.4", + "re2": "1.17.7", "react": "^17.0.2", "react-ace": "^7.0.5", "react-beautiful-dnd": "^13.1.0", diff --git a/src/dev/build/tasks/patch_native_modules_task.ts b/src/dev/build/tasks/patch_native_modules_task.ts index 1c1bebfa86c0e..596b94933385e 100644 --- a/src/dev/build/tasks/patch_native_modules_task.ts +++ b/src/dev/build/tasks/patch_native_modules_task.ts @@ -41,50 +41,50 @@ interface Package { const packages: Package[] = [ { name: 're2', - version: '1.17.4', + version: '1.17.7', destinationPath: 'node_modules/re2/build/Release/re2.node', extractMethod: 'gunzip', archives: { 'darwin-x64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.4/darwin-x64-93.gz', - sha256: '9558c5cb39622e9b3653203e772b129d6c634e7dbd7af1b244352fc1d704601f', + 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', + sha256: '4ed378c5a7fe6134b717afe7642254aff1ed7a881cbcaa53a012ac3efab49f99', }, 'linux-x64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.4/linux-x64-93.gz', - sha256: '4d06747b266c75b6f7ced93977692c0586ce6a52924cabb569bd966378941aa1', + 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', + sha256: '197a617ca2965f220848561afed71ff6df653f6d79910cf38e866c84ab38a236', }, // ARM builds are currently done manually as Github Actions used in upstream project // do not natively support an ARM target. - // From a AWS Graviton instance running Ubuntu: - // * install build-essential package + // From an AWS Graviton instance running Ubuntu or a GCE T2A instance running Debian: + // * install build-essential package: `sudo apt-get update` + `sudo apt install build-essential` // * install nvm and the node version used by the Kibana repository - // * `npm install re2@1.17.4` + // * `npm install re2@1.17.7` // * re2 will build itself on install - // * `cp node_modules/re2/build/Release/re2.node > linux-arm64-$(node -e "console.log(process.versions.modules)") + // * `cp node_modules/re2/build/Release/re2.node linux-arm64-$(node -e "console.log(process.versions.modules)")` // * `gzip linux-arm64-*` // * capture the sha256 with: `shasum -a 256 linux-arm64-*` - // * upload the `linux-arm64-*.gz` artifact to the `yarn-prebuilt-assets` bucket in GCS using the correct version number + // * 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.17.4/linux-arm64-93.gz', - sha256: '25409584f76f3d6ed85463d84adf094eb6e256ed1cb0b754b95bcbda6691fc26', + 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', + sha256: 'a690087a1a1fd9887aac1abdab68d1992600e218be10783da6d3381cca950c1a', }, // A similar process is necessary for building on ARM macs: // * bootstrap and re2 will build itself on install - // * `cp node_modules/re2/build/Release/re2.node > darwin-arm64-$(node -e "console.log(process.versions.modules)") + // * `cp node_modules/re2/build/Release/re2.node darwin-arm64-$(node -e "console.log(process.versions.modules)")` // * `gzip darwin-arm64-*` // * capture the sha256 with: `shasum -a 256 darwin-arm64-*` - // * upload the `darwin-arm64-*.gz` artifact to the `yarn-prebuilt-assets` bucket in GCS using the correct version number + // * upload the `darwin-arm64-*.gz` artifact to the `yarn-prebuilt-artifacts` bucket in GCS using the correct version number 'darwin-arm64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.4/darwin-arm64-93.gz', - sha256: 'd4b708749ddef1c87019f6b80e051ed0c29ccd1de34f233c47d8dcaddf803872', + 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', + sha256: '42afc32137ff5c5bebae5d68347a9786906748c2f28e06194d8950707f2ae90e', }, 'win32-x64': { - url: 'https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2/uhop/node-re2/releases/download/1.17.4/win32-x64-93.gz', - sha256: '0320d0c0385432944c6fb3c8c8fcd78d440ce5626f7618f9ec71d88e44820674', + 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', + sha256: 'ff72fe02de652262659c8e17e44a932f3c873362233756b40d1a97538d05de92', }, }, }, diff --git a/yarn.lock b/yarn.lock index 0ddd053211661..5ced51e376fa4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8585,7 +8585,7 @@ abab@^2.0.3, abab@^2.0.4, abab@^2.0.5, abab@^2.0.6: resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== -abbrev@1: +abbrev@1, abbrev@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== @@ -16436,10 +16436,10 @@ inquirer@^8.2.3: through "^2.3.6" wrap-ansi "^7.0.0" -install-artifact-from-github@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/install-artifact-from-github/-/install-artifact-from-github-1.3.0.tgz#cab6ff821976b8a35b0c079da19a727c90381a40" - integrity sha512-iT8v1GwOAX0pPXifF/5ihnMhHOCo3OeK7z3TQa4CtSNCIg8k0UxqBEk9jRwz8OP68hHXvJ2gxRa89KYHtBkqGA== +install-artifact-from-github@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/install-artifact-from-github/-/install-artifact-from-github-1.3.1.tgz#eefaad9af35d632e5d912ad1569c1de38c3c2462" + integrity sha512-3l3Bymg2eKDsN5wQuMfgGEj2x6l5MCAv0zPL6rxHESufFVlEAKW/6oY9F1aGgvY/EgWm5+eWGRjINveL4X7Hgg== internal-slot@^1.0.3: version "1.0.3" @@ -19195,7 +19195,7 @@ make-error@^1.1.1: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== -make-fetch-happen@^10.0.4: +make-fetch-happen@^10.0.3, make-fetch-happen@^10.0.4: version "10.2.1" resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz#f5e3835c5e9817b617f2770870d9492d28678164" integrity sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w== @@ -20213,7 +20213,7 @@ mute-stream@0.0.8: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -nan@^2.15.0, nan@^2.17.0: +nan@^2.16.0, nan@^2.17.0: version "2.17.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== @@ -20470,6 +20470,22 @@ node-gyp@^8.4.1: tar "^6.1.2" which "^2.0.2" +node-gyp@^9.0.0: + version "9.3.0" + resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-9.3.0.tgz#f8eefe77f0ad8edb3b3b898409b53e697642b319" + integrity sha512-A6rJWfXFz7TQNjpldJ915WFb1LnhO4lIve3ANPbWreuEoLoKlFT3sxIepPBkLhM27crW8YmN+pjlgbasH6cH/Q== + dependencies: + env-paths "^2.2.0" + glob "^7.1.4" + graceful-fs "^4.2.6" + make-fetch-happen "^10.0.3" + nopt "^6.0.0" + npmlog "^6.0.0" + rimraf "^3.0.2" + semver "^7.3.5" + tar "^6.1.2" + which "^2.0.2" + node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -20571,6 +20587,13 @@ nopt@^5.0.0: dependencies: abbrev "1" +nopt@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-6.0.0.tgz#245801d8ebf409c6df22ab9d95b65e1309cdb16d" + integrity sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g== + dependencies: + abbrev "^1.0.0" + normalize-package-data@^2.0.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -22724,14 +22747,14 @@ re-resizable@^6.1.1: dependencies: fast-memoize "^2.5.1" -re2@1.17.4: - version "1.17.4" - resolved "https://registry.yarnpkg.com/re2/-/re2-1.17.4.tgz#7bf29290bdde963014e77bd2c2e799a6d788386e" - integrity sha512-xyZ4h5PqE8I9tAxTh3G0UttcK5ufrcUxReFjGzfX61vtanNbS1XZHjnwRSyPcLgChI4KLxVgOT/ioZXnUAdoTA== +re2@1.17.7: + version "1.17.7" + resolved "https://registry.yarnpkg.com/re2/-/re2-1.17.7.tgz#e14cab85a177a5534c7215c322d1b043c55aa1e9" + integrity sha512-X8GSuiBoVWwcjuppqSjsIkRxNUKDdjhkO9SBekQbZ2ksqWUReCy7DQPWOVpoTnpdtdz5PIpTTxTFzvJv5UMfjA== dependencies: - install-artifact-from-github "^1.3.0" - nan "^2.15.0" - node-gyp "^8.4.1" + install-artifact-from-github "^1.3.1" + nan "^2.16.0" + node-gyp "^9.0.0" react-ace@^7.0.5: version "7.0.5" From 75c2a7385166a92bebcae477ca6095aa24d51bd3 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Mon, 9 Jan 2023 11:11:19 +0100 Subject: [PATCH 13/17] Fix date related test errors --- packages/kbn-i18n/src/core/i18n.test.ts | 8 ++++---- .../curations/components/curations_table.test.tsx | 4 ++-- .../shared/formatted_date_time/index.test.tsx | 2 +- .../server/connector_types/servicenow_itom/api.test.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/kbn-i18n/src/core/i18n.test.ts b/packages/kbn-i18n/src/core/i18n.test.ts index dfea790f129b5..f9a6535d881ee 100644 --- a/packages/kbn-i18n/src/core/i18n.test.ts +++ b/packages/kbn-i18n/src/core/i18n.test.ts @@ -662,13 +662,13 @@ describe('I18n engine', () => { i18n.translate('a.short', { values: { expires: new Date(2018, 5, 20, 18, 40, 30, 50) }, } as any) - ).toBe('Coupon expires at 6:40 PM'); + ).toBe('Coupon expires at 6:40 PM'); expect( i18n.translate('a.medium', { values: { expires: new Date(2018, 5, 20, 18, 40, 30, 50) }, } as any) - ).toBe('Coupon expires at 6:40:30 PM'); + ).toBe('Coupon expires at 6:40:30 PM'); }); test('should format default messages with time formatter', () => { @@ -679,14 +679,14 @@ describe('I18n engine', () => { defaultMessage: 'Coupon expires at {expires, time, short}', values: { expires: new Date(2018, 5, 20, 18, 40, 30, 50) }, }) - ).toBe('Coupon expires at 6:40 PM'); + ).toBe('Coupon expires at 6:40 PM'); expect( i18n.translate('foo', { defaultMessage: 'Coupon expires at {expires, time, medium}', values: { expires: new Date(2018, 5, 20, 18, 40, 30, 50) }, }) - ).toBe('Coupon expires at 6:40:30 PM'); + ).toBe('Coupon expires at 6:40:30 PM'); }); test('should format message with a custom format', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/components/curations_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/components/curations_table.test.tsx index d86cb8592635a..3d98b684f8dfc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/components/curations_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/curations/components/curations_table.test.tsx @@ -84,8 +84,8 @@ describe('CurationsTable', () => { expect(tableContent).toContain('mountains, valleys'); expect(tableContent).toContain('Last updated'); - expect(tableContent).toContain('Jan 1, 1970 12:00 PM'); - expect(tableContent).toContain('Jan 2, 1970 12:00 PM'); + expect(tableContent).toContain('Jan 1, 1970 12:00 PM'); + expect(tableContent).toContain('Jan 2, 1970 12:00 PM'); }); it('renders queries with curation links and curation suggestion badges', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/formatted_date_time/index.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/formatted_date_time/index.test.tsx index f74125b1528c7..fd76943d3e727 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/formatted_date_time/index.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/formatted_date_time/index.test.tsx @@ -16,7 +16,7 @@ describe('FormattedDateTime', () => { const date = new Date('1970-01-01T12:00:00'); const wrapper = mountWithIntl(); - expect(wrapper.text()).toEqual('Jan 1, 1970 12:00 PM'); + expect(wrapper.text()).toEqual('Jan 1, 1970 12:00 PM'); }); it('does not render time if hideTime is passed', () => { diff --git a/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.test.ts index 3731aa6f09dc7..e5419fdcef189 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.test.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.test.ts @@ -15,7 +15,7 @@ describe('api_itom', () => { let externalService: jest.Mocked; const eventParamsWithFormattedDate = { ...itomEventParams, - time_of_event: '2021-10-13, 10:51:44', + time_of_event: '10/13/2021, 10:51:44', }; beforeEach(() => { From ca2a1c31637eba25533decbdd7a0a33d2892a804 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 2 Nov 2022 14:45:05 +0100 Subject: [PATCH 14/17] Fix stream race condition in reporting plugin --- .../server/lib/tasks/execute_report.ts | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/reporting/server/lib/tasks/execute_report.ts b/x-pack/plugins/reporting/server/lib/tasks/execute_report.ts index ca3ba4445f940..abebdef58fe33 100644 --- a/x-pack/plugins/reporting/server/lib/tasks/execute_report.ts +++ b/x-pack/plugins/reporting/server/lib/tasks/execute_report.ts @@ -10,8 +10,9 @@ import type { Logger } from '@kbn/core/server'; import moment from 'moment'; import * as Rx from 'rxjs'; import { timeout } from 'rxjs/operators'; -import { finished, Writable } from 'stream'; -import { promisify } from 'util'; +import { Writable } from 'stream'; +import { finished } from 'stream/promises'; +import { setTimeout } from 'timers/promises'; import type { RunContext, TaskManagerStartContract, @@ -59,6 +60,22 @@ function reportFromTask(task: ReportTaskParams) { return new Report({ ...task, _id: task.id, _index: task.index }); } +async function finishedWithNoPendingCallbacks(stream: Writable) { + await finished(stream, { readable: false }); + + // Race condition workaround: + // `finished(...)` will resolve while there's still pending callbacks in the writable part of the `stream`. + // This introduces a race condition where the code continues before the writable part has completely finished. + // The `pendingCallbacks` function is a hack to ensure that all pending callbacks have been called before continuing. + // For more information, see: https://github.com/nodejs/node/issues/46170 + await (async function pendingCallbacks(delay = 1) { + if ((stream as any)._writableState.pendingcb > 0) { + await setTimeout(delay); + await pendingCallbacks(delay < 32 ? delay * 2 : delay); + } + })(); +} + export class ExecuteReportTask implements ReportingTask { public TYPE = REPORTING_EXECUTE_TYPE; @@ -377,7 +394,7 @@ export class ExecuteReportTask implements ReportingTask { stream.end(); - await promisify(finished)(stream, { readable: false }); + await finishedWithNoPendingCallbacks(stream); report._seq_no = stream.getSeqNo()!; report._primary_term = stream.getPrimaryTerm()!; From 5f9df2b618894658f3592767439c53517704dbe9 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Mon, 16 Jan 2023 13:55:14 +0100 Subject: [PATCH 15/17] Fix new jest errors introduced when merging in main --- .../server/synthetics_service/service_api_client.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/synthetics/server/synthetics_service/service_api_client.test.ts b/x-pack/plugins/synthetics/server/synthetics_service/service_api_client.test.ts index 62a54db4460a6..52056b77ae8b7 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/service_api_client.test.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/service_api_client.test.ts @@ -200,7 +200,7 @@ describe('callAPI', () => { 'x-kibana-version': '8.7.0', }, httpsAgent: expect.objectContaining({ - options: { rejectUnauthorized: true, path: null }, + options: { noDelay: true, rejectUnauthorized: true, path: null }, }), method: 'POST', url: 'https://service.dev/monitors', @@ -213,7 +213,7 @@ describe('callAPI', () => { 'x-kibana-version': '8.7.0', }, httpsAgent: expect.objectContaining({ - options: { rejectUnauthorized: true, path: null }, + options: { noDelay: true, rejectUnauthorized: true, path: null }, }), method: 'POST', url: 'https://qa.service.elstc.co/monitors', @@ -226,7 +226,7 @@ describe('callAPI', () => { 'x-kibana-version': '8.7.0', }, httpsAgent: expect.objectContaining({ - options: { rejectUnauthorized: true, path: null }, + options: { noDelay: true, rejectUnauthorized: true, path: null }, }), method: 'POST', url: 'https://qa.service.stg.co/monitors', @@ -293,6 +293,7 @@ describe('callAPI', () => { httpsAgent: expect.objectContaining({ options: { rejectUnauthorized: true, + noDelay: true, path: null, cert: 'test-certificate', key: 'test-key', From 93bb7a4491fe16718e07f0ed24b031fc5cc80dd2 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Mon, 16 Jan 2023 14:43:00 +0100 Subject: [PATCH 16/17] Upgrade tar from v6.1.11 to v6.1.13 --- package.json | 2 +- yarn.lock | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1a2b2ab31a6fc..98171db69f469 100644 --- a/package.json +++ b/package.json @@ -683,7 +683,7 @@ "styled-components": "^5.1.0", "suricata-sid-db": "^1.0.2", "symbol-observable": "^1.2.0", - "tar": "^6.1.11", + "tar": "^6.1.13", "tinycolor2": "1.4.1", "tinygradient": "0.4.3", "ts-easing": "^0.2.0", diff --git a/yarn.lock b/yarn.lock index a585af895866b..8133cfeb06aa2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19968,6 +19968,13 @@ minipass@^3.0.0, minipass@^3.1.0, minipass@^3.1.1, minipass@^3.1.3, minipass@^3. dependencies: yallist "^4.0.0" +minipass@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-4.0.0.tgz#7cebb0f9fa7d56f0c5b17853cbe28838a8dbbd3b" + integrity sha512-g2Uuh2jEKoht+zvO6vJqXmYpflPqzRBT+Th2h01DKh5z7wbY/AZ2gCQ78cP70YoHPyFdY30YBV5WxgLOEwOykw== + dependencies: + yallist "^4.0.0" + minizlib@^2.0.0, minizlib@^2.1.1, minizlib@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" @@ -26065,7 +26072,7 @@ tar-stream@^2.1.4, tar-stream@^2.2.0: inherits "^2.0.3" readable-stream "^3.1.1" -tar@6.1.11, tar@^6.0.2, tar@^6.1.11, tar@^6.1.2: +tar@6.1.11: version "6.1.11" resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621" integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA== @@ -26077,6 +26084,18 @@ tar@6.1.11, tar@^6.0.2, tar@^6.1.11, tar@^6.1.2: mkdirp "^1.0.3" yallist "^4.0.0" +tar@^6.0.2, tar@^6.1.11, tar@^6.1.13, tar@^6.1.2: + version "6.1.13" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.13.tgz#46e22529000f612180601a6fe0680e7da508847b" + integrity sha512-jdIBIN6LTIe2jqzay/2vtYLlBHa3JF42ot3h1dW8Q0PaAG4v8rm0cvpVePtau5C6OKXGGcgO9q2AMNSWxiLqKw== + dependencies: + chownr "^2.0.0" + fs-minipass "^2.0.0" + minipass "^4.0.0" + minizlib "^2.1.1" + mkdirp "^1.0.3" + yallist "^4.0.0" + tcomb-validation@^3.3.0: version "3.4.1" resolved "https://registry.yarnpkg.com/tcomb-validation/-/tcomb-validation-3.4.1.tgz#a7696ec176ce56a081d9e019f8b732a5a8894b65" From 5e98895878cc7e011209acf7c9b33c9850944c64 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Mon, 16 Jan 2023 16:52:37 +0100 Subject: [PATCH 17/17] Fix date formatting There's no ISO code that formats in the exact style of the previous Node.js version, but Esperanto is the closest we can get, just missing the comma. --- .../server/connector_types/servicenow_itom/api.test.ts | 2 +- .../server/connector_types/servicenow_itom/api.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.test.ts index e5419fdcef189..584a06f4b407a 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.test.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.test.ts @@ -15,7 +15,7 @@ describe('api_itom', () => { let externalService: jest.Mocked; const eventParamsWithFormattedDate = { ...itomEventParams, - time_of_event: '10/13/2021, 10:51:44', + time_of_event: '2021-10-13 10:51:44', }; beforeEach(() => { diff --git a/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.ts b/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.ts index d9479792967b2..c68f1d4419eb1 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.ts @@ -20,7 +20,7 @@ const formatTimeOfEvent = (timeOfEvent: string | null): string | undefined => { return isValidDate(date) ? // The format is: yyyy-MM-dd HH:mm:ss GMT - date.toLocaleDateString('en-CA', { + date.toLocaleDateString('eo', { year: 'numeric', month: '2-digit', day: '2-digit',