Skip to content

Commit

Permalink
Merge branch 'main' into upgrade-lmdb
Browse files Browse the repository at this point in the history
  • Loading branch information
jeramysoucy authored Jan 2, 2024
2 parents 137b9ce + e62b7ac commit 5ecaf13
Show file tree
Hide file tree
Showing 146 changed files with 2,857 additions and 1,917 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipelines/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.18.2
20.10.0
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.18.2
20.10.0
12 changes: 6 additions & 6 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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.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", "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"),
},
node_version = "18.18.2",
node_version = "20.10.0",
node_urls = [
"https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/dist/v{version}/{filename}",
],
Expand Down
2 changes: 1 addition & 1 deletion fleet_packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
{
"name": "elastic_agent",
"version": "1.15.0"
"version": "1.16.0"
},
{
"name": "endpoint",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@
"url": "https://github.com/elastic/kibana.git"
},
"engines": {
"node": "18.18.2",
"node": "20.10.0",
"yarn": "^1.22.19"
},
"resolutions": {
"**/@hello-pangea/dnd": "16.2.0",
"**/@types/node": "18.18.5",
"**/@types/node": "20.10.5",
"**/@typescript-eslint/utils": "5.62.0",
"**/chokidar": "^3.5.3",
"**/globule/minimatch": "^3.1.2",
Expand Down Expand Up @@ -1010,7 +1010,7 @@
"normalize-path": "^3.0.0",
"object-hash": "^1.3.1",
"object-path-immutable": "^3.1.1",
"openai": "^3.3.0",
"openai": "^4.24.1",
"openpgp": "5.10.1",
"opn": "^5.5.0",
"ora": "^4.0.4",
Expand Down Expand Up @@ -1413,7 +1413,7 @@
"@types/multistream": "^4.1.0",
"@types/mustache": "^0.8.31",
"@types/nock": "^10.0.3",
"@types/node": "18.18.5",
"@types/node": "20.10.5",
"@types/node-fetch": "2.6.4",
"@types/node-forge": "^1.3.10",
"@types/nodemailer": "^6.4.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)})`
);
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-es-archiver/src/lib/archives/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
}
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-es/src/integration_tests/__fixtures__/es_bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
15 changes: 9 additions & 6 deletions packages/kbn-es/src/utils/docker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()', () => {
Expand Down Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand Down
11 changes: 9 additions & 2 deletions packages/kbn-es/src/utils/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ export async function retryForSuccess<T>(log: ToolingLog, options: Options<T>) {

const start = Date.now();
const retryDelay = 502;
const criticalWebDriverErrors = ['NoSuchSessionError', 'NoSuchWindowError'];
let lastError;

while (true) {
if (Date.now() - start > timeout) {
await onFailure(lastError);
throw new Error('expected onFailure() option to throw an error');
} else if (lastError && criticalWebDriverErrors.includes(lastError.name)) {
// Aborting retry since WebDriver session is invalid or browser window is closed
throw new Error('WebDriver session is invalid, retry was aborted');
} else if (lastError && onFailureBlock) {
const before = await runAttempt(onFailureBlock);
if ('error' in before) {
Expand Down
20 changes: 10 additions & 10 deletions src/dev/build/tasks/patch_native_modules_task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.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',
sha256: '215b6ffb1e5d124439a7dbdd09e4ed1263e065839354a6ad67091ce00d14ee9b',
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: '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-108.gz',
sha256: '0a8bc28150c9efd04f3b52ac214cc7898bde1b8e1f8e6900ae711b03665ff657',
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: '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-108.gz',
sha256: '117872144e4a2bb61611aacc51ac9fd24e494c209cf63366f236099a662316eb',
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: '01ae2df89f976f4097e50e121d7ec6ac62ec8050c838107dcfb976d037a60d59',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/search/expressions/esdsl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
5 changes: 2 additions & 3 deletions src/plugins/kibana_utils/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

import { PluginInitializerContext } from '@kbn/core/public';
import { KibanaUtilsPublicPlugin } from './plugin';

export type { Get, Set } from '../common';
Expand Down Expand Up @@ -114,6 +113,6 @@ export { applyDiff } from './state_management/utils/diff_object';

export type { KibanaUtilsPublicSetup as KibanaUtilsSetup, KibanaUtilsPublicStart } from './plugin';

export function plugin(initializerContext: PluginInitializerContext) {
return new KibanaUtilsPublicPlugin(initializerContext);
export function plugin() {
return new KibanaUtilsPublicPlugin();
}
4 changes: 1 addition & 3 deletions src/plugins/kibana_utils/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export type Setup = jest.Mocked<KibanaUtilsPublicSetup>;
export type Start = jest.Mocked<KibanaUtilsPublicStart>;

const createSetupContract = (): Setup => {
return {
setVersion: jest.fn(),
};
return undefined;
};

const createStartContract = (): Start => {
Expand Down
22 changes: 3 additions & 19 deletions src/plugins/kibana_utils/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
* Side Public License, v 1.
*/

import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
import { History } from 'history';
import { setVersion } from './set_version';
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';

export interface KibanaUtilsPublicSetup {
setVersion: (history: Pick<History, 'location' | 'replace'>) => void;
}
export type KibanaUtilsPublicSetup = undefined;

export type KibanaUtilsPublicStart = undefined;

Expand All @@ -31,25 +27,13 @@ export class KibanaUtilsPublicPlugin
KibanaUtilsPublicStartDependencies
>
{
private readonly version: string;

constructor(initializerContext: PluginInitializerContext) {
this.version = initializerContext.env.packageInfo.version;
}

public setup(_core: CoreSetup): KibanaUtilsPublicSetup {
return {
setVersion: this.setVersion,
};
return undefined;
}

public start(_core: CoreStart): KibanaUtilsPublicStart {
return undefined;
}

public stop() {}

private setVersion = (history: Pick<History, 'location' | 'replace'>) => {
setVersion(history, this.version);
};
}
59 changes: 0 additions & 59 deletions src/plugins/kibana_utils/public/set_version.test.ts

This file was deleted.

Loading

0 comments on commit 5ecaf13

Please sign in to comment.