Skip to content

Commit 04dc4c6

Browse files
Merge branch 'master' into ml-capabilities
2 parents f9fae67 + 7440eea commit 04dc4c6

File tree

1,532 files changed

+39246
-20731
lines changed

Some content is hidden

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

1,532 files changed

+39246
-20731
lines changed

.backportrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
],
2626
"targetPRLabels": ["backport"],
2727
"branchLabelMapping": {
28+
"^v8.0.0$": "master",
2829
"^v7.9.0$": "7.x",
2930
"^v(\\d+).(\\d+).\\d+$": "$1.$2"
3031
}

.ci/pipeline-library/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies {
2020
implementation 'org.jenkins-ci.plugins.workflow:workflow-step-api:2.19@jar'
2121
testImplementation 'com.lesfurets:jenkins-pipeline-unit:1.4'
2222
testImplementation 'junit:junit:4.12'
23+
testImplementation 'org.mockito:mockito-core:2.+'
2324
testImplementation 'org.assertj:assertj-core:3.15+' // Temporary https://github.com/jenkinsci/JenkinsPipelineUnit/issues/209
2425
}
2526

.ci/pipeline-library/src/test/KibanaBasePipelineTest.groovy

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class KibanaBasePipelineTest extends BasePipelineTest {
1919
env.BUILD_DISPLAY_NAME = "#${env.BUILD_ID}"
2020

2121
env.JENKINS_URL = 'http://jenkins.localhost:8080'
22-
env.BUILD_URL = "${env.JENKINS_URL}/job/elastic+kibana+${env.BRANCH_NAME}/${env.BUILD_ID}/"
22+
env.BUILD_URL = "${env.JENKINS_URL}/job/elastic+kibana+${env.BRANCH_NAME}/${env.BUILD_ID}/".toString()
2323

24-
env.JOB_BASE_NAME = "elastic / kibana # ${env.BRANCH_NAME}"
24+
env.JOB_BASE_NAME = "elastic / kibana # ${env.BRANCH_NAME}".toString()
2525
env.JOB_NAME = env.JOB_BASE_NAME
2626

2727
env.WORKSPACE = 'WS'
@@ -31,6 +31,9 @@ class KibanaBasePipelineTest extends BasePipelineTest {
3131
getBuildStatus: { 'SUCCESS' },
3232
printStacktrace: { ex -> print ex },
3333
],
34+
githubPr: [
35+
isPr: { false },
36+
],
3437
jenkinsApi: [ getFailedSteps: { [] } ],
3538
testUtils: [ getFailures: { [] } ],
3639
])
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import org.junit.*
2+
import static groovy.test.GroovyAssert.*
3+
4+
class BuildStateTest extends KibanaBasePipelineTest {
5+
def buildState
6+
7+
@Before
8+
void setUp() {
9+
super.setUp()
10+
11+
buildState = loadScript("vars/buildState.groovy")
12+
}
13+
14+
@Test
15+
void 'get() returns existing data'() {
16+
buildState.add('test', 1)
17+
def actual = buildState.get('test')
18+
assertEquals(1, actual)
19+
}
20+
21+
@Test
22+
void 'get() returns null for missing data'() {
23+
def actual = buildState.get('missing_key')
24+
assertEquals(null, actual)
25+
}
26+
27+
@Test
28+
void 'add() does not overwrite existing keys'() {
29+
assertTrue(buildState.add('test', 1))
30+
assertFalse(buildState.add('test', 2))
31+
32+
def actual = buildState.get('test')
33+
34+
assertEquals(1, actual)
35+
}
36+
37+
@Test
38+
void 'set() overwrites existing keys'() {
39+
assertFalse(buildState.has('test'))
40+
buildState.set('test', 1)
41+
assertTrue(buildState.has('test'))
42+
buildState.set('test', 2)
43+
44+
def actual = buildState.get('test')
45+
46+
assertEquals(2, actual)
47+
}
48+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import org.junit.*
2+
import static org.mockito.Mockito.*;
3+
4+
class GithubCommitStatusTest extends KibanaBasePipelineTest {
5+
def githubCommitStatus
6+
def githubApiMock
7+
def buildStateMock
8+
9+
def EXPECTED_STATUS_URL = 'repos/elastic/kibana/statuses/COMMIT_HASH'
10+
def EXPECTED_CONTEXT = 'kibana-ci'
11+
def EXPECTED_BUILD_URL = 'http://jenkins.localhost:8080/job/elastic+kibana+master/1/'
12+
13+
interface BuildState {
14+
Object get(String key)
15+
}
16+
17+
interface GithubApi {
18+
Object post(String url, Map data)
19+
}
20+
21+
@Before
22+
void setUp() {
23+
super.setUp()
24+
25+
buildStateMock = mock(BuildState)
26+
githubApiMock = mock(GithubApi)
27+
28+
when(buildStateMock.get('checkoutInfo')).thenReturn([ commit: 'COMMIT_HASH', ])
29+
when(githubApiMock.post(any(), any())).thenReturn(null)
30+
31+
props([
32+
buildState: buildStateMock,
33+
githubApi: githubApiMock,
34+
])
35+
36+
githubCommitStatus = loadScript("vars/githubCommitStatus.groovy")
37+
}
38+
39+
void verifyStatusCreate(String state, String description) {
40+
verify(githubApiMock).post(
41+
EXPECTED_STATUS_URL,
42+
[
43+
'state': state,
44+
'description': description,
45+
'context': EXPECTED_CONTEXT,
46+
'target_url': EXPECTED_BUILD_URL,
47+
]
48+
)
49+
}
50+
51+
@Test
52+
void 'onStart() should create a pending status'() {
53+
githubCommitStatus.onStart()
54+
verifyStatusCreate('pending', 'Build started.')
55+
}
56+
57+
@Test
58+
void 'onFinish() should create a success status'() {
59+
githubCommitStatus.onFinish()
60+
verifyStatusCreate('success', 'Build completed successfully.')
61+
}
62+
63+
@Test
64+
void 'onFinish() should create an error status for failed builds'() {
65+
mockFailureBuild()
66+
githubCommitStatus.onFinish()
67+
verifyStatusCreate('error', 'Build failed.')
68+
}
69+
70+
@Test
71+
void 'onStart() should exit early for PRs'() {
72+
prop('githubPr', [ isPr: { true } ])
73+
74+
githubCommitStatus.onStart()
75+
verifyZeroInteractions(githubApiMock)
76+
}
77+
78+
@Test
79+
void 'onFinish() should exit early for PRs'() {
80+
prop('githubPr', [ isPr: { true } ])
81+
82+
githubCommitStatus.onFinish()
83+
verifyZeroInteractions(githubApiMock)
84+
}
85+
}

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ target
3333
/x-pack/plugins/canvas/shareable_runtime/build
3434
/x-pack/plugins/canvas/storybook
3535
/x-pack/plugins/monitoring/public/lib/jquery_flot
36+
/x-pack/plugins/reporting/server/export_types/printable_pdf/server/lib/pdf/assets/**
3637
/x-pack/legacy/plugins/infra/common/graphql/types.ts
3738
/x-pack/legacy/plugins/infra/public/graphql/types.ts
3839
/x-pack/legacy/plugins/infra/server/graphql/types.ts

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
library 'kibana-pipeline-library'
44
kibanaLibrary.load()
55

6-
kibanaPipeline(timeoutMinutes: 155, checkPrChanges: true) {
6+
kibanaPipeline(timeoutMinutes: 155, checkPrChanges: true, setCommitStatus: true) {
77
githubPr.withDefaultPrComments {
88
ciStats.trackBuild {
99
catchError {
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [App](./kibana-plugin-core-public.app.md) &gt; [exactRoute](./kibana-plugin-core-public.app.exactroute.md)
4+
5+
## App.exactRoute property
6+
7+
If set to true, the application's route will only be checked against an exact match. Defaults to `false`<!-- -->.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
exactRoute?: boolean;
13+
```
14+
15+
## Example
16+
17+
18+
```ts
19+
core.application.register({
20+
id: 'my_app',
21+
title: 'My App'
22+
exactRoute: true,
23+
mount: () => { ... },
24+
})
25+
26+
// '[basePath]/app/my_app' will be matched
27+
// '[basePath]/app/my_app/some/path' will not be matched
28+
29+
```
30+

docs/development/core/public/kibana-plugin-core-public.app.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ export interface App<HistoryLocationState = unknown> extends AppBase
1818
| --- | --- | --- |
1919
| [appRoute](./kibana-plugin-core-public.app.approute.md) | <code>string</code> | Override the application's routing path from <code>/app/${id}</code>. Must be unique across registered applications. Should not include the base path from HTTP. |
2020
| [chromeless](./kibana-plugin-core-public.app.chromeless.md) | <code>boolean</code> | Hide the UI chrome when the application is mounted. Defaults to <code>false</code>. Takes precedence over chrome service visibility settings. |
21+
| [exactRoute](./kibana-plugin-core-public.app.exactroute.md) | <code>boolean</code> | If set to true, the application's route will only be checked against an exact match. Defaults to <code>false</code>. |
2122
| [mount](./kibana-plugin-core-public.app.mount.md) | <code>AppMount&lt;HistoryLocationState&gt; &#124; AppMountDeprecated&lt;HistoryLocationState&gt;</code> | A mount function called when the user navigates to this app's route. May have signature of [AppMount](./kibana-plugin-core-public.appmount.md) or [AppMountDeprecated](./kibana-plugin-core-public.appmountdeprecated.md)<!-- -->. |
2223
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [ChromeStart](./kibana-plugin-core-public.chromestart.md) &gt; [getCustomNavLink$](./kibana-plugin-core-public.chromestart.getcustomnavlink_.md)
4+
5+
## ChromeStart.getCustomNavLink$() method
6+
7+
Get an observable of the current custom nav link
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
getCustomNavLink$(): Observable<Partial<ChromeNavLink> | undefined>;
13+
```
14+
<b>Returns:</b>
15+
16+
`Observable<Partial<ChromeNavLink> | undefined>`
17+

0 commit comments

Comments
 (0)