Skip to content

Commit

Permalink
Merge branch 'elastic:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
opauloh authored Nov 9, 2021
2 parents f072f21 + 13d651b commit 528c26d
Show file tree
Hide file tree
Showing 770 changed files with 23,149 additions and 18,160 deletions.
13 changes: 13 additions & 0 deletions .buildkite/scripts/build_kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ else
node scripts/build
fi

if [[ "${GITHUB_PR_LABELS:-}" == *"ci:deploy-cloud"* ]]; then
echo "--- Build Kibana Cloud Distribution"
node scripts/build \
--skip-initialize \
--skip-generic-folders \
--skip-platform-folders \
--skip-archives \
--docker-images \
--skip-docker-ubi \
--skip-docker-centos \
--skip-docker-contexts
fi

echo "--- Archive Kibana Distribution"
linuxBuild="$(find "$KIBANA_DIR/target" -name 'kibana-*-linux-x86_64.tar.gz')"
installDir="$KIBANA_DIR/install/kibana"
Expand Down
358 changes: 179 additions & 179 deletions api_docs/alerting.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dev_docs/tutorials/testing_plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ describe('Plugin', () => {
const [coreStartMock, startDepsMock] = await coreSetup.getStartServices();
const unmountMock = jest.fn();
renderAppMock.mockReturnValue(unmountMock);
const params = coreMock.createAppMountParamters('/fake/base/path');
const params = coreMock.createAppMountParameters('/fake/base/path');

new Plugin(coreMock.createPluginInitializerContext()).setup(coreSetup);
// Grab registered mount function
Expand Down Expand Up @@ -528,7 +528,7 @@ import { renderApp } from './application';

describe('renderApp', () => {
it('mounts and unmounts UI', () => {
const params = coreMock.createAppMountParamters('/fake/base/path');
const params = coreMock.createAppMountParameters('/fake/base/path');
const core = coreMock.createStart();

// Verify some expected DOM element is rendered into the element
Expand All @@ -540,7 +540,7 @@ describe('renderApp', () => {
});

it('unsubscribes from uiSettings', () => {
const params = coreMock.createAppMountParamters('/fake/base/path');
const params = coreMock.createAppMountParameters('/fake/base/path');
const core = coreMock.createStart();
// Create a fake Subject you can use to monitor observers
const settings$ = new Subject();
Expand All @@ -555,7 +555,7 @@ describe('renderApp', () => {
});

it('resets chrome visibility', () => {
const params = coreMock.createAppMountParamters('/fake/base/path');
const params = coreMock.createAppMountParameters('/fake/base/path');
const core = coreMock.createStart();

// Verify stateful Core API was called on mount
Expand Down
2 changes: 0 additions & 2 deletions docs/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ Review important information about the {kib} 8.0.0 releases.
[[release-notes-8.0.0-beta1]]
== {kib} 8.0.0-beta1

coming::[8.0.0-beta1]

Review the {kib} 8.0.0-beta1 changes, then use the <<upgrade-assistant,Upgrade Assistant>> to complete the upgrade.

[float]
Expand Down
4 changes: 2 additions & 2 deletions docs/api/upgrade-assistant/batch_reindexing.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

experimental["The underlying Upgrade Assistant concepts are stable, but the APIs for managing Upgrade Assistant are experimental."]

Start or resume multiple reindexing tasks in one request. Additionally, reindexing tasks started or resumed
Start or resume multiple <<start-resume-reindex, reindexing>> tasks in one request. Additionally, reindexing tasks started or resumed
via the batch endpoint will be placed on a queue and executed one-by-one, which ensures that minimal cluster resources
are consumed over time.

Expand Down Expand Up @@ -76,7 +76,7 @@ Similar to the <<start-resume-reindex, start or resume endpoint>>, the API retur
}
--------------------------------------------------

<1> A list of reindex operations created, the order in the array indicates the order in which tasks will be executed.
<1> A list of reindex tasks created, the order in the array indicates the order in which tasks will be executed.
<2> Presence of this key indicates that the reindex job will occur in the batch.
<3> A Unix timestamp of when the reindex task was placed in the queue.
<4> A list of errors that may have occurred preventing the reindex task from being created.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/upgrade-assistant/cancel_reindex.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<titleabbrev>Cancel reindex</titleabbrev>
++++

experimental[] Cancel reindexes that are waiting for the {es} reindex task to complete. For example, `lastCompletedStep` set to `40`.
experimental["The underlying Upgrade Assistant concepts are stable, but the APIs for managing Upgrade Assistant are experimental."]

Cancel reindexes that are waiting for the Elasticsearch reindex task to complete. For example, `lastCompletedStep` set to `40`.

Expand Down
8 changes: 5 additions & 3 deletions docs/api/upgrade-assistant/check_reindex_status.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<titleabbrev>Check reindex status</titleabbrev>
++++

experimental[] Check the status of the reindex operation.
experimental["The underlying Upgrade Assistant concepts are stable, but the APIs for managing Upgrade Assistant are experimental."]

Check the status of the reindex task.

[[check-reindex-status-request]]
==== Request
Expand Down Expand Up @@ -43,7 +45,7 @@ The API returns the following:
<2> Current status of the reindex. For details, see <<status-code,Status codes>>.
<3> Last successfully completed step of the reindex. For details, see <<step-code,Step codes>> table.
<4> Task ID of the reindex task in Elasticsearch. Only present if reindexing has started.
<5> Percentage of how far the reindexing task in Elasticsearch has progressed, in decimal from from 0 to 1.
<5> Percentage of how far the reindexing task in Elasticsearch has progressed, in decimal form from 0 to 1.
<6> Error that caused the reindex to fail, if it failed.
<7> An array of any warning codes explaining what changes are required for this reindex. For details, see <<warning-code,Warning codes>>.
<8> Specifies if the user has sufficient privileges to reindex this index. When security is unavailable or disables, returns `true`.
Expand Down Expand Up @@ -73,7 +75,7 @@ To resume the reindex, you must submit a new POST request to the `/api/upgrade_a
==== Step codes

`0`::
The reindex operation has been created in Kibana.
The reindex task has been created in Kibana.

`10`::
The index group services stopped. Only applies to some system indices.
Expand Down
17 changes: 13 additions & 4 deletions docs/api/upgrade-assistant/reindexing.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@
<titleabbrev>Start or resume reindex</titleabbrev>
++++

experimental[] Start a new reindex or resume a paused reindex.
experimental["The underlying Upgrade Assistant concepts are stable, but the APIs for managing Upgrade Assistant are experimental."]

Start a new reindex or resume a paused reindex. Following steps are performed during
a reindex task:

. Setting the index to read-only
. Creating a new index
. {ref}/docs-reindex.html[Reindexing] documents into the new index
. Creating an index alias for the new index
. Deleting the old index


Start a new reindex or resume a paused reindex.

[[start-resume-reindex-request]]
==== Request
Expand Down Expand Up @@ -40,6 +49,6 @@ The API returns the following:
<1> The name of the new index.
<2> The reindex status. For more information, refer to <<status-code,Status codes>>.
<3> The last successfully completed step of the reindex. For more information, refer to <<step-code,Step codes>>.
<4> The task ID of the reindex task in {es}. Appears when the reindexing starts.
<5> The progress of the reindexing task in {es}. Appears in decimal form, from 0 to 1.
<4> The task ID of the {ref}/docs-reindex.html[reindex] task in {es}. Appears when the reindexing starts.
<5> The progress of the {ref}/docs-reindex.html[reindexing] task in {es}. Appears in decimal form, from 0 to 1.
<6> The error that caused the reindex to fail, if it failed.
2 changes: 1 addition & 1 deletion docs/api/upgrade-assistant/status.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<titleabbrev>Upgrade readiness status</titleabbrev>
++++

experimental[] Check the status of your cluster.
experimental["The underlying Upgrade Assistant concepts are stable, but the APIs for managing Upgrade Assistant are experimental."]

Check the status of your cluster.

Expand Down
3 changes: 1 addition & 2 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,7 @@ As a developer you can reuse and extend built-in alerts and actions UI functiona
|{kib-repo}blob/{branch}/x-pack/plugins/upgrade_assistant/README.md[upgradeAssistant]
|Upgrade Assistant helps users prepare their Stack for being upgraded to the next major. Its primary
purposes are to:
|Upgrade Assistant helps users prepare their Stack for being upgraded to the next major. It will only be enabled on the last minor before the next major release. This is controlled via the config: xpack.upgrade_assistant.readonly (#101296).
|{kib-repo}blob/{branch}/x-pack/plugins/uptime/README.md[uptime]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
readonly links: {
readonly settings: string;
readonly elasticStackGetStarted: string;
readonly upgrade: {
readonly upgradingElasticStack: string;
};
readonly apm: {
readonly kibanaSettings: string;
readonly supportedServiceMaps: string;
Expand Down Expand Up @@ -133,7 +136,11 @@ readonly links: {
};
readonly addData: string;
readonly kibana: string;
readonly upgradeAssistant: string;
readonly upgradeAssistant: {
readonly overview: string;
readonly batchReindex: string;
readonly remoteReindex: string;
};
readonly rollupJobs: string;
readonly elasticsearch: Record<string, string>;
readonly siem: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export class HelloWorldEmbeddable extends Embeddable {
* @param node
*/
public render(node: HTMLElement) {
node.innerHTML = '<div data-test-subj="helloWorldEmbeddable">HELLO WORLD!</div>';
node.innerHTML =
'<div data-test-subj="helloWorldEmbeddable" data-render-complete="true">HELLO WORLD!</div>';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function wrapSearchTerms(task: string, search?: string) {

export function TodoEmbeddableComponentInner({ input: { icon, title, task, search } }: Props) {
return (
<EuiFlexGroup gutterSize="none">
<EuiFlexGroup gutterSize="none" data-render-complete="true">
<EuiFlexItem grow={false}>
{icon ? <EuiIcon type={icon} size="l" /> : <EuiAvatar name={title || task} size="l" />}
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function TodoRefEmbeddableComponentInner({
const title = savedAttributes?.title;
const task = savedAttributes?.task;
return (
<EuiFlexGroup>
<EuiFlexGroup data-render-complete="true">
<EuiFlexItem grow={false}>
{icon ? (
<EuiIcon type={icon} size="l" />
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
"backport-skip-ci": "backport --prDescription \"[skip-ci]\"",
"storybook": "node scripts/storybook",
"cover:report": "nyc report --temp-dir target/kibana-coverage/functional --report-dir target/coverage/report --reporter=lcov && open ./target/coverage/report/lcov-report/index.html",
"cover:functional:merge": "nyc report --temp-dir target/kibana-coverage/functional --report-dir target/coverage/report/functional --reporter=json-summary"
"cover:functional:merge": "nyc report --temp-dir target/kibana-coverage/functional --report-dir target/coverage/report/functional --reporter=json-summary",
"postinstall": "node scripts/kbn patch_native_modules"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -98,7 +99,7 @@
"@elastic/apm-rum": "^5.9.1",
"@elastic/apm-rum-react": "^1.3.1",
"@elastic/apm-synthtrace": "link:bazel-bin/packages/elastic-apm-synthtrace",
"@elastic/charts": "38.1.3",
"@elastic/charts": "39.0.0",
"@elastic/datemath": "link:bazel-bin/packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.35",
"@elastic/ems-client": "8.0.0",
Expand Down
49 changes: 49 additions & 0 deletions packages/kbn-eslint-plugin-eslint/helpers/find_kibana_root.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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.
*/

const path = require('path');
const fs = require('fs');

function isKibanaRoot(maybeKibanaRoot) {
try {
const packageJsonPath = path.join(maybeKibanaRoot, 'package.json');
fs.accessSync(packageJsonPath, fs.constants.R_OK);
const packageJsonContent = fs.readFileSync(packageJsonPath);
return JSON.parse(packageJsonContent).name === 'kibana';
} catch (e) {
return false;
}
}

module.exports = function findKibanaRoot() {
let maybeKibanaRoot = path.resolve(__dirname, '../../..');

// when using syslinks, __dirname reports outside of the repo
// if that's the case, the path will contain .cache/bazel
if (!maybeKibanaRoot.includes('.cache/bazel')) {
return maybeKibanaRoot;
}

// process.argv[1] would be the eslint binary, a correctly-set editor
// will use a local eslint inside the repo node_modules and its value
// should be `ACTUAL_KIBANA_ROOT/node_modules/.bin/eslint`
maybeKibanaRoot = path.resolve(process.argv[1], '../../../');
if (isKibanaRoot(maybeKibanaRoot)) {
return maybeKibanaRoot;
}

// eslint should run on the repo root level
// try to use process.cwd as the kibana root
maybeKibanaRoot = process.cwd();
if (isKibanaRoot(maybeKibanaRoot)) {
return maybeKibanaRoot;
}

// fallback to the first predicted path (original script)
return maybeKibanaRoot;
};
3 changes: 2 additions & 1 deletion packages/kbn-eslint-plugin-eslint/rules/module_migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/

const path = require('path');
const KIBANA_ROOT = path.resolve(__dirname, '../../..');
const findKibanaRoot = require('../helpers/find_kibana_root');
const KIBANA_ROOT = findKibanaRoot();

function checkModuleNameNode(context, mappings, node, desc = 'Imported') {
const mapping = mappings.find(
Expand Down
71 changes: 71 additions & 0 deletions packages/kbn-eslint-plugin-eslint/rules/module_migration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,76 @@ ruleTester.run('@kbn/eslint/module-migration', rule, {
export const foo2 = 'bar'
`,
},
/**
* Given this tree:
* x-pack/
* - common/
* - foo.ts <-- the target import
* - other/
* - folder/
* - bar.ts <-- the linted fle
* import "x-pack/common/foo" should be
* import ../../foo
*/
{
code: dedent`
import "x-pack/common/foo"
`,
filename: 'x-pack/common/other/folder/bar.ts',
options: [
[
{
from: 'x-pack',
to: 'foo',
toRelative: 'x-pack',
},
],
],
errors: [
{
line: 1,
message: 'Imported module "x-pack/common/foo" should be "../../foo"',
},
],
output: dedent`
import '../../foo'
`,
},
/**
* Given this tree:
* x-pack/
* - common/
* - foo.ts <-- the target import
* - another/
* - posible
* - example <-- the linted file
*
* import "x-pack/common/foo" should be
* import ../../common/foo
*/
{
code: dedent`
import "x-pack/common/foo"
`,
filename: 'x-pack/another/possible/example.ts',
options: [
[
{
from: 'x-pack',
to: 'foo',
toRelative: 'x-pack',
},
],
],
errors: [
{
line: 1,
message: 'Imported module "x-pack/common/foo" should be "../../common/foo"',
},
],
output: dedent`
import '../../common/foo'
`,
},
],
});
2 changes: 2 additions & 0 deletions packages/kbn-monaco/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ RUNTIME_DEPS = [
"@npm//monaco-editor",
"@npm//raw-loader",
"@npm//regenerator-runtime",
"@npm//rxjs",
]

TYPES_DEPS = [
"//packages/kbn-i18n",
"@npm//antlr4ts",
"@npm//monaco-editor",
"@npm//rxjs",
"@npm//@types/jest",
"@npm//@types/node",
]
Expand Down
Loading

0 comments on commit 528c26d

Please sign in to comment.