Skip to content

Commit df3540a

Browse files
authored
Scout reporting - add build trigger details (#241132)
## Summary This PR adds build trigger information to our test result reporting by including buildkite's `BUILDKITE_TRIGGERED_FROM_BUILD*` environment variables. This will help to e.g. filter test results for quality gate runs.
1 parent d8c5140 commit df3540a

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

src/platform/packages/private/kbn-scout-reporting/src/datasources/buildkite.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ export interface BuildkiteMetadata {
3939
label?: string;
4040
};
4141
command?: string;
42+
triggered_from_build: {
43+
id?: string;
44+
number?: string;
45+
pipeline_slug?: string;
46+
};
4247
}
4348

4449
/**
@@ -77,11 +82,17 @@ export const buildkite: BuildkiteMetadata =
7782
label: process.env.BUILDKITE_LABEL,
7883
},
7984
command: process.env.BUILDKITE_COMMAND,
85+
triggered_from_build: {
86+
id: process.env.BUILDKITE_TRIGGERED_FROM_BUILD_ID,
87+
number: process.env.BUILDKITE_TRIGGERED_FROM_BUILD_NUMBER,
88+
pipeline_slug: process.env.BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG,
89+
},
8090
}
8191
: {
8292
build: {},
8393
pipeline: {},
8494
agent: {},
8595
group: {},
8696
step: {},
97+
triggered_from_build: {},
8798
};

src/platform/packages/private/kbn-scout-reporting/src/reporting/report/events/persistence/component_templates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818

1919
export const buildkiteMappings: ClusterPutComponentTemplateRequest = {
2020
name: 'scout-test-event.mappings.buildkite',
21-
version: 1,
21+
version: 2,
2222
template: {
2323
mappings: {
2424
properties: {

src/platform/packages/private/kbn-scout-reporting/src/reporting/report/events/persistence/mappings.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const buildkiteProperties: Record<PropertyName, MappingProperty> = {
4545
type: 'text',
4646
},
4747
slug: {
48-
type: 'wildcard',
48+
type: 'keyword',
4949
},
5050
},
5151
},
@@ -93,6 +93,20 @@ export const buildkiteProperties: Record<PropertyName, MappingProperty> = {
9393
},
9494
},
9595
},
96+
triggered_from_build: {
97+
type: 'object',
98+
properties: {
99+
id: {
100+
type: 'wildcard',
101+
},
102+
number: {
103+
type: 'integer',
104+
},
105+
pipeline_slug: {
106+
type: 'keyword',
107+
},
108+
},
109+
},
96110
};
97111

98112
export const fileInfoProperties: Record<PropertyName, MappingProperty> = {

0 commit comments

Comments
 (0)