Skip to content

Commit

Permalink
Merge branch 'main' into feat/olm-add_blocklist_tab_in_policy_view-2356
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Mar 14, 2022
2 parents 046b399 + b20628f commit 4d80ba6
Show file tree
Hide file tree
Showing 394 changed files with 9,406 additions and 5,014 deletions.
12 changes: 12 additions & 0 deletions .buildkite/pipelines/flaky_tests/groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@
"key": "oss/accessibility",
"name": "OSS Accessibility"
},
{
"key": "xpack/cypress/security_solution",
"name": "Security Solution - Cypress"
},
{
"key": "xpack/cypress/osquery_cypress",
"name": "Osquery - Cypress"
},
{
"key": "xpack/cypress/fleet_cypress",
"name": "Fleet - Cypress"
},
{
"key": "xpack/cigroup",
"name": "Default CI Group",
Expand Down
23 changes: 22 additions & 1 deletion .buildkite/pipelines/flaky_tests/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*/

const { execSync } = require('child_process');
const groups = /** @type {Array<{key: string, name: string, ciGroups: number }>} */ (
require('./groups.json').groups
);

const concurrency = 25;
const defaultCount = concurrency * 2;
Expand Down Expand Up @@ -113,7 +116,7 @@ steps.push({
label: 'Build Kibana Distribution and Plugins',
agents: { queue: 'c2-8' },
key: 'build',
if: "build.env('BUILD_ID_FOR_ARTIFACTS') == null || build.env('BUILD_ID_FOR_ARTIFACTS') == ''",
if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''",
});

for (const testSuite of testSuites) {
Expand Down Expand Up @@ -183,6 +186,24 @@ for (const testSuite of testSuites) {
concurrency_group: UUID,
concurrency_method: 'eager',
});
case 'cypress':
const CYPRESS_SUITE = CI_GROUP;
const group = groups.find((group) => group.key.includes(CYPRESS_SUITE));
if (!group) {
throw new Error(
`Group configuration was not found in groups.json for the following cypress suite: {${CYPRESS_SUITE}}.`
);
}
steps.push({
command: `.buildkite/scripts/steps/functional/${CYPRESS_SUITE}.sh`,
label: group.name,
agents: { queue: 'ci-group-6' },
depends_on: 'build',
parallelism: RUN_COUNT,
concurrency: concurrency,
concurrency_group: UUID,
concurrency_method: 'eager',
});
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/demo_env/kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ source "$(dirname "${0}")/config.sh"
export KIBANA_IMAGE="gcr.io/elastic-kibana-184716/demo/kibana:$DEPLOYMENT_NAME-$(git rev-parse HEAD)"

echo '--- Build Kibana'
node scripts/build --debug --docker-images --example-plugins --skip-docker-ubi
node scripts/build --debug --docker-images --example-plugins --skip-docker-ubi --skip-docker-cloud --skip-docker-contexts

echo '--- Build Docker image with example plugins'
cd target/example_plugins
Expand Down
2 changes: 1 addition & 1 deletion config/kibana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
#ops.interval: 5000

# Specifies locale to be used for all localizable strings, dates and number formats.
# Supported languages are the following: English - en , by default , Chinese - zh-CN .
# Supported languages are the following: English (default) "en", Chinese "zh-CN", Japanese "ja-JP", French "fr-FR".
#i18n.locale: "en"

# =================== Frequently used (Optional)===================
Expand Down
99 changes: 93 additions & 6 deletions dev_docs/contributing/best_practices.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ tags: ['kibana', 'onboarding', 'dev', 'architecture']

## General

First things first, be sure to review our <DocLink id="kibDevPrinciples" text="development principles"/> and check out all the available
platform <DocLink id="kibBuildingBlocks" text="building blocks"/> that can simplify plugin development.

Be sure to follow our <DocLink id="kibDevPrinciples" text="development principles"/>
and <DocLink id="kibStandards" text="standards and guidelines"/>.
## Documentation

Documentation best practices can be found <DocLink id="kibDocumentation" text="here"/>.
Expand Down Expand Up @@ -54,11 +54,27 @@ We use es-lint rules when possible, but please review our [styleguide](https://g

Es-lint overrides on a per-plugin level are discouraged.

## Plugin best practices
## Using the SavedObjectClient

Don't export <DocLink id="kibPlatformIntro" section="public-plugin-api" text="public APIs"/> without reason. Make your public APIs as small as possible. You will have to maintain them, and consider backward compatibility when making changes.
The <DocLink id="kibCoreSavedObjectsPluginApi" section="def-public.SavedObjectsClient" text="SavedObjectClient" /> should always be used for reading and writing saved objects that you manage. For saved objects managed by other plugins, their plugin APIs should be used instead.

Good:
```
const dataView = dataViewStartContract.get(dataViewId);
```

Bad:
```
const dataView = savedObjectsClient.get(dataViewId) as DataView;
```

## Resusable react components

Add `README.md` to all your plugins and services and include contact information.
Use [EUI](https://elastic.github.io/eui) for all your basic UI components to create a consistent UI experience. We also have generic UI components offered from the <DocLink id="kibKibanaReactPluginApi" text="kibana_react" /> plugin and the <DocLink id="kibSharedUXPluginApi" text="shared_ux" /> plugin.

## Don't export code that doesn't need to be public

Don't export <DocLink id="kibPlatformIntro" section="public-plugin-api" text="public APIs"/> without reason. Make your public APIs as small as possible. You will have to maintain them, and consider backward compatibility when making changes.

## Re-inventing the wheel

Expand Down Expand Up @@ -120,6 +136,77 @@ There are some exceptions where a separate repo makes sense. However, they are e

It may be tempting to get caught up in the dream of writing the next package which is published to npm and downloaded millions of times a week. Knowing the quality of developers that are working on Kibana, this is a real possibility. However, knowing which packages will see mass adoption is impossible to predict. Instead of jumping directly to writing code in a separate repo and accepting all of the complications that come along with it, prefer keeping code inside the Kibana repo. A [Kibana package](https://github.com/elastic/kibana/tree/main/packages) can be used to publish a package to npm, while still keeping the code inside the Kibana repo. Move code to an external repo only when there is a good reason, for example to enable external contributions.

## Licensing

<DocCallOut title="Internal only">

Has there been a discussion about which license this feature should be available under? Open up a license issue in [https://github.com/elastic/dev](https://github.com/elastic/dev) if you are unsure.

</DocCallOut>

## Testing scenarios

Every PR submitted should be accompanied by tests. Read through the <DocLink id="kibDevTutorialTestingPlugins" text="testing plugins tutorial" /> for how to test.

### Browser coverage

Refer to the list of browsers and OS Kibana supports https://www.elastic.co/support/matrix

Does the feature work efficiently on the below listed browsers
- chrome
- Firefox
- Safari
- IE11

### Upgrade Scenarios
- Migration scenarios- Does the feature affect old indices, saved objects ?
- Has the feature been tested with Kibana aliases
- Read/Write privileges of the indices before and after the upgrade?

### Test coverage
- Does the feature have sufficient unit test coverage? (does it handle storeinSessions?)
- Does the feature have sufficient Functional UI test coverage?
- Does the feature have sufficient Rest API coverage test coverage?
- Does the feature have sufficient Integration test coverage?

### Environment configurations

- Kibana should be fully [cross cluster search](https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-cross-cluster-search.html) compatible (aside from admin UIs which only work on the local cluster).
- How does your plugin behave when optional dependencies are disabled?
- How does your app behave under anonymous access, or with security disabled?
- Make sure to test your PR in a cloud environment. Read about the <DocLink id="kibDevTutorialCI" section="labels" text="ci:deploy cloud" /> label which makes this very easy.


## Backward compatibility

Any time you change state that is part of a Saved Object you will have to write a <DocLink id="kibDevDocsSavedObjectsIntro" section="migrations-and-backward-compatibility" text="migration" />.

Never store state from another plugin in your Saved Objects or URLs unless it implements the <DocLink id="kibDevDocsPersistableStateIntro" text="persistable state interface"/>. Remember to check for migrations when deserializing that state.

If you expose state and you wish to allow other plugins to persist you must ensure it implements the <DocLink id="kibDevDocsPersistableStateIntro" text="persistable state interface"/>. This is very common for `by value` entities, like visualizations that exist on a dashboard but are not part of the visualization library. If you make a breaking change to this state you must remember to register a migration for it.

Saved objects exported from past Kibana versions should always continue to work. Bookmarked URLs should also always work. Check out <DocLink id="kibDevKeyConceptsNavigation" section="specifying-state" text="URL Locators" /> to learn about migrating state in URLs.

## Avoid these common mistakes

### Treating Kibana's filesystem as durable storage

Plugins should rarely, if ever, access Kibana's filesystem directly. Kibana instances are commonly ephemeral and anything written to the filesystem will potentially
not be there on restart.

### Storing state in server memory

There are generally multiple instances of Kibana all hosted behind a round-robin load-balancer. As a result, storing state in server memory is risky as there is no
guarantee that a single end-user's HTTP requests will be served by the same Kibana instance.

### Using WebSockets

Kibana has a number of platform services that don't work with WebSockets, for example authentication and authorization. If your use-case would benefit substantially
from websockets, talk to the Kibana Core team about adding support. Do not hack around this limitation, everytime that someone has, it's created so many problems
it's been eventually removed.



## Security best practices

When writing code for Kibana, be sure to follow these best practices to avoid common vulnerabilities. Refer to the included Open Web
Expand Down
4 changes: 2 additions & 2 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,8 @@ newly created modules as well.
Elastic.
|{kib-repo}blob/{branch}/x-pack/plugins/monitoring[monitoring]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/x-pack/plugins/monitoring/readme.md[monitoring]
|This plugin provides the Stack Monitoring kibana application.
|{kib-repo}blob/{branch}/x-pack/plugins/monitoring_collection/README.md[monitoringCollection]
Expand Down
56 changes: 56 additions & 0 deletions docs/management/cases/add-connectors.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[[add-case-connectors]]
== Add connectors

preview::[]

You can add connectors to cases to push information to these external incident
management systems:

* IBM Resilient
* Jira
* ServiceNow ITSM
* ServiceNow SecOps
* {swimlane}

NOTE: To create connectors and send cases to external systems, you must have the
appropriate {kib} feature privileges. Refer to <<setup-cases>>.

[discrete]
[[create-case-connectors]]
== Create connectors

You can create connectors in *Management > {stack-manage-app} > {rules-ui}*, as
described in <<action-types>>. Alternatively, you can create them in
*Management > {stack-manage-app} > Cases*:

. Click *Edit external connection*.
+
[role="screenshot"]
image::images/cases-connectors.png[]

. From the *Incident management system* list, select *Add new connector*.

. Select an external incident management system.

. Enter your required settings. Refer to <<resilient-action-type>>,
<<jira-action-type>>, <<servicenow-action-type>>, <<servicenow-sir-action-type>>,
or <<swimlane-action-type>> for connector configuration details.

. Click *Save*.

[discrete]
[[edit-case-connector-settings]]
== Edit connector settings

You can create additional connectors, update existing connectors, change
the default connector, and change case closure options.

. Go to *Management > {stack-manage-app} > Cases*, click *Edit external connection*.

. To change whether cases are automatically closed after they are sent to an
external system, update the case closure options.

. To change the default connector for new cases, select the connector from the
*Incident management system* list.

. To update a connector, click *Update <connector name>* and edit the connector fields as required.
6 changes: 4 additions & 2 deletions docs/management/cases/cases.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ preview::[]

Cases are used to open and track issues directly in {kib}. All cases list
the original reporter and all the users who contribute to a case (_participants_).
You can also send cases to third party systems by configuring external connectors.
You can also send cases to external incident management systems by configuring
connectors.

[role="screenshot"]
image::images/cases.png[Cases page]
Expand All @@ -17,4 +18,5 @@ You also cannot attach alerts from the {observability} or {security-app} to
cases in *{stack-manage-app}*.

* <<setup-cases>>
* <<manage-cases>>
* <<manage-cases>>
* <<add-case-connectors>>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/management/cases/index.asciidoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include::cases.asciidoc[]
include::setup-cases.asciidoc[leveloffset=+1]
include::manage-cases.asciidoc[leveloffset=+1]
//=== Configure external connectors
include::add-connectors.asciidoc[leveloffset=+1]
5 changes: 2 additions & 3 deletions docs/management/cases/manage-cases.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ TIP: In the `Description` area, you can use
https://www.markdownguide.org/cheat-sheet[Markdown] syntax to create formatted
text.

. For *External incident management system*, select a connector. If you've
previously added one, that connector displays as the default selection.
Otherwise, the default setting is `No connector selected`.
. For *External incident management system*, select a connector. For more
information, refer to <<add-case-connectors>>.

. After you've completed all of the required fields, click *Create case*.

Expand Down
Binary file modified docs/management/connectors/images/jira-connector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/management/connectors/images/servicenow-connector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/management/connectors/images/servicenow-sir-connector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/management/connectors/images/swimlane-connector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 22 additions & 1 deletion fleet_packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,25 @@
in order to verify package integrity.
*/

[]
[
{
"name": "apm",
"version": "8.1.0"
},
{
"name": "elastic_agent",
"version": "1.3.0"
},
{
"name": "endpoint",
"version": "1.5.0"
},
{
"name": "fleet_server",
"version": "1.1.0"
},
{
"name": "synthetics",
"version": "0.9.2"
}
]
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@
"@types/nock": "^10.0.3",
"@types/node": "16.10.2",
"@types/node-fetch": "^2.6.0",
"@types/node-forge": "^1.0.0",
"@types/node-forge": "^1.0.1",
"@types/nodemailer": "^6.4.0",
"@types/normalize-path": "^3.0.0",
"@types/object-hash": "^1.3.0",
Expand Down Expand Up @@ -719,9 +719,9 @@
"@types/yargs": "^15.0.0",
"@types/yauzl": "^2.9.1",
"@types/zen-observable": "^0.8.0",
"@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0",
"@typescript-eslint/typescript-estree": "^5.13.0",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"@typescript-eslint/typescript-estree": "^5.14.0",
"@yarnpkg/lockfile": "^1.1.0",
"abab": "^2.0.4",
"aggregate-error": "^3.1.0",
Expand Down
16 changes: 16 additions & 0 deletions packages/elastic-eslint-config-kibana/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,22 @@ module.exports = {
selector: 'enum',
format: ['PascalCase', 'UPPER_CASE', 'camelCase'],
},
// https://typescript-eslint.io/rules/naming-convention/#ignore-properties-that-require-quotes
// restore check behavior before https://github.com/typescript-eslint/typescript-eslint/pull/4582
{
selector: [
'classProperty',
'objectLiteralProperty',
'typeProperty',
'classMethod',
'objectLiteralMethod',
'typeMethod',
'accessor',
'enumMember'
],
format: null,
modifiers: ['requiresQuotes']
}
],
'@typescript-eslint/explicit-member-accessibility': ['error',
{
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-babel-preset/webpack_preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = () => {
[
require.resolve('@emotion/babel-preset-css-prop'),
{
labelFormat: '[local]',
labelFormat: '[filename]--[local]',
},
],
],
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-generate/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

module.exports = {
preset: '@kbn/test',
preset: '@kbn/test/jest_node',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-generate'],
};
Loading

0 comments on commit 4d80ba6

Please sign in to comment.