Skip to content

Commit 9c4be2c

Browse files
Merge branch '7.x' into backport/7.x/pr-64887
2 parents e3e4111 + 3d1024c commit 9c4be2c

133 files changed

Lines changed: 3994 additions & 1314 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.

.ci/es-snapshots/Jenkinsfile_verify_es

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,41 +21,46 @@ def SNAPSHOT_MANIFEST = "https://storage.googleapis.com/kibana-ci-es-snapshots-d
2121

2222
kibanaPipeline(timeoutMinutes: 135) {
2323
catchErrors {
24-
retryable.enable(2)
25-
withEnv(["ES_SNAPSHOT_MANIFEST=${SNAPSHOT_MANIFEST}"]) {
26-
parallel([
27-
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
28-
'x-pack-intake-agent': workers.intake('x-pack-intake', './test/scripts/jenkins_xpack.sh'),
29-
'kibana-oss-agent': workers.functional('kibana-oss-tests', { kibanaPipeline.buildOss() }, [
30-
'oss-ciGroup1': kibanaPipeline.ossCiGroupProcess(1),
31-
'oss-ciGroup2': kibanaPipeline.ossCiGroupProcess(2),
32-
'oss-ciGroup3': kibanaPipeline.ossCiGroupProcess(3),
33-
'oss-ciGroup4': kibanaPipeline.ossCiGroupProcess(4),
34-
'oss-ciGroup5': kibanaPipeline.ossCiGroupProcess(5),
35-
'oss-ciGroup6': kibanaPipeline.ossCiGroupProcess(6),
36-
'oss-ciGroup7': kibanaPipeline.ossCiGroupProcess(7),
37-
'oss-ciGroup8': kibanaPipeline.ossCiGroupProcess(8),
38-
'oss-ciGroup9': kibanaPipeline.ossCiGroupProcess(9),
39-
'oss-ciGroup10': kibanaPipeline.ossCiGroupProcess(10),
40-
'oss-ciGroup11': kibanaPipeline.ossCiGroupProcess(11),
41-
'oss-ciGroup12': kibanaPipeline.ossCiGroupProcess(12),
42-
]),
43-
'kibana-xpack-agent': workers.functional('kibana-xpack-tests', { kibanaPipeline.buildXpack() }, [
44-
'xpack-ciGroup1': kibanaPipeline.xpackCiGroupProcess(1),
45-
'xpack-ciGroup2': kibanaPipeline.xpackCiGroupProcess(2),
46-
'xpack-ciGroup3': kibanaPipeline.xpackCiGroupProcess(3),
47-
'xpack-ciGroup4': kibanaPipeline.xpackCiGroupProcess(4),
48-
'xpack-ciGroup5': kibanaPipeline.xpackCiGroupProcess(5),
49-
'xpack-ciGroup6': kibanaPipeline.xpackCiGroupProcess(6),
50-
'xpack-ciGroup7': kibanaPipeline.xpackCiGroupProcess(7),
51-
'xpack-ciGroup8': kibanaPipeline.xpackCiGroupProcess(8),
52-
'xpack-ciGroup9': kibanaPipeline.xpackCiGroupProcess(9),
53-
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
54-
]),
55-
])
56-
}
24+
slackNotifications.onFailure(
25+
title: ":broken_heart: *<${env.BUILD_URL}|[${SNAPSHOT_VERSION}] ES Snapshot Verification Failure>*",
26+
message: ":broken_heart: [${SNAPSHOT_VERSION}] ES Snapshot Verification Failure",
27+
) {
28+
retryable.enable(2)
29+
withEnv(["ES_SNAPSHOT_MANIFEST=${SNAPSHOT_MANIFEST}"]) {
30+
parallel([
31+
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
32+
'x-pack-intake-agent': workers.intake('x-pack-intake', './test/scripts/jenkins_xpack.sh'),
33+
'kibana-oss-agent': workers.functional('kibana-oss-tests', { kibanaPipeline.buildOss() }, [
34+
'oss-ciGroup1': kibanaPipeline.ossCiGroupProcess(1),
35+
'oss-ciGroup2': kibanaPipeline.ossCiGroupProcess(2),
36+
'oss-ciGroup3': kibanaPipeline.ossCiGroupProcess(3),
37+
'oss-ciGroup4': kibanaPipeline.ossCiGroupProcess(4),
38+
'oss-ciGroup5': kibanaPipeline.ossCiGroupProcess(5),
39+
'oss-ciGroup6': kibanaPipeline.ossCiGroupProcess(6),
40+
'oss-ciGroup7': kibanaPipeline.ossCiGroupProcess(7),
41+
'oss-ciGroup8': kibanaPipeline.ossCiGroupProcess(8),
42+
'oss-ciGroup9': kibanaPipeline.ossCiGroupProcess(9),
43+
'oss-ciGroup10': kibanaPipeline.ossCiGroupProcess(10),
44+
'oss-ciGroup11': kibanaPipeline.ossCiGroupProcess(11),
45+
'oss-ciGroup12': kibanaPipeline.ossCiGroupProcess(12),
46+
]),
47+
'kibana-xpack-agent': workers.functional('kibana-xpack-tests', { kibanaPipeline.buildXpack() }, [
48+
'xpack-ciGroup1': kibanaPipeline.xpackCiGroupProcess(1),
49+
'xpack-ciGroup2': kibanaPipeline.xpackCiGroupProcess(2),
50+
'xpack-ciGroup3': kibanaPipeline.xpackCiGroupProcess(3),
51+
'xpack-ciGroup4': kibanaPipeline.xpackCiGroupProcess(4),
52+
'xpack-ciGroup5': kibanaPipeline.xpackCiGroupProcess(5),
53+
'xpack-ciGroup6': kibanaPipeline.xpackCiGroupProcess(6),
54+
'xpack-ciGroup7': kibanaPipeline.xpackCiGroupProcess(7),
55+
'xpack-ciGroup8': kibanaPipeline.xpackCiGroupProcess(8),
56+
'xpack-ciGroup9': kibanaPipeline.xpackCiGroupProcess(9),
57+
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
58+
]),
59+
])
60+
}
5761

58-
promoteSnapshot(SNAPSHOT_VERSION, SNAPSHOT_ID)
62+
promoteSnapshot(SNAPSHOT_VERSION, SNAPSHOT_ID)
63+
}
5964
}
6065

6166
kibanaPipeline.sendMail()

src/core/server/http/integration_tests/core_services.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('http service', () => {
4343
describe('auth', () => {
4444
let root: ReturnType<typeof kbnTestServer.createRoot>;
4545
beforeEach(async () => {
46-
root = kbnTestServer.createRoot();
46+
root = kbnTestServer.createRoot({ plugins: { initialize: false } });
4747
}, 30000);
4848

4949
afterEach(async () => {
@@ -192,7 +192,7 @@ describe('http service', () => {
192192

193193
let root: ReturnType<typeof kbnTestServer.createRoot>;
194194
beforeEach(async () => {
195-
root = kbnTestServer.createRoot();
195+
root = kbnTestServer.createRoot({ plugins: { initialize: false } });
196196
}, 30000);
197197

198198
afterEach(async () => {
@@ -326,7 +326,7 @@ describe('http service', () => {
326326
describe('#basePath()', () => {
327327
let root: ReturnType<typeof kbnTestServer.createRoot>;
328328
beforeEach(async () => {
329-
root = kbnTestServer.createRoot();
329+
root = kbnTestServer.createRoot({ plugins: { initialize: false } });
330330
}, 30000);
331331

332332
afterEach(async () => await root.shutdown());
@@ -355,7 +355,7 @@ describe('http service', () => {
355355
describe('elasticsearch', () => {
356356
let root: ReturnType<typeof kbnTestServer.createRoot>;
357357
beforeEach(async () => {
358-
root = kbnTestServer.createRoot();
358+
root = kbnTestServer.createRoot({ plugins: { initialize: false } });
359359
}, 30000);
360360

361361
afterEach(async () => {

src/plugins/vis_type_timeseries/public/application/components/vis_editor.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ export class VisEditor extends Component {
7474

7575
handleUiState = (field, value) => {
7676
this.props.vis.uiState.set(field, value);
77+
// reload visualization because data might need to be re-fetched
78+
this.props.vis.uiState.emit('reload');
7779
};
7880

7981
updateVisState = debounce(() => {

src/plugins/visualizations/public/embeddable/visualize_embeddable.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export interface VisualizeInput extends EmbeddableInput {
6060
vis?: {
6161
colors?: { [key: string]: string };
6262
};
63+
table?: unknown;
6364
}
6465

6566
export interface VisualizeOutput extends EmbeddableOutput {
@@ -77,7 +78,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
7778
private query?: Query;
7879
private title?: string;
7980
private filters?: Filter[];
80-
private visCustomizations: VisualizeInput['vis'];
81+
private visCustomizations?: Pick<VisualizeInput, 'vis' | 'table'>;
8182
private subscriptions: Subscription[] = [];
8283
private expression: string = '';
8384
private vis: Vis;
@@ -108,6 +109,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
108109
this.timefilter = timefilter;
109110
this.vis = vis;
110111
this.vis.uiState.on('change', this.uiStateChangeHandler);
112+
this.vis.uiState.on('reload', this.reload);
111113

112114
this.autoRefreshFetchSubscription = timefilter
113115
.getAutoRefreshFetch$()
@@ -149,17 +151,22 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
149151
// Check for changes that need to be forwarded to the uiState
150152
// Since the vis has an own listener on the uiState we don't need to
151153
// pass anything from here to the handler.update method
152-
const visCustomizations = this.input.vis;
153-
if (visCustomizations) {
154+
const visCustomizations = { vis: this.input.vis, table: this.input.table };
155+
if (visCustomizations.vis || visCustomizations.table) {
154156
if (!_.isEqual(visCustomizations, this.visCustomizations)) {
155157
this.visCustomizations = visCustomizations;
156158
// Turn this off or the uiStateChangeHandler will fire for every modification.
157159
this.vis.uiState.off('change', this.uiStateChangeHandler);
158160
this.vis.uiState.clearAllKeys();
159-
this.vis.uiState.set('vis', visCustomizations);
160-
getKeys(visCustomizations).forEach(key => {
161-
this.vis.uiState.set(key, visCustomizations[key]);
162-
});
161+
if (visCustomizations.vis) {
162+
this.vis.uiState.set('vis', visCustomizations.vis);
163+
getKeys(visCustomizations).forEach(key => {
164+
this.vis.uiState.set(key, visCustomizations[key]);
165+
});
166+
}
167+
if (visCustomizations.table) {
168+
this.vis.uiState.set('table', visCustomizations.table);
169+
}
163170
this.vis.uiState.on('change', this.uiStateChangeHandler);
164171
}
165172
} else if (this.parent) {
@@ -307,6 +314,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
307314
super.destroy();
308315
this.subscriptions.forEach(s => s.unsubscribe());
309316
this.vis.uiState.off('change', this.uiStateChangeHandler);
317+
this.vis.uiState.off('reload', this.reload);
310318

311319
if (this.handler) {
312320
this.handler.destroy();

src/plugins/visualize/public/application/editor/editor.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState
387387
stateContainer
388388
);
389389
vis.uiState = persistedState;
390+
vis.uiState.on('reload', embeddableHandler.reload);
390391
$scope.uiState = persistedState;
391392
$scope.savedVis = savedVis;
392393
$scope.query = initialState.query;
@@ -534,6 +535,7 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState
534535
$scope.eventEmitter.off('apply', _applyVis);
535536

536537
unsubscribePersisted();
538+
vis.uiState.off('reload', embeddableHandler.reload);
537539
unsubscribeStateUpdates();
538540

539541
stopAllSyncing();

vars/slackNotifications.groovy

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
def getFailedBuildBlocks() {
2+
def messages = [
3+
getFailedSteps(),
4+
getTestFailures(),
5+
]
6+
7+
return messages
8+
.findAll { !!it } // No blank strings
9+
.collect { markdownBlock(it) }
10+
}
11+
12+
def dividerBlock() {
13+
return [ type: "divider" ]
14+
}
15+
16+
def markdownBlock(message) {
17+
return [
18+
type: "section",
19+
text: [
20+
type: "mrkdwn",
21+
text: message,
22+
],
23+
]
24+
}
25+
26+
def contextBlock(message) {
27+
return [
28+
type: "context",
29+
elements: [
30+
[
31+
type: 'mrkdwn',
32+
text: message,
33+
]
34+
]
35+
]
36+
}
37+
38+
def getFailedSteps() {
39+
try {
40+
def steps = jenkinsApi.getFailedSteps()?.findAll { step ->
41+
step.displayName != 'Check out from version control'
42+
}
43+
44+
if (steps?.size() > 0) {
45+
def list = steps.collect { "• <${it.logs}|${it.displayName}>" }.join("\n")
46+
return "*Failed Steps*\n${list}"
47+
}
48+
} catch (ex) {
49+
buildUtils.printStacktrace(ex)
50+
print "Error retrieving failed pipeline steps for PR comment, will skip this section"
51+
}
52+
53+
return ""
54+
}
55+
56+
def getTestFailures() {
57+
def failures = testUtils.getFailures()
58+
if (!failures) {
59+
return ""
60+
}
61+
62+
def messages = []
63+
messages << "*Test Failures*"
64+
65+
def list = failures.collect { "• <${it.url}|${it.fullDisplayName}>" }.join("\n")
66+
return "*Test Failures*\n${list}"
67+
}
68+
69+
def sendFailedBuild(Map params = [:]) {
70+
def displayName = "${env.JOB_NAME} ${env.BUILD_DISPLAY_NAME}"
71+
72+
def config = [
73+
channel: '#kibana-operations',
74+
title: ":broken_heart: *<${env.BUILD_URL}|${displayName}>*",
75+
message: ":broken_heart: ${displayName}",
76+
color: 'danger',
77+
icon: ':jenkins:',
78+
username: 'Kibana Operations',
79+
context: contextBlock("${displayName} · <https://ci.kibana.dev/${env.JOB_BASE_NAME}/${env.BUILD_NUMBER}|ci.kibana.dev>"),
80+
] + params
81+
82+
def blocks = [markdownBlock(config.title)]
83+
getFailedBuildBlocks().each { blocks << it }
84+
blocks << dividerBlock()
85+
blocks << config.context
86+
87+
slackSend(
88+
channel: config.channel,
89+
username: config.username,
90+
iconEmoji: config.icon,
91+
color: config.color,
92+
message: config.message,
93+
blocks: blocks
94+
)
95+
}
96+
97+
def onFailure(Map options = [:], Closure closure) {
98+
// try/finally will NOT work here, because the build status will not have been changed to ERROR when the finally{} block executes
99+
catchError {
100+
closure()
101+
}
102+
103+
def status = buildUtils.getBuildStatus()
104+
if (status != "SUCCESS" && status != "UNSTABLE") {
105+
catchErrors {
106+
sendFailedBuild(options)
107+
}
108+
}
109+
}
110+
111+
return this

x-pack/legacy/plugins/maps/mappings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
"indexPatternsWithGeoFieldCount": {
3737
"type": "long"
3838
},
39+
"indexPatternsWithGeoPointFieldCount": {
40+
"type": "long"
41+
},
42+
"indexPatternsWithGeoShapeFieldCount": {
43+
"type": "long"
44+
},
3945
"mapsTotalCount": {
4046
"type": "long"
4147
},

x-pack/legacy/plugins/maps/server/maps_telemetry/maps_telemetry.test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ describe('buildMapsTelemetry', () => {
2020

2121
expect(result).toMatchObject({
2222
indexPatternsWithGeoFieldCount: 0,
23+
indexPatternsWithGeoPointFieldCount: 0,
24+
indexPatternsWithGeoShapeFieldCount: 0,
2325
attributesPerMap: {
2426
dataSourcesCount: {
2527
avg: 0,
@@ -45,7 +47,9 @@ describe('buildMapsTelemetry', () => {
4547
const result = buildMapsTelemetry({ mapSavedObjects, indexPatternSavedObjects, settings });
4648

4749
expect(result).toMatchObject({
48-
indexPatternsWithGeoFieldCount: 2,
50+
indexPatternsWithGeoFieldCount: 3,
51+
indexPatternsWithGeoPointFieldCount: 2,
52+
indexPatternsWithGeoShapeFieldCount: 1,
4953
attributesPerMap: {
5054
dataSourcesCount: {
5155
avg: 2.6666666666666665,

x-pack/legacy/plugins/maps/server/maps_telemetry/maps_telemetry.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,27 @@ function getIndexPatternsWithGeoFieldCount(indexPatterns: IIndexPattern[]) {
6161
? JSON.parse(indexPattern.attributes.fields)
6262
: []
6363
);
64+
6465
const fieldListsWithGeoFields = fieldLists.filter(fields =>
6566
fields.some(
6667
(field: IFieldType) =>
6768
field.type === ES_GEO_FIELD_TYPE.GEO_POINT || field.type === ES_GEO_FIELD_TYPE.GEO_SHAPE
6869
)
6970
);
70-
return fieldListsWithGeoFields.length;
71+
72+
const fieldListsWithGeoPointFields = fieldLists.filter(fields =>
73+
fields.some((field: IFieldType) => field.type === ES_GEO_FIELD_TYPE.GEO_POINT)
74+
);
75+
76+
const fieldListsWithGeoShapeFields = fieldLists.filter(fields =>
77+
fields.some((field: IFieldType) => field.type === ES_GEO_FIELD_TYPE.GEO_SHAPE)
78+
);
79+
80+
return {
81+
indexPatternsWithGeoFieldCount: fieldListsWithGeoFields.length,
82+
indexPatternsWithGeoPointFieldCount: fieldListsWithGeoPointFields.length,
83+
indexPatternsWithGeoShapeFieldCount: fieldListsWithGeoShapeFields.length,
84+
};
7185
}
7286

7387
export function buildMapsTelemetry({
@@ -110,12 +124,16 @@ export function buildMapsTelemetry({
110124
const dataSourcesCountSum = _.sum(dataSourcesCount);
111125
const layersCountSum = _.sum(layersCount);
112126

113-
const indexPatternsWithGeoFieldCount = getIndexPatternsWithGeoFieldCount(
114-
indexPatternSavedObjects
115-
);
127+
const {
128+
indexPatternsWithGeoFieldCount,
129+
indexPatternsWithGeoPointFieldCount,
130+
indexPatternsWithGeoShapeFieldCount,
131+
} = getIndexPatternsWithGeoFieldCount(indexPatternSavedObjects);
116132
return {
117133
settings,
118134
indexPatternsWithGeoFieldCount,
135+
indexPatternsWithGeoPointFieldCount,
136+
indexPatternsWithGeoShapeFieldCount,
119137
// Total count of maps
120138
mapsTotalCount: mapsCount,
121139
// Time of capture

0 commit comments

Comments
 (0)