Skip to content

Commit 49fa8d1

Browse files
authored
Merge branch 'main' into panel-references
2 parents 7f1766f + a00149d commit 49fa8d1

File tree

2,452 files changed

+73660
-10285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,452 files changed

+73660
-10285
lines changed

.buildkite/ftr_platform_stateful_configs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ enabled:
138138
- x-pack/platform/test/localization/config.ja_jp.ts
139139
- x-pack/platform/test/localization/config.fr_fr.ts
140140
- x-pack/platform/test/localization/config.zh_cn.ts
141+
- x-pack/platform/test/localization/config.de_de.ts
141142
- x-pack/platform/test/alerting_api_integration/basic/config.ts
142143
- x-pack/platform/test/alerting_api_integration/security_and_spaces/group1/config.ts
143144
- x-pack/platform/test/alerting_api_integration/security_and_spaces/group2/config.ts

.buildkite/ftr_security_serverless_configs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ disabled:
1919
# MKI only configs files
2020
- x-pack/test_serverless/functional/test_suites/security/config.mki_only.ts
2121

22+
# Detection Rules Management base configs
23+
- x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/configs/serverless/rules_management.essentials.config.ts
24+
- x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/configs/serverless/rules_management.complete.config.ts
25+
2226
defaultQueue: 'n2-4-spot'
2327
enabled:
2428
- x-pack/test_serverless/api_integration/test_suites/security/config.ts

.buildkite/ftr_security_stateful_configs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ disabled:
3333
# Gen AI Evals run weekly via their own pipeline
3434
- x-pack/test/security_solution_api_integration/test_suites/genai/evaluations/trial_license_complete_tier/configs/ess.config.ts
3535

36+
# Detection Rules Management base configs
37+
- x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/configs/ess/rules_management.basic.config.ts
38+
- x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/configs/ess/rules_management.trial.config.ts
39+
3640
defaultQueue: 'n2-4-spot'
3741
enabled:
3842
- x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/configs/ess.config.ts

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ export async function pickTestGroupRunOrder() {
463463
...expandAgentQueue('n2-4-spot'),
464464
diskSizeGb: 85,
465465
},
466+
env: {
467+
SCOUT_TARGET_TYPE: 'local',
468+
},
466469
retry: {
467470
automatic: [
468471
{ exit_status: '-1', limit: 3 },
@@ -481,6 +484,9 @@ export async function pickTestGroupRunOrder() {
481484
timeout_in_minutes: 120,
482485
key: 'jest-integration',
483486
agents: expandAgentQueue('n2-4-spot'),
487+
env: {
488+
SCOUT_TARGET_TYPE: 'local',
489+
},
484490
retry: {
485491
automatic: [
486492
{ exit_status: '-1', limit: 3 },
@@ -516,6 +522,7 @@ export async function pickTestGroupRunOrder() {
516522
timeout_in_minutes: 90,
517523
agents: expandAgentQueue(queue),
518524
env: {
525+
SCOUT_TARGET_TYPE: 'local',
519526
FTR_CONFIG_GROUP_KEY: key,
520527
...ftrExtraArgs,
521528
...envFromlabels,

.buildkite/scripts/lifecycle/post_command.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ if [[ "$IS_TEST_EXECUTION_STEP" == "true" ]]; then
2929
buildkite-agent artifact upload 'src/platform/test/**/screenshots/failure/*.png'
3030
buildkite-agent artifact upload 'src/platform/test/**/screenshots/session/*.png'
3131
buildkite-agent artifact upload 'src/platform/test/functional/failure_debug/html/*.html'
32+
buildkite-agent artifact upload 'x-pack/platform/test/**/screenshots/diff/*.png'
33+
buildkite-agent artifact upload 'x-pack/platform/test/**/screenshots/failure/*.png'
34+
buildkite-agent artifact upload 'x-pack/platform/test/**/screenshots/session/*.png'
35+
buildkite-agent artifact upload 'x-pack/platform/test_serverless/**/screenshots/diff/*.png'
36+
buildkite-agent artifact upload 'x-pack/platform/test_serverless/**/screenshots/failure/*.png'
37+
buildkite-agent artifact upload 'x-pack/platform/test_serverless/**/screenshots/session/*.png'
3238
buildkite-agent artifact upload 'x-pack/test/**/screenshots/diff/*.png'
3339
buildkite-agent artifact upload 'x-pack/test/**/screenshots/failure/*.png'
3440
buildkite-agent artifact upload 'x-pack/test/**/screenshots/session/*.png'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
source .buildkite/scripts/common/util.sh
5+
6+
echo '--- Security: check 3rd-party dependencies'
7+
8+
if is_pr && ! is_auto_commit_disabled; then
9+
ts-node .buildkite/scripts/steps/security/dependencies_diff.ts
10+
fi
11+
12+
check_for_changed_files "security: 3rd-party dependencies" true
13+
14+
echo "security: check 3rd-party dependencies ✅"

.buildkite/scripts/steps/checks/quick_checks.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222
.buildkite/scripts/steps/checks/dependencies_missing_owner.sh
2323
.buildkite/scripts/steps/checks/validate_pipelines.sh
2424
.buildkite/scripts/steps/checks/check_scout_config.sh
25+
.buildkite/scripts/steps/checks/dependencies_diff.sh
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
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 { execSync } from 'child_process';
11+
import { appendFile, readFile, writeFile } from 'fs/promises';
12+
import { join } from 'path';
13+
import { getGithubClient } from '#pipeline-utils';
14+
15+
const octokit = getGithubClient();
16+
17+
const INTERNAL_PACKAGE_PREFIX_REGEX = /^(@kbn|@elastic)\//;
18+
19+
async function getFileContent(path: string, ref: string) {
20+
console.info(`Fetching content for ${path} at ref ${ref}`);
21+
22+
const response = await octokit.repos.getContent({
23+
owner: process.env.GITHUB_PR_BASE_OWNER!,
24+
repo: process.env.GITHUB_PR_BASE_REPO!,
25+
path,
26+
ref,
27+
});
28+
29+
if (Array.isArray(response.data) || response.data.type !== 'file') {
30+
throw new Error(`Expected file at ${path}`);
31+
}
32+
33+
// @ts-ignore ts-node doesn't infer the type of response.data.content
34+
const content = Buffer.from(response.data.content, 'base64').toString('utf8');
35+
36+
return JSON.parse(content);
37+
}
38+
39+
async function getDependenciesDiff() {
40+
const oldPackageJson = await getFileContent('package.json', process.env.GITHUB_PR_MERGE_BASE!);
41+
const headSha = execSync('git rev-parse HEAD').toString().trim();
42+
const newPackageJson = await getFileContent('package.json', headSha);
43+
44+
const oldDeps = { ...oldPackageJson.dependencies, ...oldPackageJson.devDependencies };
45+
const newDeps = { ...newPackageJson.dependencies, ...newPackageJson.devDependencies };
46+
47+
const newPackages = [];
48+
const removedPackages = [];
49+
50+
console.info('Comparing dependencies...');
51+
52+
for (const name in newDeps) {
53+
if (!oldDeps[name] && !name.match(INTERNAL_PACKAGE_PREFIX_REGEX)) {
54+
newPackages.push(name);
55+
}
56+
}
57+
58+
for (const name in oldDeps) {
59+
if (!newDeps[name] && !name.match(INTERNAL_PACKAGE_PREFIX_REGEX)) {
60+
removedPackages.push(name);
61+
}
62+
}
63+
64+
return { added: newPackages, removed: removedPackages };
65+
}
66+
67+
async function main() {
68+
// Skipping PRs from Renovate
69+
if (process.env.GIT_BRANCH?.startsWith('renovate')) {
70+
return;
71+
}
72+
73+
const changedFiles = execSync(
74+
`git diff --name-only --diff-filter=M ${process.env.GITHUB_PR_MERGE_BASE} HEAD`
75+
)
76+
.toString()
77+
.trim()
78+
.split('\n');
79+
80+
const packageJsonChanged = changedFiles.some((file) => file === 'package.json');
81+
const dependenciesAdded = changedFiles.some((file) => file.match('third_party_packages.txt'));
82+
const filePath = join(__dirname, 'third_party_packages.txt');
83+
84+
// Reverting changes (if dependency was added, then removed in the same PR)
85+
if (!packageJsonChanged && dependenciesAdded) {
86+
console.info(`Reverting changes for ${filePath}`);
87+
88+
try {
89+
execSync(`git cat-file -e ${process.env.GITHUB_PR_MERGE_BASE}:${filePath}`, {
90+
stdio: 'ignore',
91+
});
92+
} catch (error) {
93+
console.info(`File does not exist in merge base, skipping revert`);
94+
return;
95+
}
96+
97+
execSync(`git checkout ${process.env.GITHUB_PR_MERGE_BASE} -- ${filePath}`);
98+
99+
return;
100+
}
101+
102+
const { added, removed } = await getDependenciesDiff();
103+
104+
if (!added.length && !removed.length) {
105+
console.info('No third party packages added or removed');
106+
return;
107+
}
108+
109+
const existingContent = await readFile(filePath, 'utf8');
110+
111+
const existingLines = new Set(existingContent.split('\n').filter(Boolean));
112+
113+
if (added.length && !removed.length) {
114+
const newEntries = added.filter((entry) => !existingLines.has(entry));
115+
116+
if (newEntries.length) {
117+
const data = newEntries.join('\n') + '\n';
118+
await appendFile(filePath, data);
119+
}
120+
121+
return;
122+
}
123+
124+
const updatedLines = [...new Set([...added, ...existingLines])].filter(
125+
(line) => !removed.includes(line)
126+
);
127+
128+
await writeFile(filePath, updatedLines.join('\n') + '\n');
129+
}
130+
131+
main();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@langchain/langgraph-checkpoint

0 commit comments

Comments
 (0)