Skip to content

Commit e470564

Browse files
authored
Merge branch 'main' into copilot/fix-tooltip-announcement
2 parents 0dbf718 + 960eee9 commit e470564

170 files changed

Lines changed: 6374 additions & 2357 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/package-lock.json

Lines changed: 277 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.buildkite/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
},
1010
"dependencies": {
1111
"@octokit/rest": "^22.0.1",
12+
"@slack/web-api": "^7.0.0",
1213
"adm-zip": "^0.5.16",
1314
"axios": "^1.13.4",
1415
"diff": "^8.0.4",
@@ -41,4 +42,4 @@
4142
"#pipeline-utils": "./pipeline-utils/index.ts",
4243
"#pipeline-utils/*": "./pipeline-utils/*"
4344
}
44-
}
45+
}

.buildkite/pipeline-resource-definitions/kibana-vm-build-orchestrator.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ spec:
2424
default_branch: main
2525
repository: elastic/kibana
2626
pipeline_file: .buildkite/pipelines/orchestrate_vm_builds.yml
27+
initial_step_plugins:
28+
- sparse-checkout#v1.6.0:
29+
paths:
30+
- .buildkite
31+
- .node-version
32+
- package.json
33+
- tsconfig.base.json
34+
- versions.json
35+
cleanup_sparse_state: true
2736
provider_settings:
2837
trigger_mode: none
2938
teams:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
* overridable via env vars. `TOO_LONG` triggers a warning annotation when exceeded.
4747
*/
4848
export const MAX_MINUTES = {
49-
JEST_UNIT_DEFAULT: 35, // env: JEST_UNIT_MAX_MINUTES
49+
JEST_UNIT_DEFAULT: 30, // env: JEST_UNIT_MAX_MINUTES
5050
JEST_INTEGRATION_DEFAULT: 30, // env: JEST_INTEGRATION_MAX_MINUTES
5151
FUNCTIONAL_DEFAULT: 30, // env: FUNCTIONAL_MAX_MINUTES
5252
TOO_LONG: 27,

.buildkite/pipeline-utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ export * as TestFailures from './test-failures';
1616
export * from './utils';
1717
export * from './pr_labels';
1818
export * from './scout';
19+
export * from './version-bump/utils';
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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 type { RestEndpointMethodTypes } from '@octokit/rest';
11+
import { getPrChangesCached } from '../github';
12+
13+
const VERSION_BUMP_BRANCH_RE = /^bump-versions(-json)?-\d{4}-\d{2}-\d{2}/;
14+
const KIBANAMACHINE_LOGIN = 'kibanamachine';
15+
const VERSION_BUMP_FILE_MATCHERS = [
16+
/^versions\.json$/,
17+
/^\.backportrc\.json$/,
18+
/^package\.json$/,
19+
/^x-pack\/package\.json$/,
20+
/^x-pack\/solutions\/search\/plugins\/enterprise_search\/common\/__mocks__\/initial_app_data\.ts$/,
21+
/^src\/core\/server\/integration_tests\/saved_objects\/migrations\/kibana_migrator_archive_utils\.ts$/,
22+
/^src\/core\/server\/integration_tests\/saved_objects\/migrations\/archives\//,
23+
/^src\/core\/server\/integration_tests\/saved_objects\/migrations\/group1\/__snapshots__\/v2_migration\.test\.ts\.snap$/,
24+
];
25+
26+
export const isAutomatedVersionBumpPR = async (
27+
changes: null | RestEndpointMethodTypes['pulls']['listFiles']['response']['data'] = null
28+
) => {
29+
const branch = process.env.BUILDKITE_BRANCH ?? '';
30+
const prHeadUser = process.env.GITHUB_PR_HEAD_USER ?? '';
31+
32+
if (!VERSION_BUMP_BRANCH_RE.test(branch) || prHeadUser !== KIBANAMACHINE_LOGIN) {
33+
return false;
34+
}
35+
36+
const prChanges = changes || (await getPrChangesCached());
37+
38+
return prChanges.every((change) =>
39+
VERSION_BUMP_FILE_MATCHERS.some(
40+
(pattern) =>
41+
change.filename.match(pattern) &&
42+
(!change.previous_filename || change.previous_filename.match(pattern))
43+
)
44+
);
45+
};

.buildkite/pipelines/orchestrate_vm_builds.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ steps:
1414
required: true
1515

1616
- name: 'Upload trigger steps'
17+
checkout: none
1718
command: |
1819
VM_IMAGES_BRANCH="$$(buildkite-agent meta-data get "VM_IMAGES_BRANCH")"
1920
KIBANA_BRANCH="$$(buildkite-agent meta-data get "KIBANA_BRANCH")"

.buildkite/pipelines/version_bump.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,23 @@ steps:
5555
field: '.version'
5656
expected_value: '${NEW_VERSION}-SNAPSHOT'
5757
polling_interval: '30'
58+
59+
- wait
60+
61+
- name: 'slack notification'
62+
command: .buildkite/scripts/steps/version_bump/slack_notify.sh
63+
soft_fail: true
64+
agents:
65+
image: family/kibana-ubuntu-2404
66+
imageProject: elastic-images-prod
67+
provider: gcp
68+
machineType: n2-standard-4
69+
70+
- key: verify-es-snapshot
71+
label: 'Verify ES Snapshot'
72+
trigger: kibana-elasticsearch-snapshot-verify
73+
async: true
74+
soft_fail: true
75+
if: build.env("DRY_RUN") != "true"
76+
build:
77+
branch: $BRANCH

.buildkite/pipelines/version_bump/notify_branch_created.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.buildkite/scripts/pipelines/pull_request/pipeline.test.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,24 @@ import { FIPS_GH_LABELS, FIPS_VERSION } from '#pipeline-utils/pr_labels';
1212

1313
const mockAreChangesSkippable = jest.fn();
1414
const mockDoAnyChangesMatch = jest.fn();
15+
const mockDoAllChangesMatch = jest.fn();
1516
const mockGetAgentImageConfig = jest.fn();
17+
const mockFlushCancelOnGateFailureMetadata = jest.fn();
1618
const mockRunPreBuild = jest.fn();
1719
const mockGetEvalPipeline = jest.fn();
20+
const mockIsAutomatedVersionBumpPR = jest.fn();
1821

1922
jest.mock('#pipeline-utils', () => {
2023
const actual = jest.requireActual('#pipeline-utils');
2124
return {
2225
...actual,
26+
getKibanaDir: jest.fn().mockReturnValue('/kibana'),
2327
areChangesSkippable: mockAreChangesSkippable,
2428
doAnyChangesMatch: mockDoAnyChangesMatch,
29+
doAllChangesMatch: mockDoAllChangesMatch,
2530
getAgentImageConfig: mockGetAgentImageConfig,
31+
flushCancelOnGateFailureMetadata: mockFlushCancelOnGateFailureMetadata,
32+
isAutomatedVersionBumpPR: mockIsAutomatedVersionBumpPR,
2633
};
2734
});
2835

@@ -60,7 +67,7 @@ const waitForExit = () => {
6067

6168
describe('pull_request pipeline generation', () => {
6269
beforeEach(() => {
63-
jest.clearAllMocks();
70+
jest.resetAllMocks();
6471
jest.resetModules();
6572
process.env = { ...ORIGINAL_ENV };
6673

@@ -69,9 +76,11 @@ describe('pull_request pipeline generation', () => {
6976

7077
mockAreChangesSkippable.mockResolvedValue(false);
7178
mockDoAnyChangesMatch.mockResolvedValue(false);
79+
mockDoAllChangesMatch.mockResolvedValue(false);
7280
mockGetAgentImageConfig.mockReturnValue('agents:\n provider: gcp\n');
7381
mockRunPreBuild.mockResolvedValue(undefined);
7482
mockGetEvalPipeline.mockReturnValue(null);
83+
mockIsAutomatedVersionBumpPR.mockResolvedValue(false);
7584
});
7685

7786
afterEach(() => {
@@ -95,7 +104,7 @@ describe('pull_request pipeline generation', () => {
95104
});
96105

97106
it('emits valid renovate-only pipeline and skips pre-build', async () => {
98-
mockAreChangesSkippable.mockResolvedValueOnce(false).mockResolvedValueOnce(true);
107+
mockDoAllChangesMatch.mockResolvedValueOnce(true);
99108
const warnSpy = jest.spyOn(console, 'warn').mockImplementation();
100109
const emitted = waitForEmission();
101110

@@ -164,4 +173,17 @@ describe('pull_request pipeline generation', () => {
164173
expect.any(Error)
165174
);
166175
});
176+
177+
it('emits empty pipeline for automated version bump PRs from kibanamachine', async () => {
178+
mockIsAutomatedVersionBumpPR.mockResolvedValueOnce(true);
179+
const emitted = waitForEmission();
180+
181+
await importPipelineModule();
182+
const output = await emitted;
183+
184+
const parsed = yamlLoad(output) as Record<string, unknown>;
185+
expect(parsed).toEqual({ steps: [] });
186+
expect(mockRunPreBuild).not.toHaveBeenCalled();
187+
expect(mockAreChangesSkippable).not.toHaveBeenCalled();
188+
});
167189
});

0 commit comments

Comments
 (0)