Skip to content

Commit 6386a0d

Browse files
committed
Merge branch 'master' of https://github.com/elastic/kibana into dynamic-style-time
2 parents 3adaec0 + 1455932 commit 6386a0d

File tree

133 files changed

+3316
-2372
lines changed

Some content is hidden

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

133 files changed

+3316
-2372
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,12 @@ Another tool we use for enforcing consistent coding style is EditorConfig, which
309309
Note that for VSCode, to enable "live" linting of TypeScript (and other) file types, you will need to modify your local settings, as shown below. The default for the ESLint extension is to only lint JavaScript file types.
310310

311311
```json
312-
"eslint.validate": [
313-
"javascript",
314-
"javascriptreact",
315-
"typescript",
316-
"typescriptreact",
317-
]
312+
"eslint.validate": [
313+
"javascript",
314+
"javascriptreact",
315+
{ "language": "typescript", "autoFix": true },
316+
{ "language": "typescriptreact", "autoFix": true }
317+
]
318318
```
319319

320320
### Internationalization

docs/api/spaces-management.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Manage your {kib} spaces.
1010
* <<spaces-api-get-all, Get all {kib} spaces API>>
1111
* <<spaces-api-delete, Delete space API>>
1212
* <<spaces-api-copy-saved-objects, Copy saved objects to space API>>
13-
*<<spaces-api-resolve-copy-saved-objects-conflicts , Resolve copy saved objects to space conflicts API>>
13+
* <<spaces-api-resolve-copy-saved-objects-conflicts, Resolve copy saved objects to space conflicts API>>
1414

1515
include::spaces-management/post.asciidoc[]
1616
include::spaces-management/put.asciidoc[]

docs/code/code-install-lang-server.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
[[code-install-lang-server]]
22
== Install language server
33

4-
*Code* comes with built-in language support for TypeScript. You can install additional languages as a {kib} plugin.
4+
*Code* comes with built-in language support for TypeScript. You can install additional languages as a {kib} plugin. Plugin's reduce the distribution size to run Code inside {kib}. Install only the languages needed for your indexed repositories.
55

66
[role="screenshot"]
77
image::images/code-lang-server-tab.png[]
88

99
For the current version, *Code* supports the following languages in addition to TypeScript:
1010

1111
* `Java`
12+
* `GO`
1213

1314
You can check the status of the language servers and get installation instructions on the *Language Servers* tab. Make sure the status of the language server is `INSTALLED` or `RUNNING` after you restart the {kib} instance.
1415
[role="screenshot"]

docs/developer/plugin/development-plugin-resources.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ node scripts/generate_plugin my_plugin_name # replace "my_plugin_name" with your
2828
The Kibana directory must be named `kibana`, and your plugin directory should be located in the root of `kibana` in a `plugins` directory, for example:
2929

3030
["source","shell"]
31-
-----------
31+
----
3232
.
3333
└── kibana
3434
└── plugins
3535
├── foo-plugin
3636
└── bar-plugin
37-
--------
37+
----
3838

3939
[float]
4040
==== References in the code
3.94 KB
Loading
18 KB
Loading

docs/user/extend.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010

1111
--
1212

13-
include::graph/index.asciidoc[leveloffset=+1]
13+
include::graph/index.asciidoc[]
1414

1515
include::ml/index.asciidoc[]

packages/kbn-plugin-generator/integration_tests/generate_plugin.test.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,29 @@ describe(`running the plugin-generator via 'node scripts/generate_plugin.js plug
8181
await execa('yarn', ['build'], { cwd: generatedPath });
8282
});
8383

84-
it(`'yarn start' should result in the spec plugin being initialized on kibana's stdout`, async () => {
84+
describe('with es instance', () => {
8585
const log = new ToolingLog();
86+
8687
const es = createLegacyEsTestCluster({ license: 'basic', log });
87-
await es.start();
88-
await withProcRunner(log, async proc => {
89-
await proc.run('kibana', {
90-
cmd: 'yarn',
91-
args: [
92-
'start',
93-
'--optimize.enabled=false',
94-
'--logging.json=false',
95-
'--migrations.skip=true',
96-
],
97-
cwd: generatedPath,
98-
wait: /ispec_plugin.+Status changed from uninitialized to green - Ready/,
88+
beforeAll(es.start);
89+
afterAll(es.stop);
90+
91+
it(`'yarn start' should result in the spec plugin being initialized on kibana's stdout`, async () => {
92+
await withProcRunner(log, async proc => {
93+
await proc.run('kibana', {
94+
cmd: 'yarn',
95+
args: [
96+
'start',
97+
'--optimize.enabled=false',
98+
'--logging.json=false',
99+
'--migrations.skip=true',
100+
],
101+
cwd: generatedPath,
102+
wait: /ispec_plugin.+Status changed from uninitialized to green - Ready/,
103+
});
104+
await proc.stop('kibana');
99105
});
100-
await proc.stop('kibana');
101106
});
102-
await es.stop();
103107
});
104108

105109
it(`'yarn preinstall' should exit 0`, async () => {

packages/kbn-test/src/failed_tests_reporter/github_api.ts

Lines changed: 60 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Url from 'url';
2121

2222
import Axios, { AxiosRequestConfig } from 'axios';
2323
import parseLinkHeader from 'parse-link-header';
24-
import { ToolingLog, isAxiosResponseError } from '@kbn/dev-utils';
24+
import { ToolingLog, isAxiosResponseError, isAxiosRequestError } from '@kbn/dev-utils';
2525

2626
const BASE_URL = 'https://api.github.com/repos/elastic/kibana/';
2727

@@ -33,7 +33,11 @@ export interface GithubIssue {
3333
body: string;
3434
}
3535

36-
type RequestOptions = AxiosRequestConfig & { safeForDryRun?: boolean };
36+
type RequestOptions = AxiosRequestConfig & {
37+
safeForDryRun?: boolean;
38+
maxAttempts?: number;
39+
attempt?: number;
40+
};
3741

3842
export class GithubApi {
3943
private readonly x = Axios.create({
@@ -78,7 +82,8 @@ export class GithubApi {
7882
issues.push(issue);
7983
}
8084

81-
const parsed = parseLinkHeader(resp.headers.link);
85+
const parsed =
86+
typeof resp.headers.link === 'string' ? parseLinkHeader(resp.headers.link) : undefined;
8287
if (parsed && parsed.next && parsed.next.url) {
8388
nextRequest = {
8489
safeForDryRun: true,
@@ -139,31 +144,64 @@ export class GithubApi {
139144
return resp.data.html_url;
140145
}
141146

142-
private async request<T>(options: RequestOptions, dryRunResponse: T) {
147+
private async request<T>(
148+
options: RequestOptions,
149+
dryRunResponse: T
150+
): Promise<{
151+
status: number;
152+
statusText: string;
153+
headers: Record<string, string | string[] | undefined>;
154+
data: T;
155+
}> {
143156
const executeRequest = !this.dryRun || options.safeForDryRun;
157+
const maxAttempts = options.maxAttempts || 5;
158+
const attempt = options.attempt || 1;
159+
144160
this.log.verbose('Github API', executeRequest ? 'Request' : 'Dry Run', options);
145161

146-
if (executeRequest) {
147-
try {
148-
return await this.x.request<T>(options);
149-
} catch (error) {
150-
if (isAxiosResponseError(error)) {
151-
throw new Error(
152-
`[${error.config.method} ${error.config.url}] ${error.response.status} ${
153-
error.response.statusText
154-
} Error: ${JSON.stringify(error.response.data)}`
155-
);
162+
if (!executeRequest) {
163+
return {
164+
status: 200,
165+
statusText: 'OK',
166+
headers: {},
167+
data: dryRunResponse,
168+
};
169+
}
170+
171+
try {
172+
return await this.x.request<T>(options);
173+
} catch (error) {
174+
const unableToReachGithub = isAxiosRequestError(error);
175+
const githubApiFailed = isAxiosResponseError(error) && error.response.status >= 500;
176+
const errorResponseLog =
177+
isAxiosResponseError(error) &&
178+
`[${error.config.method} ${error.config.url}] ${error.response.status} ${error.response.statusText} Error`;
179+
180+
if ((unableToReachGithub || githubApiFailed) && attempt < maxAttempts) {
181+
const waitMs = 1000 * attempt;
182+
183+
if (errorResponseLog) {
184+
this.log.error(`${errorResponseLog}: waiting ${waitMs}ms to retry`);
185+
} else {
186+
this.log.error(`Unable to reach github, waiting ${waitMs}ms to retry`);
156187
}
157188

158-
throw error;
189+
await new Promise(resolve => setTimeout(resolve, waitMs));
190+
return await this.request<T>(
191+
{
192+
...options,
193+
maxAttempts,
194+
attempt: attempt + 1,
195+
},
196+
dryRunResponse
197+
);
159198
}
160-
}
161199

162-
return {
163-
status: 200,
164-
statusText: 'OK',
165-
headers: {},
166-
data: dryRunResponse,
167-
};
200+
if (errorResponseLog) {
201+
throw new Error(`${errorResponseLog}: ${JSON.stringify(error.response.data)}`);
202+
}
203+
204+
throw error;
205+
}
168206
}
169207
}

packages/kbn-test/src/failed_tests_reporter/report_failure.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ describe('createFailureIssue()', () => {
5151
Array [
5252
"Failing test: some.classname - test name",
5353
"A test failed on a tracked branch
54+
5455
\`\`\`
5556
this is the failure text
5657
\`\`\`
58+
5759
First failure: [Jenkins Build](https://build-url)
5860
5961
<!-- kibanaCiData = {\\"failed-test\\":{\\"test.class\\":\\"some.classname\\",\\"test.name\\":\\"test name\\",\\"test.failCount\\":1}} -->",

0 commit comments

Comments
 (0)