Skip to content

Commit

Permalink
Merge branch 'main' into task/dw-fix-flaky-test-145204
Browse files Browse the repository at this point in the history
  • Loading branch information
ashokaditya authored Jan 31, 2023
2 parents db73b4e + ae07320 commit 7c8049d
Show file tree
Hide file tree
Showing 499 changed files with 13,038 additions and 25,383 deletions.
5 changes: 4 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@

### Kibana React (to be deprecated)
/src/plugins/kibana_react/ @elastic/appex-sharedux
/src/plugins/kibana_react/public/code_editor @elastic/appex-sharedux @elastic/kibana-presentation
/src/plugins/kibana_react/public/@elastic/appex-sharedux @elastic/kibana-presentation

### Home Plugin and Packages
/src/plugins/home/public @elastic/appex-sharedux
Expand Down Expand Up @@ -1040,6 +1040,9 @@ packages/shared-ux/button/exit_full_screen/types @elastic/appex-sharedux
packages/shared-ux/card/no_data/impl @elastic/appex-sharedux
packages/shared-ux/card/no_data/mocks @elastic/appex-sharedux
packages/shared-ux/card/no_data/types @elastic/appex-sharedux
packages/shared-ux/code_editor/impl @elastic/shared-ux
packages/shared-ux/code_editor/mocks @elastic/shared-ux
packages/shared-ux/code_editor/types @elastic/shared-ux
packages/shared-ux/file/context @elastic/appex-sharedux
packages/shared-ux/file/file_picker/impl @elastic/appex-sharedux
packages/shared-ux/file/file_upload/impl @elastic/appex-sharedux
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ disabledPlugins
webpackstats.json
/config/*
!/config/kibana.yml
!/config/kibana.serverless.yml
!/config/node.options
coverage
selenium
Expand Down
5 changes: 5 additions & 0 deletions .telemetryrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"exclude": [
"src/plugins/kibana_usage_collection/server/collectors/config_usage/register_config_usage_collector.ts"
]
},
{
"output": "src/plugins/telemetry/schema/kbn_packages.json",
"root": "packages/",
"exclude": []
}
]
9 changes: 9 additions & 0 deletions config/kibana.serverless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# as work on serverless picks up we will add config values to this file that
# define how Kibana will run in "serverless" mode. To start Kibana locally with
# this configuration, pass `--serverless` or run `yarn start-serverless`

# configuration is applied in the following order, later values override
# 1. kibana.yml
# 2. kibana.serverless.yml (when --serverless is passed)
# 3. kibana.dev.yml
# 4. kibana.serverless.dev.yml (when --serverless is passed)
18 changes: 7 additions & 11 deletions dev_docs/operations/packages_idm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,16 @@ Package types allow us to have many different packages, pre-defined build tasks,
: These packages can be imported from all other packages.

`shared-browser`
: These packages can be imported from `shared-browser` and `plugin-browser` packages. `shared-browser` packages may include Storybooks.
: These packages can be imported from `shared-browser` and `public` directories within `plugin` packages. `shared-browser` packages may include Storybooks.

`shared-server`
: These packages can be imported from `shared-server` and `plugin-server` packages.
: These packages can be imported from `shared-server` and `server` directories within `plugin` packages.

`shared-scss`
: These packages can be imported by `shared-browser` and `plugin-browser` packages, and expose an `index.scss` file to consumers instead of an `index.ts` file.
: These packages can be imported by `shared-browser` and `public` directories within `plugin` packages, and expose an `index.scss` file to consumers instead of an `index.ts` file.

`plugin-browser`
: These packages expose types to other packages via a root `types.ts` file. Module IDs must end with `-plugin-browser`. Consumers must use `import type` statements.

`plugin-server`
: These packages expose types to other packages via a root `types.ts` file. Module IDs must end with `-plugin-server`. Consumers must use `import type` statements.
`plugin`
: These packages were automatically created from the existing plugins at the time we switched everything over to packages. Module IDs must end with `-plugin`. Consumers must use `import type` statements.

`functional-test`
: These packages expose one or more functional testing configurations, including API integration tests, and can not be imported by other packages. Separating functional and integration tests allows us to iterate on tests without rebuilding the application. Similarly, iterating and updating the application should mostly mean the tests don't need to rebuild.
Expand Down Expand Up @@ -160,8 +157,7 @@ The solution to resolving a circular dependency has, thus far, been to break out

There are a few package naming rules:
- all packages must use the `@kbn/` namespace
- `plugin-browser`-type packages must end with `-plugin-browser`
- `plugin-server- type packages must end with `-plugin-server`
- `plugin`-type packages must end with `-plugin`
- considering that we operate in a global namespace, avoid overly generic names

Other than these rules, it's up to you and your team to decide on an appropriate name for your package.
Expand Down Expand Up @@ -205,4 +201,4 @@ We're now entering Phase 2 of the plan, more details about the phases of our pla

[status]: #what-works-now
[idm-rfc]: https://docs.google.com/document/d/1Bhg601MoGQjqGMGdLWSLnkopRexwrcbf_0MNcUkhx3I "Internal Dependency Management RFC on Google Docs"
[pkgDirs]: https://github.com/elastic/kibana/blob/main/packages/kbn-bazel-packages/src/bazel_package_dirs.ts#L22
[pkgDirs]: https://github.com/elastic/kibana/blob/main/packages/kbn-repo-packages/src/repo_package_dirs.js#L19
3 changes: 2 additions & 1 deletion docs/api/osquery-manager/live-queries/get-all.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ experimental[] Get live queries.
(Optional, string) An identifier for the space. When `space_id` is not provided in the URL, the default space is used.


=== Query parameters
[[osquery-manager-live-queries-api-get-all-query-params]]
==== Query parameters

`page`::
(Optional, integer) The page number to return. The default is `1`.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/osquery-manager/packs/delete.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ WARNING: Once you delete a pack, _it cannot be recovered_.
`200`::
Indicates that the pack is deleted. Returns an empty response body.


[[osquery-manager-packs-api-delete-example]]
==== Example

Delete a pack object with the `bbe5b070-0c51-11ed-b0f8-ad31b008e832` ID:
Expand Down
4 changes: 2 additions & 2 deletions docs/api/osquery-manager/packs/get-all.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ experimental[] Get packs.
`space_id`::
(Optional, string) The space identifier. When `space_id` is not provided in the URL, the default space is used.


=== Query parameters
[[osquery-manager-packs-api-get-all-query-params]]
==== Query parameters

`page`::
(Optional, integer) The page number to return. The default is `1`.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/osquery-manager/saved-queries/delete.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ WARNING: Once you delete a saved query, _it cannot be recovered_.
`200`::
Indicates the saved query is deleted. Returns an empty response body.


[[osquery-manager-saved-queries-api-delete-example]]
==== Example

Delete a saved query object with the `42ba9c50-0cc5-11ed-aa1d-2b27890bc90d` ID:
Expand Down
4 changes: 2 additions & 2 deletions docs/api/osquery-manager/saved-queries/get-all.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ experimental[] Get saved queries.
`space_id`::
(Optional, string) The space identifier. When `space_id` is not provided in the URL, the default space is used.


=== Query parameters
[[osquery-manager-saved-queries-api-get-all-query-params]]
==== Query parameters

`page`::
(Optional, integer) The page number to return. The default is `1`.
Expand Down
2 changes: 1 addition & 1 deletion docs/apm/service-maps.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ iOS agent:: _Not yet supported_
Java agent:: ≥ v1.13.0
.NET agent:: ≥ v1.3.0
Node.js agent:: ≥ v3.6.0
PHP agent:: _Not yet supported_
PHP agent:: ≥ v1.2.0
Python agent:: ≥ v5.5.0
Ruby agent:: ≥ v3.6.0
Real User Monitoring (RUM) agent:: ≥ v4.7.0
5 changes: 0 additions & 5 deletions docs/settings/apm-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ Maximum number of child items displayed when viewing trace details. Defaults to
`xpack.observability.annotations.index` {ess-icon}::
Index name where Observability annotations are stored. Defaults to `observability-annotations`.

`xpack.apm.searchAggregatedTransactions` {ess-icon}::
Enables Transaction histogram metrics. Defaults to `auto` so the UI will use metric indices over transaction indices for transactions if aggregated transactions are found. When set to `always`, additional configuration in APM Server is required. When set to `never` and aggregated transactions are not used.
+
See {apm-guide-ref}/transaction-metrics.html[Configure transaction metrics] for more information.

`xpack.apm.metricsInterval` {ess-icon}::
Sets a `fixed_interval` for date histograms in metrics aggregations. Defaults to `30`.

Expand Down
4 changes: 4 additions & 0 deletions docs/user/security/audit-logging.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ Refer to the corresponding {es} logs for potential write errors.
| `unknown` | User is creating a case comment.
| `failure` | User is not authorized to create a case comment.

.2+| `case_comment_bulk_create`
| `unknown` | User is creating multiple case comments.
| `failure` | User is not authorized to create multiple case comments.

.1+| `case_user_action_create_comment`
| `success` | User has created a case comment.

Expand Down
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"makelogs": "node scripts/makelogs",
"spec_to_console": "node scripts/spec_to_console",
"start": "node scripts/kibana --dev",
"start-serverless": "node scripts/kibana --dev --serverless",
"storybook": "node scripts/storybook",
"test:ftr": "node scripts/functional_tests",
"test:ftr:runner": "node scripts/functional_test_runner",
Expand Down Expand Up @@ -94,7 +95,7 @@
},
"dependencies": {
"@appland/sql-parser": "^1.5.1",
"@babel/runtime": "^7.20.7",
"@babel/runtime": "^7.20.13",
"@dnd-kit/core": "^3.1.1",
"@dnd-kit/sortable": "^4.0.0",
"@dnd-kit/utilities": "^2.0.0",
Expand Down Expand Up @@ -143,6 +144,9 @@
"@kbn/cell-actions": "link:packages/kbn-cell-actions",
"@kbn/chart-expressions-common": "link:src/plugins/chart_expressions/common",
"@kbn/chart-icons": "link:packages/kbn-chart-icons",
"@kbn/code-editor": "link:packages/shared-ux/code_editor/impl",
"@kbn/code-editor-mocks": "link:packages/shared-ux/code_editor/mocks",
"@kbn/code-editor-types": "link:packages/shared-ux/code_editor/types",
"@kbn/coloring": "link:packages/kbn-coloring",
"@kbn/config": "link:packages/kbn-config",
"@kbn/config-mocks": "link:packages/kbn-config-mocks",
Expand Down Expand Up @@ -665,7 +669,7 @@
"@babel/eslint-plugin": "^7.19.1",
"@babel/generator": "^7.20.7",
"@babel/helper-plugin-utils": "^7.20.2",
"@babel/parser": "^7.20.7",
"@babel/parser": "^7.20.13",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
Expand All @@ -677,7 +681,7 @@
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@babel/register": "^7.18.9",
"@babel/traverse": "^7.20.12",
"@babel/traverse": "^7.20.13",
"@babel/types": "^7.20.7",
"@bazel/ibazel": "^0.16.2",
"@bazel/typescript": "4.6.2",
Expand Down Expand Up @@ -1155,7 +1159,7 @@
"resolve": "^1.22.0",
"rxjs-marbles": "^7.0.1",
"sass-loader": "^10.4.1",
"selenium-webdriver": "^4.7.1",
"selenium-webdriver": "^4.8.0",
"simple-git": "^3.16.0",
"sinon": "^7.4.2",
"sort-package-json": "^1.53.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function create({
logger?: jest.Mocked<LoggerFactory>;
configService?: jest.Mocked<IConfigService>;
} = {}): DeeplyMockedKeys<CoreContext> {
return { coreId: Symbol(), env, logger, configService };
return { coreId: Symbol(), env: env as DeeplyMockedKeys<typeof env>, logger, configService };
}

export const mockCoreContext = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/*
* 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 { PluginPackageManifest } from '@kbn/repo-packages';
import { PluginType } from '@kbn/core-base-common';
import { pluginManifestFromPluginPackage } from './plugin_manifest_from_plugin_package';

const kibanaVersion = `1.${Math.round(10 * Math.random())}.1`;
const minimal: PluginPackageManifest = {
type: 'plugin',
id: '@kbn/some-legacy-plugin',
owner: ['@elastic/team-a', '@elastic/team-b'],
plugin: {
id: 'someLegacyPluginId',
browser: true,
server: true,
},
};
const basic: PluginPackageManifest = {
...minimal,
plugin: {
...minimal.plugin,
type: 'preboot',
configPath: ['some', 'legacy'],
enabledOnAnonymousPages: false,
extraPublicDirs: ['foo', 'bar'],
optionalPlugins: ['someOtherPlugin'],
requiredBundles: ['someRequiresBundlePlugin'],
requiredPlugins: ['someRequiredPlugin'],
},
serviceFolders: ['foo', 'bar'],
};

describe('pluginManifestFromPluginPackage()', () => {
it('consumes correct values from plugin package manifest', () => {
expect(pluginManifestFromPluginPackage('static', basic)).toMatchInlineSnapshot(`
Object {
"configPath": Array [
"some",
"legacy",
],
"enabledOnAnonymousPages": false,
"id": "someLegacyPluginId",
"kibanaVersion": "static",
"optionalPlugins": Array [
"someOtherPlugin",
],
"owner": Object {
"name": "@elastic/team-a & @elastic/team-b",
},
"requiredBundles": Array [
"someRequiresBundlePlugin",
],
"requiredPlugins": Array [
"someRequiredPlugin",
],
"server": true,
"serviceFolders": Array [
"foo",
"bar",
],
"type": "preboot",
"ui": true,
"version": "1.0.0",
}
`);
});

it('applies correct defaults', () => {
const pm = pluginManifestFromPluginPackage(kibanaVersion, minimal);
expect(pm).toHaveProperty('type', PluginType.standard);
expect(pm.enabledOnAnonymousPages).toBeUndefined();
expect(pm.serviceFolders).toBeUndefined();
expect(pm).toHaveProperty('kibanaVersion', kibanaVersion);
expect(pm).toHaveProperty('optionalPlugins', []);
expect(pm).toHaveProperty('requiredBundles', []);
expect(pm).toHaveProperty('requiredPlugins', []);
expect(pm).toHaveProperty('owner', {
name: '@elastic/team-a & @elastic/team-b',
});
expect(pm).toHaveProperty('server', true);
expect(pm).toHaveProperty('ui', true);
expect(pm).toHaveProperty('configPath', 'some_legacy_plugin_id');
});

it('reflects plugin.server', () => {
expect(
pluginManifestFromPluginPackage(kibanaVersion, {
...minimal,
plugin: { ...minimal.plugin, server: false },
})
).toHaveProperty('server', false);
expect(
pluginManifestFromPluginPackage(kibanaVersion, {
...minimal,
plugin: { ...minimal.plugin, server: true },
})
).toHaveProperty('server', true);
});

it('reflects plugin.browser', () => {
expect(
pluginManifestFromPluginPackage(kibanaVersion, {
...minimal,
plugin: { ...minimal.plugin, browser: false },
})
).toHaveProperty('ui', false);
expect(
pluginManifestFromPluginPackage(kibanaVersion, {
...minimal,
plugin: { ...minimal.plugin, browser: true },
})
).toHaveProperty('ui', true);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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 { snakeCase } from 'lodash';
import { PluginPackageManifest } from '@kbn/repo-packages';
import { PluginManifest } from '@kbn/core-plugins-server';
import { PluginType } from '@kbn/core-base-common';

export function pluginManifestFromPluginPackage(
kibanaVersion: string,
manifest: PluginPackageManifest
): PluginManifest {
return {
type: manifest.plugin.type === 'preboot' ? PluginType.preboot : PluginType.standard,
id: manifest.plugin.id,
version: '1.0.0',
enabledOnAnonymousPages: manifest.plugin.enabledOnAnonymousPages,
serviceFolders: manifest.serviceFolders,
kibanaVersion,
optionalPlugins: manifest.plugin.optionalPlugins ?? [],
requiredBundles: manifest.plugin.requiredBundles ?? [],
requiredPlugins: manifest.plugin.requiredPlugins ?? [],
owner: {
name: manifest.owner.join(' & '),
},
server: manifest.plugin.server,
ui: manifest.plugin.browser,
configPath: manifest.plugin.configPath ?? snakeCase(manifest.plugin.id),
};
}
Loading

0 comments on commit 7c8049d

Please sign in to comment.