Skip to content

Commit a90ebe6

Browse files
Merge branch 'master' into unskip-flaky-tests
2 parents e380bfd + bca0d1c commit a90ebe6

File tree

216 files changed

+3770
-2303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+3770
-2303
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,15 @@
149149
# Kibana Alerting Services
150150
/x-pack/legacy/plugins/alerting/ @elastic/kibana-alerting-services
151151
/x-pack/legacy/plugins/actions/ @elastic/kibana-alerting-services
152+
/x-pack/plugins/alerting/ @elastic/kibana-alerting-services
152153
/x-pack/plugins/actions/ @elastic/kibana-alerting-services
153154
/x-pack/plugins/event_log/ @elastic/kibana-alerting-services
154155
/x-pack/plugins/task_manager/ @elastic/kibana-alerting-services
155156
/x-pack/test/alerting_api_integration/ @elastic/kibana-alerting-services
156157
/x-pack/test/plugin_api_integration/plugins/task_manager/ @elastic/kibana-alerting-services
157158
/x-pack/test/plugin_api_integration/test_suites/task_manager/ @elastic/kibana-alerting-services
158159
/x-pack/legacy/plugins/triggers_actions_ui/ @elastic/kibana-alerting-services
160+
/x-pack/plugins/triggers_actions_ui/ @elastic/kibana-alerting-services
159161
/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/ @elastic/kibana-alerting-services
160162
/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/ @elastic/kibana-alerting-services
161163

docs/api/dashboard/import-dashboard.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ experimental[] Import dashboards and corresponding saved objects.
1616

1717
`force`::
1818
(Optional, boolean) Overwrite any existing objects on ID conflict.
19-
19+
2020
`exclude`::
2121
(Optional, array) Saved object types that you want to exclude from the import.
2222

@@ -28,14 +28,14 @@ Use the complete response body from the <<dashboard-api-export, Export dashboard
2828
[[dashboard-api-import-response-body]]
2929
==== Response body
3030

31-
`objects`::
32-
(array) A top level property that includes the saved objects.
31+
`objects`::
32+
(array) A top level property that includes the saved objects.
3333

3434
[[dashboard-api-import-codes]]
3535
==== Response code
3636

3737
`200`::
38-
Indicates a successful call, even if there are errors importing individual saved objects. If there ar errors, the error information is returned in the response body on an object-by-object basis.
38+
Indicates a successful call, even if there are errors importing individual saved objects. If there are errors, the error information is returned in the response body on an object-by-object basis.
3939

4040
[[dashboard-api-import-example]]
4141
==== Example

packages/kbn-optimizer/src/integration_tests/basic_optimization.test.ts

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const MOCK_REPO_DIR = Path.resolve(TMP_DIR, 'mock_repo');
3333

3434
expect.addSnapshotSerializer(createAbsolutePathSerializer(MOCK_REPO_DIR));
3535

36-
beforeEach(async () => {
36+
beforeAll(async () => {
3737
await del(TMP_DIR);
3838
await cpy('**/*', MOCK_REPO_DIR, {
3939
cwd: MOCK_REPO_SRC,
@@ -42,7 +42,7 @@ beforeEach(async () => {
4242
});
4343
});
4444

45-
afterEach(async () => {
45+
afterAll(async () => {
4646
await del(TMP_DIR);
4747
});
4848

@@ -153,3 +153,32 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
153153
]
154154
`);
155155
});
156+
157+
it('uses cache on second run and exist cleanly', async () => {
158+
const config = OptimizerConfig.create({
159+
repoRoot: MOCK_REPO_DIR,
160+
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],
161+
maxWorkerCount: 1,
162+
});
163+
164+
const msgs = await runOptimizer(config)
165+
.pipe(
166+
tap(state => {
167+
if (state.event?.type === 'worker stdio') {
168+
// eslint-disable-next-line no-console
169+
console.log('worker', state.event.stream, state.event.chunk.toString('utf8'));
170+
}
171+
}),
172+
toArray()
173+
)
174+
.toPromise();
175+
176+
expect(msgs.map(m => m.state.phase)).toMatchInlineSnapshot(`
177+
Array [
178+
"initializing",
179+
"initializing",
180+
"initializing",
181+
"initialized",
182+
]
183+
`);
184+
});

packages/kbn-optimizer/src/optimizer/handle_optimizer_completion.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ export function handleOptimizerCompletion(config: OptimizerConfig) {
4444
return;
4545
}
4646

47+
if (prevState?.phase === 'initialized' && prevState.onlineBundles.length === 0) {
48+
// all bundles cached
49+
return;
50+
}
51+
4752
if (prevState?.phase === 'issue') {
4853
throw createFailError('webpack issue');
4954
}

src/core/MIGRATION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,8 +1197,8 @@ In server code, `core` can be accessed from either `server.newPlatform` or `kbnS
11971197
| `server.route` | [`core.http.createRouter`](/docs/development/core/server/kibana-plugin-server.httpservicesetup.createrouter.md) | [Examples](./MIGRATION_EXAMPLES.md#route-registration) |
11981198
| `server.renderApp()` / `server.renderAppWithDefaultConfig()` | [`context.rendering.render()`](/docs/development/core/server/kibana-plugin-server.iscopedrenderingclient.render.md) | [Examples](./MIGRATION_EXAMPLES.md#render-html-content) |
11991199
| `request.getBasePath()` | [`core.http.basePath.get`](/docs/development/core/server/kibana-plugin-server.httpservicesetup.basepath.md) | |
1200-
| `server.plugins.elasticsearch.getCluster('data')` | [`context.elasticsearch.dataClient`](/docs/development/core/server/kibana-plugin-server.iscopedclusterclient.md) | |
1201-
| `server.plugins.elasticsearch.getCluster('admin')` | [`context.elasticsearch.adminClient`](/docs/development/core/server/kibana-plugin-server.iscopedclusterclient.md) | |
1200+
| `server.plugins.elasticsearch.getCluster('data')` | [`context.core.elasticsearch.dataClient`](/docs/development/core/server/kibana-plugin-server.iscopedclusterclient.md) | |
1201+
| `server.plugins.elasticsearch.getCluster('admin')` | [`context.core.elasticsearch.adminClient`](/docs/development/core/server/kibana-plugin-server.iscopedclusterclient.md) | |
12021202
| `server.plugins.elasticsearch.createCluster(...)` | [`core.elasticsearch.createClient`](/docs/development/core/server/kibana-plugin-server.elasticsearchservicesetup.createclient.md) | |
12031203
| `server.savedObjects.setScopedSavedObjectsClientFactory` | [`core.savedObjects.setClientFactory`](/docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.setclientfactory.md) | |
12041204
| `server.savedObjects.addScopedSavedObjectsClientWrapperFactory` | [`core.savedObjects.addClientWrapper`](/docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.addclientwrapper.md) | |

x-pack/.i18nrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"paths": {
44
"xpack.actions": "plugins/actions",
55
"xpack.advancedUiActions": "plugins/advanced_ui_actions",
6-
"xpack.alerting": "legacy/plugins/alerting",
6+
"xpack.alerting": "plugins/alerting",
77
"xpack.triggersActionsUI": "plugins/triggers_actions_ui",
88
"xpack.apm": ["legacy/plugins/apm", "plugins/apm"],
99
"xpack.beatsManagement": "legacy/plugins/beats_management",

x-pack/legacy/plugins/alerting/index.ts

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,4 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
import { Legacy } from 'kibana';
8-
import { Root } from 'joi';
9-
import { init } from './server';
10-
import mappings from './mappings.json';
11-
12-
export {
13-
AlertingPlugin,
14-
AlertsClient,
15-
AlertType,
16-
AlertExecutorOptions,
17-
PluginSetupContract,
18-
PluginStartContract,
19-
} from './server';
20-
21-
export function alerting(kibana: any) {
22-
return new kibana.Plugin({
23-
id: 'alerting',
24-
configPrefix: 'xpack.alerting',
25-
require: ['kibana', 'elasticsearch', 'actions', 'task_manager', 'encryptedSavedObjects'],
26-
isEnabled(config: Legacy.KibanaConfig) {
27-
return (
28-
config.get('xpack.alerting.enabled') === true &&
29-
config.get('xpack.actions.enabled') === true &&
30-
config.get('xpack.encryptedSavedObjects.enabled') === true &&
31-
config.get('xpack.task_manager.enabled') === true
32-
);
33-
},
34-
config(Joi: Root) {
35-
return Joi.object()
36-
.keys({
37-
enabled: Joi.boolean().default(true),
38-
})
39-
.default();
40-
},
41-
init,
42-
uiExports: {
43-
mappings,
44-
},
45-
});
46-
}
7+
export * from './server';

x-pack/legacy/plugins/alerting/server/extend_route_with_license_check.test.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

x-pack/legacy/plugins/alerting/server/extend_route_with_license_check.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

x-pack/legacy/plugins/alerting/server/index.ts

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,32 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
import { AlertsClient as AlertsClientClass } from './alerts_client';
7+
import { Legacy } from 'kibana';
8+
import { Root } from 'joi';
9+
import mappings from './mappings.json';
810

9-
export type AlertsClient = PublicMethodsOf<AlertsClientClass>;
10-
11-
export { init } from './init';
12-
export { AlertType, AlertingPlugin, AlertExecutorOptions } from './types';
13-
export { PluginSetupContract, PluginStartContract } from './plugin';
11+
export function alerting(kibana: any) {
12+
return new kibana.Plugin({
13+
id: 'alerting',
14+
configPrefix: 'xpack.alerting',
15+
require: ['kibana', 'elasticsearch', 'actions', 'task_manager', 'encryptedSavedObjects'],
16+
isEnabled(config: Legacy.KibanaConfig) {
17+
return (
18+
config.get('xpack.alerting.enabled') === true &&
19+
config.get('xpack.actions.enabled') === true &&
20+
config.get('xpack.encryptedSavedObjects.enabled') === true &&
21+
config.get('xpack.task_manager.enabled') === true
22+
);
23+
},
24+
config(Joi: Root) {
25+
return Joi.object()
26+
.keys({
27+
enabled: Joi.boolean().default(true),
28+
})
29+
.default();
30+
},
31+
uiExports: {
32+
mappings,
33+
},
34+
});
35+
}

0 commit comments

Comments
 (0)