Skip to content

Commit 4e1a445

Browse files
Merge branch 'master' into 64921-ml-logs-splash-screen
2 parents ebe00ef + 778136f commit 4e1a445

File tree

1,866 files changed

+39337
-24015
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,866 files changed

+39337
-24015
lines changed

.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+
}

Jenkinsfile

Lines changed: 2 additions & 2 deletions
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 {
@@ -41,7 +41,7 @@ kibanaPipeline(timeoutMinutes: 155, checkPrChanges: true) {
4141
'xpack-ciGroup9': kibanaPipeline.xpackCiGroupProcess(9),
4242
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
4343
'xpack-accessibility': kibanaPipeline.functionalTestProcess('xpack-accessibility', './test/scripts/jenkins_xpack_accessibility.sh'),
44-
'xpack-pageLoadMetrics': kibanaPipeline.functionalTestProcess('xpack-pageLoadMetrics', './test/scripts/jenkins_xpack_page_load_metrics.sh'),
44+
// 'xpack-pageLoadMetrics': kibanaPipeline.functionalTestProcess('xpack-pageLoadMetrics', './test/scripts/jenkins_xpack_page_load_metrics.sh'),
4545
'xpack-securitySolutionCypress': { processNumber ->
4646
whenChanged(['x-pack/plugins/security_solution/', 'x-pack/test/security_solution_cypress/']) {
4747
kibanaPipeline.functionalTestProcess('xpack-securitySolutionCypress', './test/scripts/jenkins_security_solution_cypress.sh')(processNumber)

NOTICE.txt

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,68 @@ Author Tobias Koppers @sokra
2929
---
3030
This product has relied on ASTExplorer that is licensed under MIT.
3131

32+
---
33+
This product includes code that is based on Ace editor, which was available
34+
under a "BSD" license.
35+
36+
Distributed under the BSD license:
37+
38+
Copyright (c) 2010, Ajax.org B.V.
39+
All rights reserved.
40+
41+
Redistribution and use in source and binary forms, with or without
42+
modification, are permitted provided that the following conditions are met:
43+
* Redistributions of source code must retain the above copyright
44+
notice, this list of conditions and the following disclaimer.
45+
* Redistributions in binary form must reproduce the above copyright
46+
notice, this list of conditions and the following disclaimer in the
47+
documentation and/or other materials provided with the distribution.
48+
* Neither the name of Ajax.org B.V. nor the
49+
names of its contributors may be used to endorse or promote products
50+
derived from this software without specific prior written permission.
51+
52+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
53+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
54+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
55+
DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
56+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
57+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
58+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
59+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
61+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62+
63+
---
64+
This product includes code that is based on Ace editor, which was available
65+
under a "BSD" license.
66+
67+
Distributed under the BSD license:
68+
69+
Copyright (c) 2010, Ajax.org B.V.
70+
All rights reserved.
71+
72+
Redistribution and use in source and binary forms, with or without
73+
modification, are permitted provided that the following conditions are met:
74+
* Redistributions of source code must retain the above copyright
75+
notice, this list of conditions and the following disclaimer.
76+
* Redistributions in binary form must reproduce the above copyright
77+
notice, this list of conditions and the following disclaimer in the
78+
documentation and/or other materials provided with the distribution.
79+
* Neither the name of Ajax.org B.V. nor the
80+
names of its contributors may be used to endorse or promote products
81+
derived from this software without specific prior written permission.
82+
83+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
84+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
85+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
86+
DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
87+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
88+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
89+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
90+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
91+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
92+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
93+
3294
---
3395
This product includes code that is based on flot-charts, which was available
3496
under a "MIT" license.

docs/developer/plugin/development-plugin-feature-registration.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ init(server) {
2222
-----------
2323

2424
===== Feature details
25-
Registering a feature consists of the following fields. For more information, consult the {repo}blob/{branch}/x-pack/plugins/features/server/feature_registry.ts[feature registry interface].
25+
Registering a feature consists of the following fields. For more information, consult the {kib-repo}blob/{branch}/x-pack/plugins/features/server/feature_registry.ts[feature registry interface].
2626

2727

2828
[cols="1a, 1a, 1a, 1a"]
@@ -45,12 +45,12 @@ Registering a feature consists of the following fields. For more information, co
4545
|An array of applications this feature enables. Typically, all of your plugin's apps (from `uiExports`) will be included here.
4646

4747
|`privileges` (required)
48-
|{repo}blob/{branch}/x-pack/plugins/features/common/feature.ts[`FeatureConfig`].
48+
|{kib-repo}blob/{branch}/x-pack/plugins/features/common/feature.ts[`FeatureConfig`].
4949
|See <<example-1-canvas,Example 1>> and <<example-2-dev-tools,Example 2>>
5050
|The set of privileges this feature requires to function.
5151

5252
|`subFeatures` (optional)
53-
|{repo}blob/{branch}/x-pack/plugins/features/common/feature.ts[`FeatureConfig`].
53+
|{kib-repo}blob/{branch}/x-pack/plugins/features/common/feature.ts[`FeatureConfig`].
5454
|See <<example-3-discover,Example 3>>
5555
|The set of subfeatures that enables finer access control than the `all` and `read` feature privileges. These options are only available in the Gold subscription level and higher.
5656

@@ -68,7 +68,7 @@ Registering a feature consists of the following fields. For more information, co
6868
===== Privilege definition
6969
The `privileges` section of feature registration allows plugins to implement read/write and read-only modes for their applications.
7070

71-
For a full explanation of fields and options, consult the {repo}blob/{branch}/x-pack/plugins/features/server/feature_registry.ts[feature registry interface].
71+
For a full explanation of fields and options, consult the {kib-repo}blob/{branch}/x-pack/plugins/features/server/feature_registry.ts[feature registry interface].
7272

7373
==== Using UI Capabilities
7474

docs/developer/plugin/development-plugin-functional-tests.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,5 @@ node ../../kibana/scripts/functional_test_runner
8585
[float]
8686
==== Using esArchiver
8787

88-
We're working on documentation for this, but for now the best place to look is the original {pull}10359[pull request].
88+
We're working on documentation for this, but for now the best place to look is the original {kibana-pull}10359[pull request].
8989

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export const HELLO_WORLD = i18n.translate('hello.wonderful.world', {
109109
});
110110
-----------
111111

112-
Full details are {repo}tree/master/packages/kbn-i18n#vanilla-js[here].
112+
Full details are {kib-repo}tree/master/packages/kbn-i18n#vanilla-js[here].
113113

114114
[float]
115115
===== i18n for React
@@ -133,7 +133,7 @@ export const Component = () => {
133133
};
134134
-----------
135135

136-
Full details are {repo}tree/master/packages/kbn-i18n#react[here].
136+
Full details are {kib-repo}tree/master/packages/kbn-i18n#react[here].
137137

138138

139139

@@ -153,7 +153,7 @@ The translation directive has the following syntax:
153153
></ANY>
154154
-----------
155155

156-
Full details are {repo}tree/master/packages/kbn-i18n#angularjs[here].
156+
Full details are {kib-repo}tree/master/packages/kbn-i18n#angularjs[here].
157157

158158

159159
[float]

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ Here are some resources that are helpful for getting started with plugin develop
55

66
[float]
77
==== Some light reading
8-
Our {repo}blob/master/CONTRIBUTING.md[contributing guide] can help you get a development environment going.
8+
Our {kib-repo}blob/master/CONTRIBUTING.md[contributing guide] can help you get a development environment going.
99

1010
[float]
1111
==== Plugin Generator
1212

13-
We recommend that you kick-start your plugin by generating it with the {repo}tree/{branch}/packages/kbn-plugin-generator[Kibana Plugin Generator]. Run the following in the Kibana repo, and you will be asked a couple questions, see some progress bars, and have a freshly generated plugin ready for you to play with in Kibana's `plugins` folder.
13+
We recommend that you kick-start your plugin by generating it with the {kib-repo}tree/{branch}/packages/kbn-plugin-generator[Kibana Plugin Generator]. Run the following in the Kibana repo, and you will be asked a couple questions, see some progress bars, and have a freshly generated plugin ready for you to play with in Kibana's `plugins` folder.
1414

1515
["source","shell"]
1616
-----------
@@ -34,7 +34,7 @@ The Kibana directory must be named `kibana`, and your plugin directory should be
3434

3535
[float]
3636
==== References in the code
37-
- {repo}blob/{branch}/src/legacy/server/plugins/lib/plugin.js[Plugin class]: What options does the `kibana.Plugin` class accept?
37+
- {kib-repo}blob/{branch}/src/legacy/server/plugins/lib/plugin.js[Plugin class]: What options does the `kibana.Plugin` class accept?
3838
- <<development-uiexports>>: What type of exports are available?
3939

4040
[float]
@@ -65,9 +65,9 @@ To enable TypeScript support, create a `tsconfig.json` file at the root of your
6565

6666
TypeScript code is automatically converted into JavaScript during development,
6767
but not in the distributable version of Kibana. If you use the
68-
{repo}blob/{branch}/packages/kbn-plugin-helpers[@kbn/plugin-helpers] to build your plugin, then your `.ts` and `.tsx` files will be permanently transpiled before your plugin is archived. If you have your own build process, make sure to run the TypeScript compiler on your source files and ship the compilation output so that your plugin will work with the distributable version of Kibana.
68+
{kib-repo}blob/{branch}/packages/kbn-plugin-helpers[@kbn/plugin-helpers] to build your plugin, then your `.ts` and `.tsx` files will be permanently transpiled before your plugin is archived. If you have your own build process, make sure to run the TypeScript compiler on your source files and ship the compilation output so that your plugin will work with the distributable version of Kibana.
6969

7070
==== {kib} platform migration guide
7171

72-
{repo}blob/{branch}/src/core/MIGRATION.md#migrating-legacy-plugins-to-the-new-platform[This guide]
72+
{kib-repo}blob/{branch}/src/core/MIGRATION.md#migrating-legacy-plugins-to-the-new-platform[This guide]
7373
provides an action plan for moving a legacy plugin to the new platform.

0 commit comments

Comments
 (0)