Skip to content

Commit 705ed42

Browse files
authored
Merge branch 'main' into fix-ms-defender-runscript-slow-tests
2 parents 2944e34 + 799f6f1 commit 705ed42

2,167 files changed

Lines changed: 42331 additions & 23250 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.

.agents/skills/task-manager-registration/SKILL.md

Lines changed: 457 additions & 0 deletions
Large diffs are not rendered by default.

.buildkite/ftr_platform_stateful_configs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@ enabled:
468468
- x-pack/platform/test/api_integration/apis/kibana/config.ts
469469
- x-pack/platform/test/api_integration/apis/management/config.ts
470470
- x-pack/platform/test/api_integration/apis/management/index_management/disabled_data_enrichers/config.ts
471-
- x-pack/platform/test/api_integration/apis/lens/config.ts
472471
- x-pack/platform/test/api_integration/apis/ml/config.ts
473472
- x-pack/platform/test/api_integration/apis/monitoring/config.ts
474473
- x-pack/platform/test/api_integration/apis/monitoring_collection/config.ts

.buildkite/pipeline-utils/scout/test_distribution_strategies.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ async function distributeScoutTestsOnLanes() {
111111
loadIDsByStepKey[stepKey] = lane.loads;
112112
});
113113

114+
if (steps.length === 0) {
115+
// Stop early. No test steps to upload. ✨
116+
return;
117+
}
118+
114119
const bk = new BuildkiteClient();
115120

116121
const lanesGroupStepDependencies: string[] = [];

.buildkite/pipelines/agent_builder/smoke_tests.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ steps:
5252
FTR_GEN_AI_LLM_SAMPLE_SIZE: 'all'
5353
FTR_CONFIG: 'x-pack/platform/test/agent_builder/smoke_tests/config.stateful.ts'
5454
FTR_CONFIG_GROUP_KEY: 'ftr-agent-builder-smoke-tests'
55-
label: Agent Builder API Smoke Tests
55+
label: Agent Builder FTR Smoke Tests
5656
key: ftr-agent-builder-smoke-tests
5757
depends_on: discover-eis-models
5858
timeout_in_minutes: 50
@@ -69,3 +69,32 @@ steps:
6969
limit: 3
7070
- exit_status: '*'
7171
limit: 1
72+
73+
- command: |
74+
mkdir -p target
75+
buildkite-agent artifact download 'target/eis_models.json' . --step discover-eis-models || echo '{"models":[]}' > target/eis_models.json
76+
.buildkite/scripts/steps/test/scout/configs.sh
77+
env:
78+
FTR_GEN_AI: '1'
79+
FTR_EIS_CCM: '1'
80+
FTR_GEN_AI_LLM_SAMPLE_SIZE: 'all'
81+
SCOUT_CONFIG: 'x-pack/platform/plugins/shared/agent_builder/test/scout_agent_builder_smoke/api/playwright.config.ts'
82+
SCOUT_CONFIG_GROUP_TYPE: 'scout-agent-builder-smoke-tests'
83+
SCOUT_SERVER_RUN_FLAGS: '--arch stateful --domain classic'
84+
label: Agent Builder Scout Smoke Tests
85+
key: scout-agent-builder-smoke-tests
86+
depends_on: discover-eis-models
87+
timeout_in_minutes: 50
88+
parallelism: 1
89+
agents:
90+
image: family/kibana-ubuntu-2404
91+
imageProject: elastic-images-prod
92+
provider: gcp
93+
machineType: n2-standard-4
94+
preemptible: true
95+
retry:
96+
automatic:
97+
- exit_status: '-1'
98+
limit: 3
99+
- exit_status: '*'
100+
limit: 1

.buildkite/pipelines/pull_request/agent_builder_smoke_tests.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ steps:
3232
FTR_EIS_CCM: '1'
3333
FTR_CONFIG: 'x-pack/platform/test/agent_builder/smoke_tests/config.stateful.ts'
3434
FTR_CONFIG_GROUP_KEY: 'ftr-agent-builder-smoke-tests'
35-
label: Agent Builder API Smoke Tests
35+
label: Agent Builder FTR Smoke Tests
3636
key: ftr-agent-builder-smoke-tests
3737
depends_on: discover-eis-models
3838
timeout_in_minutes: 50
@@ -47,3 +47,29 @@ steps:
4747
limit: 3
4848
- exit_status: '*'
4949
limit: 1
50+
51+
- command: |
52+
mkdir -p target
53+
buildkite-agent artifact download 'target/eis_models.json' . --step discover-eis-models || echo '{"models":[]}' > target/eis_models.json
54+
.buildkite/scripts/steps/test/scout/configs.sh
55+
env:
56+
FTR_GEN_AI: '1'
57+
FTR_EIS_CCM: '1'
58+
SCOUT_CONFIG: 'x-pack/platform/plugins/shared/agent_builder/test/scout_agent_builder_smoke/api/playwright.config.ts'
59+
SCOUT_CONFIG_GROUP_TYPE: 'scout-agent-builder-smoke-tests'
60+
SCOUT_SERVER_RUN_FLAGS: '--arch stateful --domain classic'
61+
label: Agent Builder Scout Smoke Tests
62+
key: scout-agent-builder-smoke-tests
63+
depends_on: discover-eis-models
64+
timeout_in_minutes: 50
65+
parallelism: 1
66+
agents:
67+
machineType: n2-standard-4
68+
preemptible: true
69+
spotZones: us-central1-f,us-central1-c,us-central1-a
70+
retry:
71+
automatic:
72+
- exit_status: '-1'
73+
limit: 3
74+
- exit_status: '*'
75+
limit: 1

.buildkite/pipelines/version_bump.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ notify:
22
- slack:
33
channels:
44
- '#kibana-operations-alerts'
5-
if: (build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9x]+\$/) && (build.state == 'passed' || build.state == 'failed')
5+
if: (build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9x]+\$/) &&
6+
(build.state == 'passed' || build.state == 'failed')
67
- slack:
78
channels:
89
- '#mission-control'
@@ -30,9 +31,9 @@ steps:
3031
depends_on: bump-version
3132
agents:
3233
image: docker.elastic.co/release-eng/wolfi-build-essential-release-eng:latest
33-
cpu: 250m
34-
memory: 512Mi
35-
ephemeralStorage: 1Gi
34+
cpu: 2
35+
memory: 4G
36+
ephemeralStorage: 10G
3637
command:
3738
- echo "Starting DRA artifacts retrieval..."
3839
timeout_in_minutes: 240

.buildkite/scout_ci_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins:
55
- alerting
66
- alerting_v2
77
- apm
8+
- agent_builder
89
- automatic_import
910
- banners
1011
- cloud_security_posture
@@ -70,5 +71,6 @@ packages:
7071
# Define test configs to be excluded from automatic discovery & execution in CI environment (process.env.CI=true)
7172
excluded_configs:
7273
- x-pack/solutions/security/plugins/cloud_security_posture/test/scout_cspm_agentless/ui/parallel.playwright.config.ts
74+
- x-pack/platform/plugins/shared/agent_builder/test/scout_agent_builder_smoke/api/playwright.config.ts
7375
- src/platform/plugins/shared/workflows_management/test/scout_workflows_oom_testing/api/playwright.config.ts
7476
- x-pack/solutions/security/plugins/security_solution/test/scout_cps_local/ui/playwright.config.ts

.buildkite/scripts/steps/test/scout/configs.sh

100644100755
File mode changed.

.buildkite/scripts/steps/test/scout/resolve_selective_testing.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@
99

1010
import fs from 'node:fs';
1111
import path from 'node:path';
12+
import { ToolingLog } from '@kbn/tooling-log';
13+
import { expandWithImplicitConsumers } from './scout_implicit_consumers';
1214
import {
1315
getAffectedPackages,
1416
listChangedFiles,
1517
touchedCriticalFiles,
1618
CRITICAL_FILES_SCOUT,
1719
} from '#pipeline-utils';
1820

21+
const log = new ToolingLog({ level: 'info', writeTo: process.stderr });
22+
1923
const mergeBase = process.env.AFFECTED_MERGE_BASE;
2024
const outPath = process.env.AFFECTED_MODULES_FILE;
2125

@@ -34,11 +38,17 @@ if (!outPath) {
3438
const changedFiles = listChangedFiles({ mergeBase, commit: 'HEAD' });
3539

3640
// Write affected modules JSON (replaces the list_affected binary call).
37-
const affectedPackages = await getAffectedPackages(mergeBase, {
38-
strategy: 'git',
39-
includeDownstream: true,
40-
ignoreUncategorizedChanges: true,
41-
});
41+
// TEMP: overlay implicit runtime-registry consumers — see scout_implicit_consumers.ts.
42+
const affectedPackages = expandWithImplicitConsumers(
43+
await getAffectedPackages(mergeBase, {
44+
strategy: 'git',
45+
includeDownstream: true,
46+
ignoreUncategorizedChanges: true,
47+
}),
48+
changedFiles,
49+
log
50+
);
51+
4252
const resolvedOutPath = path.resolve(outPath);
4353
fs.mkdirSync(path.dirname(resolvedOutPath), { recursive: true });
4454
fs.writeFileSync(resolvedOutPath, JSON.stringify(Array.from(affectedPackages).sort(), null, 2));
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
/**
11+
* TEMPORARY overlay for Scout selective testing.
12+
*
13+
* The static @kbn/ dependency graph (kibana.jsonc + tsconfig kbn_references)
14+
* cannot model runtime registry coupling — e.g. ML registers actions into the
15+
* uiActions registry that Dashboard renders at run time, with no static import
16+
* edge between them. ML-only changes therefore do not mark Dashboard's Scout
17+
* tests as affected and registration races slip through.
18+
*
19+
* This overlay augments the affected-modules set with a small allowlist of
20+
* (patterns -> consumer @kbn/ IDs) entries when the corresponding publisher
21+
* files change.
22+
*/
23+
24+
import minimatch from 'minimatch';
25+
import type { ToolingLog } from '@kbn/tooling-log';
26+
27+
interface ImplicitConsumerRule {
28+
reason: string;
29+
patterns: readonly string[];
30+
consumers: readonly string[];
31+
}
32+
33+
const IMPLICIT_REGISTRY_CONSUMERS: readonly ImplicitConsumerRule[] = [
34+
{
35+
reason: 'Runtime registry coupling not captured by static @kbn/ references.',
36+
patterns: [
37+
'**/plugins/**/public/embeddables/**/*.{ts,tsx}',
38+
'**/plugins/**/public/embeddable/**/*.{ts,tsx}',
39+
'**/plugins/**/public/react_embeddable/**/*.{ts,tsx}',
40+
'**/plugins/**/public/apps/embeddables/**/*.{ts,tsx}',
41+
'**/plugins/**/public/ui_actions/**/*.{ts,tsx}',
42+
'**/plugins/**/public/trigger_actions/**/*.{ts,tsx}',
43+
'**/plugins/**/public/**/actions/register*.{ts,tsx}',
44+
],
45+
consumers: [
46+
'@kbn/dashboard-plugin',
47+
'@kbn/embeddable-plugin',
48+
'@kbn/canvas-plugin',
49+
'@kbn/lens-plugin',
50+
],
51+
},
52+
];
53+
54+
/**
55+
* Augment an affected-modules set with consumer @kbn/ IDs whose registries are
56+
* touched by `changedFiles`. Returns a new Set; never removes entries and
57+
* never disables selective testing.
58+
*/
59+
export function expandWithImplicitConsumers(
60+
affected: ReadonlySet<string>,
61+
changedFiles: readonly string[],
62+
log: ToolingLog
63+
): Set<string> {
64+
const expanded = new Set(affected);
65+
66+
for (const rule of IMPLICIT_REGISTRY_CONSUMERS) {
67+
const trigger = changedFiles.find((file) =>
68+
rule.patterns.some((pattern) => minimatch(file, pattern, { dot: true }))
69+
);
70+
if (!trigger) continue;
71+
72+
const added = rule.consumers.filter((id) => !expanded.has(id));
73+
if (added.length === 0) continue;
74+
75+
for (const id of added) expanded.add(id);
76+
log.info(
77+
`Implicit consumers added: ${added.join(', ')} (triggered by '${trigger}' — ${rule.reason})`
78+
);
79+
}
80+
81+
return expanded;
82+
}

0 commit comments

Comments
 (0)