Skip to content

Commit 60e17ed

Browse files
Merge branch 'main' into feature/chrome-next
2 parents 249a8f4 + ae0d5ad commit 60e17ed

3,918 files changed

Lines changed: 138736 additions & 2174950 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.

.buildkite/ftr-manifests/ftr_oblt_stateful_configs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ enabled:
2929
- x-pack/solutions/observability/test/apm_api_integration/rules/config.ts
3030
- x-pack/solutions/observability/test/apm_api_integration/trial/config.ts
3131
- x-pack/solutions/observability/test/functional/apps/dataset_quality/config.ts
32-
- x-pack/solutions/observability/test/functional/apps/uptime/config.ts
3332
- x-pack/solutions/observability/test/observability_api_integration/basic/config.ts
3433
- x-pack/solutions/observability/test/observability_api_integration/trial/config.ts
3534
- x-pack/solutions/observability/test/observability_functional/with_rac_write.config.ts
@@ -38,7 +37,6 @@ enabled:
3837
- x-pack/solutions/observability/test/functional/apps/apm/config.ts
3938
- x-pack/solutions/observability/test/functional_with_es_ssl/config.ts
4039
- x-pack/solutions/observability/test/api_integration/apis/cases/config.ts
41-
- x-pack/solutions/observability/test/functional/apps/slo/embeddables/config.ts
4240
- x-pack/solutions/observability/test/api_integration/apis/security/config.ts
4341
- x-pack/solutions/observability/test/accessibility/config.ts
4442
- 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

.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+
});
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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 { allChangedFilesInScope } from '../../affected-packages';
11+
12+
/**
13+
* Scout-tests-only fast path for the Jest/FTR orchestrator.
14+
*
15+
* When a PR's diff contains only Scout test files (Playwright configs, specs,
16+
* page objects, fixtures, generated `.meta` manifests), no Jest unit/integration
17+
* or FTR config can be affected, so the orchestrator skips emitting them entirely.
18+
* The Scout pipeline still runs its own selective testing in parallel.
19+
*
20+
* The two arrays below duplicate constants in `@kbn/scout-info`'s `paths.ts`
21+
* (the source of truth) — `pipeline-utils/` may not import `@kbn/*`. A unit test
22+
* in `kbn-scout-info` fails CI if the two copies drift.
23+
*/
24+
25+
const SCOUT_TESTS_ONLY_IGNORE_PATTERNS: readonly string[] = [
26+
'**/README*',
27+
'**/*.md',
28+
'**/CHANGELOG*',
29+
];
30+
31+
const SCOUT_TESTS_ONLY_SCOPE_GLOBS: readonly string[] = [
32+
'**/test/scout{_*,}/{api,ui}/**',
33+
'**/test/scout{_*,}/.meta/{api,ui}/**',
34+
];
35+
36+
/**
37+
* Returns `true` only when every changed file is either documentation noise
38+
* (README, *.md, CHANGELOG*) or sits inside a Scout test scope. Falls back
39+
* to `false` on an empty diff or anything unrecognised, so unrelated changes
40+
* keep using the default test discovery.
41+
*/
42+
export function isScoutTestsOnlyDiff(changedFiles: readonly string[]): boolean {
43+
return allChangedFilesInScope(
44+
changedFiles,
45+
SCOUT_TESTS_ONLY_SCOPE_GLOBS,
46+
SCOUT_TESTS_ONLY_IGNORE_PATTERNS
47+
);
48+
}

.buildkite/scout_ci_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ plugins:
6262
- task_manager
6363
- transform
6464
- triggers_actions_ui
65+
- upgrade_assistant
6566
- uptime
6667
- ux
6768
- workflows_extensions

.buildkite/scripts/steps/checks/capture_oas_snapshot.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ cmd="node scripts/capture_oas_snapshot\
2121
--include-path /api/maintenance_window \
2222
--include-path /api/agent_builder \
2323
--include-path /api/workflows \
24+
--include-path /api/dashboards \
25+
--include-path /api/visualizations \
2426
--include-path /api/security/entity_store"
2527

2628
run_check() {

.buildkite/scripts/steps/checks/notify_saved_objects_changes.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ import parseArgs from 'minimist';
1212
import { upsertComment } from '#pipeline-utils';
1313

1414
/**
15-
* Mirrors the report types in `@kbn/check-saved-objects-cli/src/findings`.
16-
* Inlined here so this Buildkite script keeps the same dependency surface as the
17-
* other notifiers (only `#pipeline-utils`).
15+
* SOURCE OF TRUTH: packages/kbn-check-saved-objects-cli/src/findings/types.ts
16+
*
17+
* This interface is intentionally inlined rather than imported so that this
18+
* Buildkite script keeps the same minimal dependency surface as the other
19+
* notifiers (only `#pipeline-utils`, no Kibana package deps).
20+
*
21+
* When adding, removing, or changing fields in `SavedObjectsCheckFinding` or
22+
* `SavedObjectsCheckReport` in the canonical file above, mirror the change here.
1823
*/
1924
export interface SavedObjectsCheckFinding {
2025
ruleId: string;
@@ -28,6 +33,10 @@ export interface SavedObjectsCheckFinding {
2833
* A value without a leading `#` or `/` will produce a malformed URL.
2934
*/
3035
docsAnchor?: string;
36+
/** GCS URL of the regular (merge-base) baseline snapshot that triggered this finding. */
37+
baselineUrl?: string;
38+
/** GCS URL of the serverless baseline snapshot that triggered this finding. */
39+
serverlessBaselineUrl?: string;
3140
}
3241

3342
export interface SavedObjectsCheckReport {
@@ -100,7 +109,16 @@ See the [Saved Objects troubleshooting guide](${TROUBLESHOOTING_URL}) and the [m
100109
const bullets = findings
101110
.map((f) => {
102111
const fix = f.fixHint ? ` _Fix:_ ${f.fixHint}` : '';
103-
return `- **[${f.ruleId}]** ${f.message}${fix} ([docs](${findingDocsLink(f)}))`;
112+
const baselineLinks = [
113+
f.baselineUrl ? `[baseline](${f.baselineUrl})` : null,
114+
f.serverlessBaselineUrl ? `[serverless baseline](${f.serverlessBaselineUrl})` : null,
115+
]
116+
.filter(Boolean)
117+
.join(' ');
118+
const links = `([docs](${findingDocsLink(f)}))${
119+
baselineLinks ? ` (${baselineLinks})` : ''
120+
}`;
121+
return `- **[${f.ruleId}]** ${f.message}${fix} ${links}`;
104122
})
105123
.join('\n');
106124
sections.push(`${heading}\n${bullets}`);

0 commit comments

Comments
 (0)