Skip to content

Commit cbd1e56

Browse files
authored
Merge branch 'main' into copilot/fix-eslint-violations-icon-accessibility
2 parents cbcdd4d + 605c2b1 commit cbd1e56

4,560 files changed

Lines changed: 178906 additions & 2187778 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/validate-oas/SKILL.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,19 @@ node scripts/capture_oas_snapshot \
5454
--include-path /api/maintenance_window \
5555
--include-path /api/agent_builder \
5656
--include-path /api/workflows \
57-
--include-path /api/security/entity_store
57+
--include-path /api/security/entity_store \
58+
--include-path /api/dashboards \
59+
--include-path /api/visualizations
5860
```
5961

60-
3. Rebuild the final OAS documents:
62+
3. Run the OpenAPI bundling scripts:
63+
64+
```bash
65+
bash .buildkite/scripts/steps/openapi_bundling/security_solution_openapi_bundling.sh
66+
bash .buildkite/scripts/steps/openapi_bundling/final_merge.sh
67+
```
68+
69+
4. Rebuild the final OAS documents:
6170

6271
```bash
6372
cd oas_docs && make api-docs
@@ -67,6 +76,7 @@ After this refresh flow completes, run the scoped validation command.
6776

6877
Source of truth:
6978
- Keep the `capture_oas_snapshot` include-path list aligned with `.buildkite/scripts/steps/checks/capture_oas_snapshot.sh`.
79+
- Keep the openapi_bundling step list aligned with `.buildkite/scripts/steps/openapi_bundling/`.
7080
- If the Buildkite command changes, update this skill to match it.
7181

7282
## Required interaction flow
@@ -108,7 +118,11 @@ node scripts/capture_oas_snapshot \
108118
--include-path /api/maintenance_window \
109119
--include-path /api/agent_builder \
110120
--include-path /api/workflows \
111-
--include-path /api/security/entity_store
121+
--include-path /api/security/entity_store \
122+
--include-path /api/dashboards \
123+
--include-path /api/visualizations
124+
bash .buildkite/scripts/steps/openapi_bundling/security_solution_openapi_bundling.sh
125+
bash .buildkite/scripts/steps/openapi_bundling/final_merge.sh
112126
cd oas_docs && make api-docs
113127
```
114128

.buildkite/ftr-manifests/ftr_oblt_stateful_configs.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,18 @@ enabled:
2323
- x-pack/solutions/observability/test/api_integration/apis/logs_shared/config.ts
2424
- x-pack/solutions/observability/test/api_integration/apis/metrics_ui/config.ts
2525
- x-pack/solutions/observability/test/api_integration/apis/synthetics/config.ts
26-
- x-pack/solutions/observability/test/api_integration/apis/uptime/config.ts
2726
- x-pack/solutions/observability/test/apm_api_integration/basic/config.ts
2827
- x-pack/solutions/observability/test/apm_api_integration/cloud/config.ts
2928
- x-pack/solutions/observability/test/apm_api_integration/rules/config.ts
3029
- x-pack/solutions/observability/test/apm_api_integration/trial/config.ts
3130
- x-pack/solutions/observability/test/functional/apps/dataset_quality/config.ts
32-
- x-pack/solutions/observability/test/functional/apps/uptime/config.ts
33-
- x-pack/solutions/observability/test/observability_api_integration/basic/config.ts
3431
- x-pack/solutions/observability/test/observability_api_integration/trial/config.ts
3532
- x-pack/solutions/observability/test/observability_functional/with_rac_write.config.ts
3633
- x-pack/solutions/observability/test/observability_ai_assistant_functional/enterprise/config.ts
3734
- x-pack/solutions/observability/test/api_integration/profiling/cloud/config.ts
3835
- x-pack/solutions/observability/test/functional/apps/apm/config.ts
3936
- x-pack/solutions/observability/test/functional_with_es_ssl/config.ts
4037
- x-pack/solutions/observability/test/api_integration/apis/cases/config.ts
41-
- x-pack/solutions/observability/test/functional/apps/slo/embeddables/config.ts
4238
- x-pack/solutions/observability/test/api_integration/apis/security/config.ts
4339
- x-pack/solutions/observability/test/accessibility/config.ts
4440
- x-pack/solutions/observability/test/functional/apps/infra/config.ts

.buildkite/ftr-manifests/ftr_platform_stateful_configs.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,12 @@ enabled:
339339
- x-pack/platform/test/functional/apps/transform/edit_clone/config.ts
340340
- x-pack/platform/test/functional/apps/transform/permissions/config.ts
341341
- x-pack/platform/test/functional/apps/transform/feature_controls/config.ts
342-
- x-pack/platform/test/functional/apps/upgrade_assistant/config.ts
343342
- x-pack/platform/test/functional/apps/user_profiles/config.ts
344343
- x-pack/platform/test/functional/apps/visualize/config.ts
345344
- x-pack/platform/test/functional/apps/watcher/config.ts
346345
- x-pack/platform/test/functional/config_security_basic.ts
347346
- x-pack/platform/test/functional/config.ccs.ts
348347
- x-pack/platform/test/functional/config.firefox.ts
349-
- x-pack/platform/test/functional/config.upgrade_assistant.ts
350348
- x-pack/platform/test/functional_cloud/config.ts
351349
- x-pack/platform/test/functional_cloud/saml.config.ts
352350
- x-pack/platform/test/functional_cloud/intercepts.config.ts
@@ -411,7 +409,6 @@ enabled:
411409
- x-pack/platform/test/task_manager_claimer_update_by_query/config.ts
412410
- x-pack/platform/test/ui_capabilities/security_and_spaces/config.ts
413411
- x-pack/platform/test/ui_capabilities/spaces_only/config.ts
414-
- x-pack/platform/test/upgrade_assistant_integration/config.ts
415412
- x-pack/platform/test/reindex_service/config.ts
416413
- x-pack/platform/test/usage_collection/config.ts
417414
- x-pack/performance/journeys_e2e/aiops_log_rate_analysis.ts
@@ -463,7 +460,6 @@ enabled:
463460
- x-pack/platform/test/api_integration/apis/stats/config.ts
464461
- x-pack/platform/test/api_integration/apis/status/config.ts
465462
- x-pack/platform/test/api_integration/apis/telemetry/config.ts
466-
- x-pack/platform/test/api_integration/apis/upgrade_assistant/config.ts
467463
- x-pack/platform/test/api_integration/apis/watcher/config.ts
468464
- x-pack/platform/test/api_integration_basic/apis/aiops/config.ts
469465
- x-pack/platform/test/api_integration_basic/apis/security/config.ts
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/rre.schema.json
2+
apiVersion: backstage.io/v1alpha1
3+
kind: Resource
4+
metadata:
5+
name: bk-kibana-evals-on-demand
6+
description: 'Runs a single @kbn/evals suite and model on demand'
7+
links:
8+
- url: 'https://buildkite.com/elastic/kibana-evals-on-demand'
9+
title: Pipeline link
10+
spec:
11+
type: buildkite-pipeline
12+
owner: 'group:obs-ai-team'
13+
system: buildkite
14+
implementation:
15+
apiVersion: buildkite.elastic.dev/v1
16+
kind: Pipeline
17+
metadata:
18+
name: 'Kibana / Evals / On-demand LLM Evals'
19+
description: 'Runs one @kbn/evals suite against one model on a chosen branch (manual Buildkite trigger)'
20+
spec:
21+
env:
22+
KBN_EVALS: '1'
23+
allow_rebuilds: true
24+
branch_configuration: ''
25+
cancel_intermediate_builds: false
26+
default_branch: main
27+
repository: elastic/kibana
28+
pipeline_file: .buildkite/pipelines/evals/on_demand_evals.yml
29+
provider_settings:
30+
build_branches: false
31+
build_pull_requests: false
32+
publish_commit_status: false
33+
trigger_mode: none
34+
prefix_pull_request_fork_branch_names: false
35+
skip_pull_request_builds_for_existing_commits: false
36+
build_tags: false
37+
teams:
38+
kibana-operations:
39+
access_level: MANAGE_BUILD_AND_READ
40+
obs-ai-team:
41+
access_level: MANAGE_BUILD_AND_READ
42+
everyone:
43+
access_level: BUILD_AND_READ
44+
tags:
45+
- kibana
46+
- kbn-evals

.buildkite/pipeline-resource-definitions/locations.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ spec:
88
type: url
99
targets:
1010
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/cloud-security-posture/cspm-agentless-scout.yml
11+
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/evals/kibana-evals-on-demand.yml
1112
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/evals/kibana-evals.yml
1213
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-agent-builder-smoke-tests-daily.yml
1314
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-apis-capacity-testing-daily.yml

.buildkite/pipeline-utils/affected-packages/const.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,3 @@ export const CRITICAL_FILES_JEST_INTEGRATION_TESTS = [
4747
'.buildkite/pipeline-utils/affected-packages/**/*.{ts,js,sh}',
4848
'.buildkite/pipeline-utils/ci-stats/**/*.{ts,js}',
4949
];
50-
51-
export const CRITICAL_FILES_SCOUT = [
52-
'package.json',
53-
'yarn.lock',
54-
'tsconfig.json',
55-
'.node-version',
56-
'.nvmrc',
57-
'src/setup_node_env/**/*',
58-
'packages/kbn-babel-preset/**/*',
59-
'src/platform/packages/shared/kbn-repo-info/**/*',
60-
'src/platform/packages/shared/kbn-scout/**/*',
61-
'src/platform/packages/private/kbn-scout-reporting/**/*',
62-
'scripts/scout.js',
63-
'.buildkite/scripts/steps/test/scout/**/*',
64-
'.buildkite/pipeline-utils/affected-packages/**/*.{ts,js,sh}',
65-
'.buildkite/pipeline-utils/ci-stats/**/*.{ts,js}',
66-
];

.buildkite/pipeline-utils/affected-packages/utils.ts

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import minimatch from 'minimatch';
10+
import { Minimatch } from 'minimatch';
11+
12+
// Don't annotate the return type as `Minimatch[]`: the installed
13+
// @types/minimatch exports `Minimatch` as a value (not a type), and ts-node
14+
// will reject it. Inference + `ReturnType` keeps the file ts-node-clean.
15+
const compileMatchers = (patterns: readonly string[]) =>
16+
patterns.map((p) => new Minimatch(p, { dot: true }));
17+
18+
const matchesAny = (file: string, matchers: ReturnType<typeof compileMatchers>): boolean =>
19+
matchers.some((m) => m.match(file));
1120

1221
/**
1322
* Returns file paths that don't match any of the given glob patterns.
@@ -17,14 +26,35 @@ export function filterIgnoredFiles(files: string[], patterns: string[]): string[
1726
if (patterns.length === 0) {
1827
return files;
1928
}
20-
return files.filter((file) => !patterns.some((p) => minimatch(file, p, { dot: true })));
29+
const matchers = compileMatchers(patterns);
30+
return files.filter((file) => !matchesAny(file, matchers));
2131
}
2232

2333
/**
2434
* Returns true when any pattern matches any file in the list
2535
*/
2636
export function touchedCriticalFiles(files: string[], criticalFiles: string[]): boolean {
27-
return files.some((file) =>
28-
criticalFiles.some((criticalFile) => minimatch(file, criticalFile, { dot: true }))
29-
);
37+
const matchers = compileMatchers(criticalFiles);
38+
return files.some((file) => matchesAny(file, matchers));
39+
}
40+
41+
/**
42+
* Returns true when every file matches a `scope` pattern, treating files
43+
* that match an `ignore` pattern as irrelevant. Returns false on an empty
44+
* list or as soon as a file matches neither.
45+
*/
46+
export function allChangedFilesInScope(
47+
files: readonly string[],
48+
scope: readonly string[],
49+
ignore: readonly string[] = []
50+
): boolean {
51+
const ignoreMatchers = compileMatchers(ignore);
52+
const scopeMatchers = compileMatchers(scope);
53+
let hasScopedChange = false;
54+
for (const file of files) {
55+
if (matchesAny(file, ignoreMatchers)) continue;
56+
if (!matchesAny(file, scopeMatchers)) return false;
57+
hasScopedChange = true;
58+
}
59+
return hasScopedChange;
3060
}

.buildkite/pipeline-utils/ci-stats/pick_test_group_run_order/pick_test_group_run_order.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import * as Fs from 'fs';
1111

12+
import { listChangedFiles } from '../../affected-packages';
1213
import type { BuildkiteStep } from '../../buildkite';
1314
import { BuildkiteClient } from '../../buildkite';
1415
import { getTrackedBranch } from '../../utils';
@@ -20,6 +21,7 @@ import { loadRunOrderConfig } from './env_config';
2021
import { getEnabledFtrConfigs } from './ftr_manifests';
2122
import { discoverJestIntegrationConfigs, discoverJestUnitConfigs } from './jest_configs';
2223
import { getRunGroup, getRunGroups, labelJestSubgroups } from './run_groups';
24+
import { isScoutTestsOnlyDiff } from './selective_scout';
2325
import {
2426
filterJestIntegrationConfigsByAffected,
2527
filterJestUnitConfigsByAffected,
@@ -41,6 +43,26 @@ export async function pickTestGroupRunOrder() {
4143
const ciStats = new CiStatsClient();
4244
const config = loadRunOrderConfig();
4345

46+
// Holds the merge base only when selective testing is enabled; the two
47+
// `if` blocks below both use it (Scout skip check, then Jest filter).
48+
const selectiveTestingMergeBase = config.useSelectiveTesting ? config.prMergeBase : undefined;
49+
50+
// Fast path: a PR whose diff is exclusively Scout test files cannot affect
51+
// any Jest unit/integration or FTR config — skip emitting them entirely.
52+
// The Scout pipeline still runs its own selective testing in parallel.
53+
if (selectiveTestingMergeBase) {
54+
const changedFiles = listChangedFiles({ mergeBase: selectiveTestingMergeBase, commit: 'HEAD' });
55+
if (isScoutTestsOnlyDiff(changedFiles)) {
56+
console.log('Scout-tests-only diff detected — skipping Jest/FTR test steps');
57+
bk.setAnnotation(
58+
'selective-testing-scout-tests-only',
59+
'info',
60+
'Selective testing: Scout-tests-only diff — Jest/FTR test steps were skipped.'
61+
);
62+
return;
63+
}
64+
}
65+
4466
const unitIncluded = config.limitConfigType.includes('unit');
4567
const integrationIncluded = config.limitConfigType.includes('integration');
4668
const ftrConfigsIncluded = config.limitConfigType.includes('functional');
@@ -55,8 +77,8 @@ export async function pickTestGroupRunOrder() {
5577
);
5678
if (!ftrConfigsIncluded) ftrConfigsByQueue.clear();
5779

58-
if (config.useSelectiveTesting && config.prMergeBase) {
59-
const selectiveCtx = await resolveSelectiveTestingContext(config.prMergeBase);
80+
if (selectiveTestingMergeBase) {
81+
const selectiveCtx = await resolveSelectiveTestingContext(selectiveTestingMergeBase);
6082
if (selectiveCtx !== null) {
6183
jestUnitConfigs = filterJestUnitConfigsByAffected(jestUnitConfigs, selectiveCtx);
6284
jestIntegrationConfigs = filterJestIntegrationConfigsByAffected(
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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+
import { isScoutTestsOnlyDiff } from './selective_scout';
11+
12+
describe('isScoutTestsOnlyDiff', () => {
13+
it('returns false for an empty diff (no signal)', () => {
14+
expect(isScoutTestsOnlyDiff([])).toBe(false);
15+
});
16+
17+
it('returns true for a single Scout UI spec', () => {
18+
expect(
19+
isScoutTestsOnlyDiff([
20+
'src/platform/plugins/shared/discover/test/scout/ui/parallel_tests/foo.spec.ts',
21+
])
22+
).toBe(true);
23+
});
24+
25+
it('returns true for a single Scout API spec', () => {
26+
expect(
27+
isScoutTestsOnlyDiff([
28+
'x-pack/platform/plugins/shared/maps/test/scout/api/tests/health.spec.ts',
29+
])
30+
).toBe(true);
31+
});
32+
33+
it('returns true for shared test code (fixtures, page objects) inside a scope', () => {
34+
expect(
35+
isScoutTestsOnlyDiff([
36+
'src/platform/plugins/shared/discover/test/scout/ui/fixtures/page_objects/landing.ts',
37+
'src/platform/plugins/shared/discover/test/scout/ui/helpers/build_query.ts',
38+
])
39+
).toBe(true);
40+
});
41+
42+
it('returns true for custom Scout server directories (scout_*)', () => {
43+
expect(
44+
isScoutTestsOnlyDiff([
45+
'x-pack/solutions/security/plugins/cloud_security_posture/test/scout_with_setup/ui/tests/findings.spec.ts',
46+
])
47+
).toBe(true);
48+
});
49+
50+
it('returns true for generated manifests under .meta', () => {
51+
expect(
52+
isScoutTestsOnlyDiff([
53+
'src/platform/plugins/shared/discover/test/scout/.meta/ui/configs.json',
54+
])
55+
).toBe(true);
56+
});
57+
58+
it('treats README / *.md / CHANGELOG as noise (still true if every other file is Scout)', () => {
59+
expect(
60+
isScoutTestsOnlyDiff([
61+
'README.md',
62+
'src/platform/plugins/shared/discover/test/scout/ui/README',
63+
'CHANGELOG.asciidoc.md',
64+
'src/platform/plugins/shared/discover/test/scout/ui/tests/foo.spec.ts',
65+
])
66+
).toBe(true);
67+
});
68+
69+
it('returns false when the diff is noise-only (no Scout signal)', () => {
70+
expect(isScoutTestsOnlyDiff(['README.md', 'docs/extend/scout/best-practices.md'])).toBe(false);
71+
});
72+
73+
it('returns false when any non-Scout, non-noise file is present', () => {
74+
expect(
75+
isScoutTestsOnlyDiff([
76+
'src/platform/plugins/shared/discover/test/scout/ui/tests/foo.spec.ts',
77+
'src/platform/plugins/shared/discover/public/application/main.tsx',
78+
])
79+
).toBe(false);
80+
});
81+
82+
it('returns false for plugin source changes that are not under a Scout scope', () => {
83+
expect(
84+
isScoutTestsOnlyDiff(['src/platform/plugins/shared/discover/public/application/main.tsx'])
85+
).toBe(false);
86+
});
87+
88+
it('does not confuse `test/scout_<custom>/<not-api-or-ui>` with a Scout scope', () => {
89+
expect(
90+
isScoutTestsOnlyDiff([
91+
'src/platform/plugins/shared/discover/test/scout_setup/playwright.config.ts',
92+
])
93+
).toBe(false);
94+
});
95+
});

0 commit comments

Comments
 (0)