Skip to content

Commit

Permalink
Merge branch 'main' into links-register-alias_2023-10-17
Browse files Browse the repository at this point in the history
  • Loading branch information
Heenawter committed Nov 20, 2023
2 parents 9558736 + dda4498 commit e478165
Show file tree
Hide file tree
Showing 93 changed files with 1,101 additions and 629 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipelines/artifacts.yml
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 .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

Expand Down
2 changes: 1 addition & 1 deletion .node-version
@@ -1 +1 @@
18.18.2
20.9.0
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
18.18.2
20.9.0
12 changes: 6 additions & 6 deletions WORKSPACE.bazel
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.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}",
],
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -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",
Expand Down Expand Up @@ -1379,7 +1379,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",
Expand Down
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
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
153 changes: 153 additions & 0 deletions packages/kbn-apm-synthtrace/src/scenarios/trace_with_orphan_items.ts
@@ -0,0 +1,153 @@
/*
* 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.
*/

import { apm, ApmFields, httpExitSpan, Serializable } from '@kbn/apm-synthtrace-client';
import { Readable } from 'stream';
import { Scenario } from '../cli/scenario';

import { RunOptions } from '../cli/utils/parse_run_cli_flags';
import { getSynthtraceEnvironment } from '../lib/utils/get_synthtrace_environment';
import { withClient } from '../lib/utils/with_client';

const ENVIRONMENT = getSynthtraceEnvironment(__filename);

const scenario: Scenario<ApmFields> = async (runOptions: RunOptions) => {
return {
generate: ({ range, clients: { apmEsClient } }) => {
const transactionName = 'trace with orphans';
const successfulTimestamps = range.interval('1s').rate(3);

const synthRum = apm
.service({ name: 'synth-rum', environment: ENVIRONMENT, agentName: 'rum-js' })
.instance('my-instance');
const synthNode = apm
.service({ name: 'synth-node', environment: ENVIRONMENT, agentName: 'nodejs' })
.instance('my-instance');
const synthGo = apm
.service({ name: 'synth-go', environment: ENVIRONMENT, agentName: 'go' })
.instance('my-instance');

const traces = successfulTimestamps.generator((timestamp) => {
// synth-rum
return synthGo
.transaction({ transactionName })
.duration(400)
.timestamp(timestamp)
.children(
// synth-rum -> synth-node
synthRum
.span(
httpExitSpan({
spanName: 'GET /api/products/top',
destinationUrl: 'http://synth-node:3000',
})
)
.duration(300)
.timestamp(timestamp)
.children(
synthRum
.transaction({ transactionName: 'Child Transaction' })
.timestamp(timestamp)
.duration(200)
.children(
synthGo
.span({ spanName: 'custom_operation', spanType: 'custom' })
.timestamp(timestamp)
.duration(100)
.success()
),
// synth-node
synthNode
.transaction({ transactionName: 'Initial transaction in synth-node' })
.duration(300)
.timestamp(timestamp)
.children(
synthNode
// synth-node -> synth-go
.span(
httpExitSpan({
spanName: 'GET synth-go:3000',
destinationUrl: 'http://synth-go:3000',
})
)
.timestamp(timestamp)
.duration(400)

.children(
// synth-go
synthGo
.transaction({ transactionName: 'Child Transaction' })
.timestamp(timestamp)
.duration(200)
.children(
synthGo
.span({ spanName: 'custom_operation', spanType: 'custom' })
.timestamp(timestamp)
.duration(100)
.success(),
synthGo
.span({ spanName: 'custom_new_operation', spanType: 'custom' })
.timestamp(timestamp)
.duration(100)
.success()
)
)
)
)
);
});

const successfulTraceEvents = Array.from(
successfulTimestamps.generator((timestamp) =>
synthNode
.transaction({ transactionName: 'successful trace' })
.timestamp(timestamp)
.duration(1000)
.success()
.children(
synthNode
.span({
spanName: 'GET apm-*/_search',
spanType: 'db',
spanSubtype: 'elasticsearch',
})
.duration(1000)
.success()
.destination('elasticsearch')
.timestamp(timestamp),
synthNode
.span({ spanName: 'custom_operation', spanType: 'custom' })
.duration(100)
.success()
.timestamp(timestamp)
)
)
);

const unserialized = Array.from(traces);

const serialized = unserialized
.flatMap((event) => event.serialize())
.filter((trace) => trace['transaction.name'] !== 'Child Transaction');

const unserializedChanged = serialized.map((event) => ({
fields: event,
serialize: () => {
return [event];
},
})) as Array<Serializable<ApmFields>>;

return withClient(
apmEsClient,
Readable.from([...unserializedChanged, ...successfulTraceEvents])
);
},
};
};

export default scenario;
2 changes: 1 addition & 1 deletion packages/kbn-es-archiver/src/lib/archives/parse.test.ts
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
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
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 @@ -109,7 +108,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 @@ -442,7 +441,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 @@ -451,7 +450,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 @@ -460,7 +461,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 volumes when ssl is passed', async () => {
Expand Down
11 changes: 9 additions & 2 deletions packages/kbn-es/src/utils/docker.ts
Expand Up @@ -486,12 +486,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
20 changes: 10 additions & 10 deletions src/dev/build/tasks/patch_native_modules_task.ts
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.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.
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.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',
},
},
},
Expand Down
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
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

0 comments on commit e478165

Please sign in to comment.