Skip to content

Commit

Permalink
Merge branch 'main' into reporting/error-log-queue-retry
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Mar 4, 2022
2 parents 30be389 + 79935f3 commit cfb0778
Show file tree
Hide file tree
Showing 302 changed files with 10,501 additions and 3,124 deletions.
10 changes: 5 additions & 5 deletions .buildkite/pipelines/hourly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ steps:
label: 'Default CI Group'
parallelism: 27
agents:
queue: n2-4
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 250
key: default-cigroup
Expand All @@ -31,7 +31,7 @@ steps:
- command: CI_GROUP=Docker .buildkite/scripts/steps/functional/xpack_cigroup.sh
label: 'Docker CI Group'
agents:
queue: n2-4
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
key: default-cigroup-docker
Expand All @@ -44,7 +44,7 @@ steps:
label: 'OSS CI Group'
parallelism: 11
agents:
queue: ci-group-4d
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
key: oss-cigroup
Expand Down Expand Up @@ -98,7 +98,7 @@ steps:
- command: .buildkite/scripts/steps/functional/oss_firefox.sh
label: 'OSS Firefox Tests'
agents:
queue: ci-group-4d
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
retry:
Expand Down Expand Up @@ -130,7 +130,7 @@ steps:
- command: .buildkite/scripts/steps/functional/oss_misc.sh
label: 'OSS Misc Functional Tests'
agents:
queue: n2-4
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
retry:
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**/*.js.snap
__tmp__
/.es
/.chromium
/build
Expand Down
52 changes: 30 additions & 22 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const DEV_PACKAGES = [
'kbn-storybook',
'kbn-telemetry-tools',
'kbn-test',
'kbn-type-summarizer',
];

/** Directories (at any depth) which include dev-only code. */
Expand Down Expand Up @@ -1632,28 +1633,6 @@ module.exports = {
},
},

/**
* Prettier disables all conflicting rules, listing as last override so it takes precedence
*/
{
files: ['**/*'],
rules: {
...require('eslint-config-prettier').rules,
...require('eslint-config-prettier/react').rules,
...require('eslint-config-prettier/@typescript-eslint').rules,
},
},
/**
* Enterprise Search Prettier override
* Lints unnecessary backticks - @see https://github.com/prettier/eslint-config-prettier/blob/main/README.md#forbid-unnecessary-backticks
*/
{
files: ['x-pack/plugins/enterprise_search/**/*.{ts,tsx}'],
rules: {
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
},
},

/**
* Platform Security Team overrides
*/
Expand Down Expand Up @@ -1768,5 +1747,34 @@ module.exports = {
'@kbn/eslint/no_export_all': 'error',
},
},

{
files: ['packages/kbn-type-summarizer/**/*.ts'],
rules: {
'no-bitwise': 'off',
},
},

/**
* Prettier disables all conflicting rules, listing as last override so it takes precedence
*/
{
files: ['**/*'],
rules: {
...require('eslint-config-prettier').rules,
...require('eslint-config-prettier/react').rules,
...require('eslint-config-prettier/@typescript-eslint').rules,
},
},
/**
* Enterprise Search Prettier override
* Lints unnecessary backticks - @see https://github.com/prettier/eslint-config-prettier/blob/main/README.md#forbid-unnecessary-backticks
*/
{
files: ['x-pack/plugins/enterprise_search/**/*.{ts,tsx}'],
rules: {
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
},
},
],
};
22 changes: 14 additions & 8 deletions .github/workflows/label-qa-fixed-in.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
github.event.pull_request.merged_at &&
contains(github.event.pull_request.labels.*.name, 'Team:Fleet')
outputs:
matrix: ${{ steps.issues_to_label.outputs.value }}
issue_ids: ${{ steps.issues_to_label.outputs.value }}
label_ids: ${{ steps.label_ids.outputs.value }}
steps:
- uses: octokit/graphql-action@v2.x
Expand Down Expand Up @@ -66,22 +66,28 @@ jobs:
label_issues:
needs: fetch_issues_to_label
runs-on: ubuntu-latest
# For each issue closed by the PR run this job

# For each issue closed by the PR x each label to apply, run this job
if: |
fromJSON(needs.fetch_issues_to_label.outputs.issue_ids).length > 0 &&
fromJSON(needs.fetch_issues_to_label.outputs.label_ids).length > 0
strategy:
matrix:
issueNodeId: ${{ fromJSON(needs.fetch_issues_to_label.outputs.matrix) }}
name: Label issue ${{ matrix.issueNodeId }}
issueId: ${{ fromJSON(needs.fetch_issues_to_label.outputs.issue_ids) }}
labelId: ${{ fromJSON(needs.fetch_issues_to_label.outputs.label_ids) }}

name: Label issue ${{ matrix.issueId }} with ${{ matrix.labelId }}
steps:
- uses: octokit/graphql-action@v2.x
id: add_labels_to_closed_issue
with:
query: |
mutation add_label($issueid: ID!, $labelids:[ID!]!) {
addLabelsToLabelable(input: {labelableId: $issueid, labelIds: $labelids}) {
mutation add_label($issueid: ID!, $labelid:ID!) {
addLabelsToLabelable(input: {labelableId: $issueid, labelIds: [$labelid]}) {
clientMutationId
}
}
issueid: ${{ matrix.issueNodeId }}
labelids: ${{ fromJSON(needs.fetch_issues_to_label.outputs.label_ids) }}
issueid: ${{ matrix.issueId }}
labelid: ${{ matrix.labelId }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ target
*.iml
*.log
types.eslint.config.js
__tmp__

# Ignore example plugin builds
/examples/*/build
Expand Down
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"usageCollection": "src/plugins/usage_collection",
"utils": "packages/kbn-securitysolution-utils/src",
"visDefaultEditor": "src/plugins/vis_default_editor",
"visTypeGauge": "src/plugins/vis_types/gauge",
"visTypeHeatmap": "src/plugins/vis_types/heatmap",
"visTypeMarkdown": "src/plugins/vis_type_markdown",
"visTypeMetric": "src/plugins/vis_types/metric",
Expand Down
4 changes: 4 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,8 @@ yarn_install(
symlink_node_modules = True,
quiet = False,
frozen_lockfile = False,
environment = {
"SASS_BINARY_SITE": "https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-sass",
"RE2_DOWNLOAD_MIRROR": "https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/node-re2",
}
)
132 changes: 2 additions & 130 deletions dev_docs/contributing/best_practices.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,137 +12,9 @@ tags: ['kibana', 'onboarding', 'dev', 'architecture']
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.

## Developer documentation
## Documentation

### High-level documentation

#### Structure

Refer to [divio documentation](https://documentation.divio.com/) for guidance on where and how to structure our high-level documentation.

<DocLink id="kibDevDocsWelcome" text="Getting started" /> and
<DocLink id="kibPlatformIntro" text="Key concepts" /> sections are both _explanation_ oriented,
<DocLink id="kibDevTutorialDebugging" text="Tutorials" /> covers both _tutorials_ and _How to_, and the <DocLink
id="kibDevDocsApiWelcome"
text="API documentation"
/> section covers _reference_ material.

#### Location

If the information spans multiple plugins, consider adding it to the [dev_docs](https://github.com/elastic/kibana/tree/main/dev_docs) folder. If it is plugin specific, consider adding it inside the plugin folder. Write it in an mdx file if you would like it to show up in our new (beta) documentation system.

<DocCallOut title="internal only">

To add docs into the new docs system, create an `.mdx` file that
contains <DocLink id="docsSyntax" section="frontmatter" text="frontmatter"/>. Read about the syntax <DocLink id="docsSyntax" text="here"/>. An extra step is needed to add a menu item. <DocLink id="docsSetup" text="These instructions" /> will walk you through how to set the docs system
up locally and edit the nav menu.

</DocCallOut>

#### Keep content fresh

A fresh pair of eyes are invaluable. Recruit new hires to read, review and update documentation. Leads should also periodically review documentation to ensure it stays up to date. File issues any time you notice documentation is outdated.

#### Consider your target audience

Documentation in the Kibana Developer Guide is targeted towards developers building Kibana plugins. Keep implementation details about internal plugin code out of these docs.

#### High to low level

When a developer first lands in our docs, think about their journey. Introduce basic concepts before diving into details. The left navigation should be set up so documents on top are higher level than documents near the bottom.

#### Think outside-in

It's easy to forget what it felt like to first write code in Kibana, but do your best to frame these docs "outside-in". Don't use esoteric, internal language unless a definition is documented and linked. The fresh eyes of a new hire can be a great asset.

### API documentation

We automatically generate <DocLink id="kibDevDocsApiWelcome" text="API documentation"/>. The following guidelines will help ensure your <DocLink id="kibPlatformIntro" section="public-plugin-api" text="public APIs" /> are useful.

#### Code comments

Every publicly exposed function, class, interface, type, parameter and property should have a comment using JSDoc style comments.

- Use `@param` tags for every function parameter.
- Use `@returns` tags for return types.
- Use `@throws` when appropriate.
- Use `@beta` or `@deprecated` when appropriate.
- Use `@removeBy {version}` on `@deprecated` APIs. The version should be the last version the API will work in. For example, `@removeBy 7.15` means the API will be removed in 7.16. This lets us avoid mid-release cycle coordination. The API can be removed as soon as the 7.15 branch is cut.
- Use `@internal` to indicate this API item is intended for internal use only, which will also remove it from the docs.

#### Interfaces vs inlined types

Prefer types and interfaces over complex inline objects. For example, prefer:

```ts
/**
* The SearchSpec interface contains settings for creating a new SearchService, like
* username and password.
*/
export interface SearchSpec {
/**
* Stores the username. Duh,
*/
username: string;
/**
* Stores the password. I hope it's encrypted!
*/
password: string;
}

/**
* Retrieve search services
* @param searchSpec Configuration information for initializing the search service.
* @returns the id of the search service
*/
export getSearchService: (searchSpec: SearchSpec) => string;
```

over:

```ts
/**
* Retrieve search services
* @param searchSpec Configuration information for initializing the search service.
* @returns the id of the search service
*/
export getSearchService: (searchSpec: { username: string; password: string }) => string;
```

In the former, there will be a link to the `SearchSpec` interface with documentation for the `username` and `password` properties. In the latter the object will render inline, without comments:

![prefer interfaces documentation](../assets/dev_docs_nested_object.png)

#### Export every type used in a public API

When a publicly exported API items references a private type, this results in a broken link in our docs system. The private type is, by proxy, part of your public API, and as such, should be exported.

Do:

```ts
export interface AnInterface { bar: string };
export type foo: string | AnInterface;
```

Don't:

```ts
interface AnInterface { bar: string };
export type foo: string | AnInterface;
```

#### Avoid “Pick”

`Pick` not only ends up being unhelpful in our documentation system, but it's also of limited help in your IDE. For that reason, avoid `Pick` and other similarly complex types on your public API items. Using these semantics internally is fine.

![pick api documentation](../assets/api_doc_pick.png)

### Example plugins

Running Kibana with `yarn start --run-examples` will include all [example plugins](https://github.com/elastic/kibana/tree/main/examples). These are tested examples of platform services in use. We strongly encourage anyone providing a platform level service or <DocLink id="kibBuildingBlocks" text="building block"/> to include a tutorial that links to a tested example plugin. This is better than relying on copied code snippets, which can quickly get out of date.

You can also visit these [examples plugins hosted online](https://demo.kibana.dev/8.0/app/home). Note that because anonymous access is enabled, some
of the demos are currently not working.
Documentation best practices can be found <DocLink id="kibDocumentation" text="here"/>.

## Performance

Expand Down
Loading

0 comments on commit cfb0778

Please sign in to comment.