Skip to content

Commit cd5a64f

Browse files
committed
Merge branch '7.x' into backport/7.x/pr-64403
2 parents 4e9b559 + dbc4914 commit cd5a64f

720 files changed

Lines changed: 18721 additions & 11008 deletions

File tree

Some content is hidden

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

.sass-lint.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ files:
44
- 'src/legacy/core_plugins/timelion/**/*.s+(a|c)ss'
55
- 'src/legacy/core_plugins/vis_type_vislib/**/*.s+(a|c)ss'
66
- 'src/legacy/core_plugins/vis_type_xy/**/*.s+(a|c)ss'
7-
- 'x-pack/legacy/plugins/rollup/**/*.s+(a|c)ss'
87
- 'x-pack/legacy/plugins/security/**/*.s+(a|c)ss'
98
- 'x-pack/legacy/plugins/canvas/**/*.s+(a|c)ss'
109
- 'x-pack/plugins/triggers_actions_ui/**/*.s+(a|c)ss'

Jenkinsfile

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,56 @@ library 'kibana-pipeline-library'
44
kibanaLibrary.load()
55

66
kibanaPipeline(timeoutMinutes: 135, checkPrChanges: true) {
7-
githubPr.withDefaultPrComments {
8-
catchError {
9-
retryable.enable()
10-
parallel([
11-
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
12-
'x-pack-intake-agent': workers.intake('x-pack-intake', './test/scripts/jenkins_xpack.sh'),
13-
'kibana-oss-agent': workers.functional('kibana-oss-tests', { kibanaPipeline.buildOss() }, [
14-
'oss-firefoxSmoke': kibanaPipeline.functionalTestProcess('kibana-firefoxSmoke', './test/scripts/jenkins_firefox_smoke.sh'),
15-
'oss-ciGroup1': kibanaPipeline.ossCiGroupProcess(1),
16-
'oss-ciGroup2': kibanaPipeline.ossCiGroupProcess(2),
17-
'oss-ciGroup3': kibanaPipeline.ossCiGroupProcess(3),
18-
'oss-ciGroup4': kibanaPipeline.ossCiGroupProcess(4),
19-
'oss-ciGroup5': kibanaPipeline.ossCiGroupProcess(5),
20-
'oss-ciGroup6': kibanaPipeline.ossCiGroupProcess(6),
21-
'oss-ciGroup7': kibanaPipeline.ossCiGroupProcess(7),
22-
'oss-ciGroup8': kibanaPipeline.ossCiGroupProcess(8),
23-
'oss-ciGroup9': kibanaPipeline.ossCiGroupProcess(9),
24-
'oss-ciGroup10': kibanaPipeline.ossCiGroupProcess(10),
25-
'oss-ciGroup11': kibanaPipeline.ossCiGroupProcess(11),
26-
'oss-ciGroup12': kibanaPipeline.ossCiGroupProcess(12),
27-
'oss-accessibility': kibanaPipeline.functionalTestProcess('kibana-accessibility', './test/scripts/jenkins_accessibility.sh'),
28-
// 'oss-visualRegression': kibanaPipeline.functionalTestProcess('visualRegression', './test/scripts/jenkins_visual_regression.sh'),
29-
]),
30-
'kibana-xpack-agent': workers.functional('kibana-xpack-tests', { kibanaPipeline.buildXpack() }, [
31-
'xpack-firefoxSmoke': kibanaPipeline.functionalTestProcess('xpack-firefoxSmoke', './test/scripts/jenkins_xpack_firefox_smoke.sh'),
32-
'xpack-ciGroup1': kibanaPipeline.xpackCiGroupProcess(1),
33-
'xpack-ciGroup2': kibanaPipeline.xpackCiGroupProcess(2),
34-
'xpack-ciGroup3': kibanaPipeline.xpackCiGroupProcess(3),
35-
'xpack-ciGroup4': kibanaPipeline.xpackCiGroupProcess(4),
36-
'xpack-ciGroup5': kibanaPipeline.xpackCiGroupProcess(5),
37-
'xpack-ciGroup6': kibanaPipeline.xpackCiGroupProcess(6),
38-
'xpack-ciGroup7': kibanaPipeline.xpackCiGroupProcess(7),
39-
'xpack-ciGroup8': kibanaPipeline.xpackCiGroupProcess(8),
40-
'xpack-ciGroup9': kibanaPipeline.xpackCiGroupProcess(9),
41-
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
42-
'xpack-accessibility': kibanaPipeline.functionalTestProcess('xpack-accessibility', './test/scripts/jenkins_xpack_accessibility.sh'),
43-
'xpack-siemCypress': { processNumber ->
44-
whenChanged(['x-pack/plugins/siem/', 'x-pack/legacy/plugins/siem/', 'x-pack/test/siem_cypress/']) {
45-
kibanaPipeline.functionalTestProcess('xpack-siemCypress', './test/scripts/jenkins_siem_cypress.sh')(processNumber)
46-
}
47-
},
7+
ciStats.trackBuild {
8+
githubPr.withDefaultPrComments {
9+
catchError {
10+
retryable.enable()
11+
parallel([
12+
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
13+
'x-pack-intake-agent': workers.intake('x-pack-intake', './test/scripts/jenkins_xpack.sh'),
14+
'kibana-oss-agent': workers.functional('kibana-oss-tests', { kibanaPipeline.buildOss() }, [
15+
'oss-firefoxSmoke': kibanaPipeline.functionalTestProcess('kibana-firefoxSmoke', './test/scripts/jenkins_firefox_smoke.sh'),
16+
'oss-ciGroup1': kibanaPipeline.ossCiGroupProcess(1),
17+
'oss-ciGroup2': kibanaPipeline.ossCiGroupProcess(2),
18+
'oss-ciGroup3': kibanaPipeline.ossCiGroupProcess(3),
19+
'oss-ciGroup4': kibanaPipeline.ossCiGroupProcess(4),
20+
'oss-ciGroup5': kibanaPipeline.ossCiGroupProcess(5),
21+
'oss-ciGroup6': kibanaPipeline.ossCiGroupProcess(6),
22+
'oss-ciGroup7': kibanaPipeline.ossCiGroupProcess(7),
23+
'oss-ciGroup8': kibanaPipeline.ossCiGroupProcess(8),
24+
'oss-ciGroup9': kibanaPipeline.ossCiGroupProcess(9),
25+
'oss-ciGroup10': kibanaPipeline.ossCiGroupProcess(10),
26+
'oss-ciGroup11': kibanaPipeline.ossCiGroupProcess(11),
27+
'oss-ciGroup12': kibanaPipeline.ossCiGroupProcess(12),
28+
'oss-accessibility': kibanaPipeline.functionalTestProcess('kibana-accessibility', './test/scripts/jenkins_accessibility.sh'),
29+
// 'oss-visualRegression': kibanaPipeline.functionalTestProcess('visualRegression', './test/scripts/jenkins_visual_regression.sh'),
30+
]),
31+
'kibana-xpack-agent': workers.functional('kibana-xpack-tests', { kibanaPipeline.buildXpack() }, [
32+
'xpack-firefoxSmoke': kibanaPipeline.functionalTestProcess('xpack-firefoxSmoke', './test/scripts/jenkins_xpack_firefox_smoke.sh'),
33+
'xpack-ciGroup1': kibanaPipeline.xpackCiGroupProcess(1),
34+
'xpack-ciGroup2': kibanaPipeline.xpackCiGroupProcess(2),
35+
'xpack-ciGroup3': kibanaPipeline.xpackCiGroupProcess(3),
36+
'xpack-ciGroup4': kibanaPipeline.xpackCiGroupProcess(4),
37+
'xpack-ciGroup5': kibanaPipeline.xpackCiGroupProcess(5),
38+
'xpack-ciGroup6': kibanaPipeline.xpackCiGroupProcess(6),
39+
'xpack-ciGroup7': kibanaPipeline.xpackCiGroupProcess(7),
40+
'xpack-ciGroup8': kibanaPipeline.xpackCiGroupProcess(8),
41+
'xpack-ciGroup9': kibanaPipeline.xpackCiGroupProcess(9),
42+
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
43+
'xpack-accessibility': kibanaPipeline.functionalTestProcess('xpack-accessibility', './test/scripts/jenkins_xpack_accessibility.sh'),
44+
'xpack-siemCypress': { processNumber ->
45+
whenChanged(['x-pack/plugins/siem/', 'x-pack/legacy/plugins/siem/', 'x-pack/test/siem_cypress/']) {
46+
kibanaPipeline.functionalTestProcess('xpack-siemCypress', './test/scripts/jenkins_siem_cypress.sh')(processNumber)
47+
}
48+
},
4849

49-
// 'xpack-visualRegression': kibanaPipeline.functionalTestProcess('xpack-visualRegression', './test/scripts/jenkins_xpack_visual_regression.sh'),
50-
]),
51-
])
50+
// 'xpack-visualRegression': kibanaPipeline.functionalTestProcess('xpack-visualRegression', './test/scripts/jenkins_xpack_visual_regression.sh'),
51+
]),
52+
])
53+
}
5254
}
53-
}
5455

55-
retryable.printFlakyFailures()
56-
kibanaPipeline.sendMail()
56+
retryable.printFlakyFailures()
57+
kibanaPipeline.sendMail()
58+
}
5759
}

docs/developer/core-development.asciidoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* <<development-elasticsearch>>
88
* <<development-unit-tests>>
99
* <<development-functional-tests>>
10+
* <<development-es-snapshots>>
1011

1112
include::core/development-basepath.asciidoc[]
1213

@@ -19,3 +20,5 @@ include::core/development-elasticsearch.asciidoc[]
1920
include::core/development-unit-tests.asciidoc[]
2021

2122
include::core/development-functional-tests.asciidoc[]
23+
24+
include::core/development-es-snapshots.asciidoc[]
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
[[development-es-snapshots]]
2+
=== Daily Elasticsearch Snapshots
3+
4+
For local development and CI, Kibana, by default, uses Elasticsearch snapshots that are built daily when running tasks that require Elasticsearch (e.g. functional tests).
5+
6+
A snapshot is just a group of tarballs, one for each supported distribution/architecture/os of Elasticsearch, and a JSON-based manifest file containing metadata about the distributions.
7+
8+
https://ci.kibana.dev/es-snapshots[A dashboard] is available that shows the current status and compatibility of the latest Elasticsearch snapshots.
9+
10+
==== Process Overview
11+
12+
1. Elasticsearch snapshots are built for each current tracked branch of Kibana.
13+
2. Each snapshot is uploaded to a public Google Cloud Storage bucket, `kibana-ci-es-snapshots-daily`.
14+
** At this point, the snapshot is not automatically used in CI or local development. It needs to be tested/verified first.
15+
3. Each snapshot is tested with the latest commit of the corresponding Kibana branch, using the full CI suite.
16+
4. After CI
17+
** If the snapshot passes, it is promoted and automatically used in CI and local development.
18+
** If the snapshot fails, the issue must be investigated and resolved. A new incompatibility may exist between Elasticsearch and Kibana.
19+
20+
==== Using the latest snapshot
21+
22+
When developing locally, you may wish to use the most recent Elasticsearch snapshot, even if it's failing CI. To do so, prefix your commands with the follow environment variable:
23+
24+
["source","bash"]
25+
-----------
26+
KBN_ES_SNAPSHOT_USE_UNVERIFIED=true
27+
-----------
28+
29+
You can use this flag with any command that downloads and runs Elasticsearch snapshots, such as `scripts/es` or the FTR.
30+
31+
For example, to run functional tests with the latest snapshot:
32+
33+
["source","bash"]
34+
-----------
35+
KBN_ES_SNAPSHOT_USE_UNVERIFIED=true node scripts/functional_tests_server
36+
-----------
37+
38+
===== For Pull Requests
39+
40+
Currently, there is not a way to run your pull request with the latest unverified snapshot without a code change. You can, however, do it with a small code change.
41+
42+
1. Edit `Jenkinsfile` in the root of the Kibana repo
43+
2. Add `env.KBN_ES_SNAPSHOT_USE_UNVERIFIED = 'true'` at the top of the file.
44+
3. Commit the change
45+
46+
Your pull request should then use the latest snapshot the next time that it runs. Just don't merge the change to `Jenkinsfile`!
47+
48+
==== Google Cloud Storage buckets
49+
50+
===== kibana-ci-es-snapshots-daily
51+
52+
This bucket stores snapshots that are created on a daily basis, and is the primary location used by `kbn-es` to download snapshots.
53+
54+
Snapshots are automatically deleted after 10 days.
55+
56+
The file structure for this bucket looks like this:
57+
58+
* `<version>/manifest-latest.json`
59+
* `<version>/manifest-latest-verified.json`
60+
* `<version>/archives/<unique id>/*.tar.gz`
61+
* `<version>/archives/<unique id>/*.tar.gz.sha512`
62+
* `<version>/archives/<unique id>/manifest.json`
63+
64+
===== kibana-ci-es-snapshots-permanent
65+
66+
This bucket stores only the most recently promoted snapshot for each version. Old snapshots are only deleted when new ones are uploaded.
67+
68+
This bucket serves as permanent snapshot storage for old branches/versions that are no longer being built. `kbn-es` checks the daily bucket first, followed by this one if no snapshots were found.
69+
70+
The file structure for this bucket looks like this:
71+
72+
* `<version>/*.tar.gz`
73+
* `<version>/*.tar.gz.sha512`
74+
* `<version>/manifest.json`
75+
76+
==== How snapshots are built, tested, and promoted
77+
78+
Each day, a https://kibana-ci.elastic.co/job/elasticsearch+snapshots+trigger/[Jenkins job] runs that triggers Elasticsearch builds for each currently tracked branch/version. This job is automatically updated with the correct branches whenever we release new versions of Kibana.
79+
80+
===== Build
81+
82+
https://kibana-ci.elastic.co/job/elasticsearch+snapshots+build/[This Jenkins job] builds the Elasticsearch snapshots and uploads them to GCS.
83+
84+
The Jenkins job pipeline definition is https://github.com/elastic/kibana/blob/master/.ci/es-snapshots/Jenkinsfile_build_es[in the kibana repo].
85+
86+
1. Checkout Elasticsearch repo for the given branch/version.
87+
2. Run `./gradlew -p distribution/archives assemble --parallel` to create all of the Elasticsearch distributions.
88+
3. Create a tarball for each distribution.
89+
4. Create a manifest JSON file containing info about the distribution, as well as its download URL.
90+
5. Upload the tarballs and manifest to a unique location in the GCS bucket `kibana-ci-es-snapshots-daily`.
91+
** e.g. `<version>/archives/<unique id>`
92+
6. Replace `<version>/manifest-latest.json` in GCS with this newest manifest.
93+
** This allows the `KBN_ES_SNAPSHOT_USE_UNVERIFIED` flag to work.
94+
7. Trigger the verification job, to run the full Kibana CI test suite with this snapshot.
95+
96+
===== Verification and Promotion
97+
98+
https://kibana-ci.elastic.co/job/elasticsearch+snapshots+verify/[This Jenkins job] tests the latest Elasticsearch snapshot with the full Kibana CI pipeline, and promotes if it there are no test failures.
99+
100+
The Jenkins job pipeline definition is https://github.com/elastic/kibana/blob/master/.ci/es-snapshots/Jenkinsfile_verify_es[in the kibana repo].
101+
102+
1. Checkout Kibana and set up CI environment as normal.
103+
2. Set the `ES_SNAPSHOT_MANIFEST` env var to point to the latest snapshot manifest.
104+
3. Run CI (functional tests, integration tests, etc).
105+
4. After CI
106+
** If there was a test failure or other build error, send out an e-mail notification and stop.
107+
** If there were no errors, promote the snapshot.
108+
109+
Promotion is done as part of the same pipeline:
110+
111+
1. Replace the manifest at `kibana-ci-es-snapshots-daily/<version>/manifest-latest-verified.json` with the manifest from the tested snapshot.
112+
** At this point, the snapshot has been promoted and will automatically be used in CI and in local development.
113+
2. Replace the snapshot at `kibana-ci-es-snapshots-permanent/<version>/` with the tested snapshot by copying all of the tarballs and the manifest file.

docs/development/core/server/kibana-plugin-core-server.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,14 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
263263
| [SavedObjectAttribute](./kibana-plugin-core-server.savedobjectattribute.md) | Type definition for a Saved Object attribute value |
264264
| [SavedObjectAttributeSingle](./kibana-plugin-core-server.savedobjectattributesingle.md) | Don't use this type, it's simply a helper type for [SavedObjectAttribute](./kibana-plugin-core-server.savedobjectattribute.md) |
265265
| [SavedObjectMigrationFn](./kibana-plugin-core-server.savedobjectmigrationfn.md) | A migration function for a [saved object type](./kibana-plugin-core-server.savedobjectstype.md) used to migrate it to a given version |
266-
| [SavedObjectSanitizedDoc](./kibana-plugin-core-server.savedobjectsanitizeddoc.md) | |
266+
| [SavedObjectSanitizedDoc](./kibana-plugin-core-server.savedobjectsanitizeddoc.md) | Describes Saved Object documents that have passed through the migration framework and are guaranteed to have a <code>references</code> root property. |
267267
| [SavedObjectsClientContract](./kibana-plugin-core-server.savedobjectsclientcontract.md) | Saved Objects is Kibana's data persisentence mechanism allowing plugins to use Elasticsearch for storing plugin state.<!-- -->\#\# SavedObjectsClient errors<!-- -->Since the SavedObjectsClient has its hands in everything we are a little paranoid about the way we present errors back to to application code. Ideally, all errors will be either:<!-- -->1. Caused by bad implementation (ie. undefined is not a function) and as such unpredictable 2. An error that has been classified and decorated appropriately by the decorators in [SavedObjectsErrorHelpers](./kibana-plugin-core-server.savedobjectserrorhelpers.md)<!-- -->Type 1 errors are inevitable, but since all expected/handle-able errors should be Type 2 the <code>isXYZError()</code> helpers exposed at <code>SavedObjectsErrorHelpers</code> should be used to understand and manage error responses from the <code>SavedObjectsClient</code>.<!-- -->Type 2 errors are decorated versions of the source error, so if the elasticsearch client threw an error it will be decorated based on its type. That means that rather than looking for <code>error.body.error.type</code> or doing substring checks on <code>error.body.error.reason</code>, just use the helpers to understand the meaning of the error:<!-- -->\`\`\`<!-- -->js if (SavedObjectsErrorHelpers.isNotFoundError(error)) { // handle 404 }<!-- -->if (SavedObjectsErrorHelpers.isNotAuthorizedError(error)) { // 401 handling should be automatic, but in case you wanted to know }<!-- -->// always rethrow the error unless you handle it throw error; \`\`\`<!-- -->\#\#\# 404s from missing index<!-- -->From the perspective of application code and APIs the SavedObjectsClient is a black box that persists objects. One of the internal details that users have no control over is that we use an elasticsearch index for persistance and that index might be missing.<!-- -->At the time of writing we are in the process of transitioning away from the operating assumption that the SavedObjects index is always available. Part of this transition is handling errors resulting from an index missing. These used to trigger a 500 error in most cases, and in others cause 404s with different error messages.<!-- -->From my (Spencer) perspective, a 404 from the SavedObjectsApi is a 404; The object the request/call was targeting could not be found. This is why \#14141 takes special care to ensure that 404 errors are generic and don't distinguish between index missing or document missing.<!-- -->See [SavedObjectsClient](./kibana-plugin-core-server.savedobjectsclient.md) See [SavedObjectsErrorHelpers](./kibana-plugin-core-server.savedobjectserrorhelpers.md) |
268268
| [SavedObjectsClientFactory](./kibana-plugin-core-server.savedobjectsclientfactory.md) | Describes the factory used to create instances of the Saved Objects Client. |
269269
| [SavedObjectsClientFactoryProvider](./kibana-plugin-core-server.savedobjectsclientfactoryprovider.md) | Provider to invoke to retrieve a [SavedObjectsClientFactory](./kibana-plugin-core-server.savedobjectsclientfactory.md)<!-- -->. |
270270
| [SavedObjectsClientWrapperFactory](./kibana-plugin-core-server.savedobjectsclientwrapperfactory.md) | Describes the factory used to create instances of Saved Objects Client Wrappers. |
271271
| [SavedObjectsFieldMapping](./kibana-plugin-core-server.savedobjectsfieldmapping.md) | Describe a [saved object type mapping](./kibana-plugin-core-server.savedobjectstypemappingdefinition.md) field.<!-- -->Please refer to [elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html) For the mapping documentation |
272272
| [SavedObjectsNamespaceType](./kibana-plugin-core-server.savedobjectsnamespacetype.md) | The namespace type dictates how a saved object can be interacted in relation to namespaces. Each type is mutually exclusive: \* single (default): this type of saved object is namespace-isolated, e.g., it exists in only one namespace. \* multiple: this type of saved object is shareable, e.g., it can exist in one or more namespaces. \* agnostic: this type of saved object is global.<!-- -->Note: do not write logic that uses this value directly; instead, use the appropriate accessors in the [type registry](./kibana-plugin-core-server.savedobjecttyperegistry.md)<!-- -->. |
273+
| [SavedObjectUnsanitizedDoc](./kibana-plugin-core-server.savedobjectunsanitizeddoc.md) | Describes Saved Object documents from Kibana &lt; 7.0.0 which don't have a <code>references</code> root property defined. This type should only be used in migrations. |
273274
| [ScopeableRequest](./kibana-plugin-core-server.scopeablerequest.md) | A user credentials container. It accommodates the necessary auth credentials to impersonate the current user.<!-- -->See [KibanaRequest](./kibana-plugin-core-server.kibanarequest.md)<!-- -->. |
274275
| [ServiceStatusLevel](./kibana-plugin-core-server.servicestatuslevel.md) | A convenience type that represents the union of each value in [ServiceStatusLevels](./kibana-plugin-core-server.servicestatuslevels.md)<!-- -->. |
275276
| [SharedGlobalConfig](./kibana-plugin-core-server.sharedglobalconfig.md) | |

docs/development/core/server/kibana-plugin-core-server.savedobjectsanitizeddoc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
## SavedObjectSanitizedDoc type
66

7+
Describes Saved Object documents that have passed through the migration framework and are guaranteed to have a `references` root property.
78

89
<b>Signature:</b>
910

0 commit comments

Comments
 (0)