Skip to content

Commit 20727d1

Browse files
Merge branch 'main' into query-api-key-type-runtime-field
2 parents 3dfe94a + 9ca3be0 commit 20727d1

File tree

1,705 files changed

+29299
-15221
lines changed

Some content is hidden

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

1,705 files changed

+29299
-15221
lines changed

.buildkite/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Elasticsearch CI Pipelines
2+
3+
This directory contains pipeline definitions and scripts for running Elasticsearch CI on Buildkite.
4+
5+
## Directory Structure
6+
7+
- [pipelines](pipelines/) - pipeline definitions/yml
8+
- [scripts](scripts/) - scripts used by pipelines, inside steps
9+
- [hooks](hooks/) - [Buildkite hooks](https://buildkite.com/docs/agent/v3/hooks), where global env vars and secrets are set
10+
11+
## Pipeline Definitions
12+
13+
Pipelines are defined using YAML files residing in [pipelines](pipelines/). These are mostly static definitions that are used as-is, but there are a few dynamically-generated exceptions (see below).
14+
15+
### Dynamically Generated Pipelines
16+
17+
Pull request pipelines are generated dynamically based on labels, files changed, and other properties of pull requests.
18+
19+
Non-pull request pipelines that include BWC version matrices must also be generated whenever the [list of BWC versions](../.ci/bwcVersions) is updated.
20+
21+
#### Pull Request Pipelines
22+
23+
Pull request pipelines are generated dynamically at CI time based on numerous properties of the pull request. See [scripts/pull-request](scripts/pull-request) for details.
24+
25+
#### BWC Version Matrices
26+
27+
For pipelines that include BWC version matrices, you will see one or more template files (e.g. [periodic.template.yml](pipelines/periodic.template.yml)) and a corresponding generated file (e.g. [periodic.yml](pipelines/periodic.yml)). The generated file is the one that is actually used by Buildkite.
28+
29+
These files are updated by running:
30+
31+
```bash
32+
./gradlew updateCIBwcVersions
33+
```
34+
35+
This also runs automatically during release procedures.
36+
37+
You should always make changes to the template files, and run the above command to update the generated files.
38+
39+
## Node / TypeScript
40+
41+
Node (technically `bun`), TypeScript, and related files are currently used to generate pipelines for pull request CI. See [scripts/pull-request](scripts/pull-request) for details.

.buildkite/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "buildkite-pipelines",
3-
"module": "index.ts",
43
"type": "module",
54
"devDependencies": {
65
"@types/node": "^20.6.0",

.buildkite/pipelines/dra-workflow.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@ steps:
77
image: family/elasticsearch-ubuntu-2204
88
machineType: custom-32-98304
99
buildDirectory: /dev/shm/bk
10+
- wait
11+
# The hadoop build depends on the ES artifact
12+
# So let's trigger the hadoop build any time we build a new staging artifact
13+
- trigger: elasticsearch-hadoop-dra-workflow
14+
async: true
15+
build:
16+
branch: "${BUILDKITE_BRANCH}"
17+
env:
18+
DRA_WORKFLOW: staging
19+
if: build.env('DRA_WORKFLOW') == 'staging'

.buildkite/pipelines/periodic.template.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ steps:
7373
- openjdk19
7474
- openjdk20
7575
- openjdk21
76+
- openjdk22
7677
GRADLE_TASK:
7778
- checkPart1
7879
- checkPart2
@@ -180,14 +181,14 @@ steps:
180181
image: family/elasticsearch-ubuntu-2004
181182
machineType: n2-standard-8
182183
buildDirectory: /dev/shm/bk
183-
if: build.branch == "main" || build.branch =~ /^[0-9]+\.[0-9]+\$/
184-
- label: Check branch consistency
184+
if: build.branch == "main" || build.branch == "7.17"
185+
- label: check-branch-consistency
185186
command: .ci/scripts/run-gradle.sh branchConsistency
186187
timeout_in_minutes: 15
187188
agents:
188189
provider: gcp
189190
image: family/elasticsearch-ubuntu-2004
190191
machineType: n2-standard-2
191-
- label: Check branch protection rules
192+
- label: check-branch-protection-rules
192193
command: .buildkite/scripts/branch-protection.sh
193194
timeout_in_minutes: 5

.buildkite/pipelines/periodic.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,7 @@ steps:
11941194
- openjdk19
11951195
- openjdk20
11961196
- openjdk21
1197+
- openjdk22
11971198
GRADLE_TASK:
11981199
- checkPart1
11991200
- checkPart2
@@ -1301,14 +1302,14 @@ steps:
13011302
image: family/elasticsearch-ubuntu-2004
13021303
machineType: n2-standard-8
13031304
buildDirectory: /dev/shm/bk
1304-
if: build.branch == "main" || build.branch =~ /^[0-9]+\.[0-9]+\$/
1305-
- label: Check branch consistency
1305+
if: build.branch == "main" || build.branch == "7.17"
1306+
- label: check-branch-consistency
13061307
command: .ci/scripts/run-gradle.sh branchConsistency
13071308
timeout_in_minutes: 15
13081309
agents:
13091310
provider: gcp
13101311
image: family/elasticsearch-ubuntu-2004
13111312
machineType: n2-standard-2
1312-
- label: Check branch protection rules
1313+
- label: check-branch-protection-rules
13131314
command: .buildkite/scripts/branch-protection.sh
13141315
timeout_in_minutes: 5

.buildkite/scripts/pull-request/README.md

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ Each time a pull request build is triggered, such as via commit or comment, we u
66

77
The generator handles the following:
88

9-
- `allow-labels` - only trigger a step if the PR has one of these labels
10-
- `skip-labels` - don't trigger the step if the PR has one of these labels
11-
- `excluded-regions` - don't trigger the step if **all** of the changes in the PR match these paths/regexes
12-
- `included-regions` - trigger the step if **all** of the changes in the PR match these paths/regexes
13-
- `trigger-phrase` - trigger this step, and ignore all other steps, if the build was triggered by a comment and that comment matches this regex
14-
- Note that each step has an automatic phrase of `.*run\\W+elasticsearch-ci/<step-name>.*`
9+
- Various configurations for filtering/activating steps based on labels, changed files, etc. See below.
1510
- Replacing `$SNAPSHOT_BWC_VERSIONS` in pipelines with an array of versions from `.ci/snapshotBwcVersions`
1611
- Duplicating any step with `bwc_template: true` for each BWC version in `.ci/bwcVersions`
1712

@@ -21,18 +16,75 @@ The generator handles the following:
2116

2217
Pipelines are in [`.buildkite/pipelines`](../../pipelines/pull-request). They are automatically picked up and given a name based on their filename.
2318

24-
2519
## Setup
2620

2721
- [Install bun](https://bun.sh/)
2822
- `npm install -g bun` will work if you already have `npm`
2923
- `cd .buildkite; bun install` to install dependencies
3024

31-
## Run tests
25+
## Testing
26+
27+
Testing the pipeline generator is done mostly using snapshot tests, which generate pipeline objects using the pipeline configurations in `mocks/pipelines` and then compare them to previously-generated snapshots in `__snapshots__` to confirm that they are correct.
28+
29+
The mock pipeline configurations should, therefore, try to cover all of the various features of the generator (allow-labels, skip-labels, etc).
30+
31+
Snapshots are generated/managed automatically whenever you create a new test that has a snapshot test condition. These are very similar to Jest snapshots.
32+
33+
### Run tests
3234

3335
```bash
3436
cd .buildkite
3537
bun test
3638
```
3739

3840
If you need to regenerate the snapshots, run `bun test --update-snapshots`.
41+
42+
## Pipeline Configuration
43+
44+
The `config:` property at the top of pipelines inside `.buildkite/pipelines/pull-request` is a custom property used by our pipeline generator. It is not used by Buildkite.
45+
46+
All of the pipelines in this directory are evaluated whenever CI for a pull request is started, and the steps are filtered and combined into one pipeline based on the properties in `config:` and the state of the pull request.
47+
48+
The various configurations available mirror what we were using in our Jenkins pipelines.
49+
50+
### Config Properties
51+
52+
#### `allow-labels`
53+
54+
- Type: `string|string[]`
55+
- Example: `["test-full-bwc"]`
56+
57+
Only trigger a step if the PR has one of these labels.
58+
59+
#### `skip-labels`
60+
61+
- Type: `string|string[]`
62+
- Example: `>test-mute`
63+
64+
Don't trigger the step if the PR has one of these labels.
65+
66+
#### `excluded-regions`
67+
68+
- Type: `string|string[]` - must be JavaScript regexes
69+
- Example: `["^docs/.*", "^x-pack/docs/.*"]`
70+
71+
Exclude the pipeline if all of the changed files in the PR match at least one regex. E.g. for the example above, don't run the step if all of the changed files are docs changes.
72+
73+
#### `included-regions`
74+
75+
- Type: `string|string[]` - must be JavaScript regexes
76+
- Example: `["^docs/.*", "^x-pack/docs/.*"]`
77+
78+
Only include the pipeline if all of the changed files in the PR match at least one regex. E.g. for the example above, only run the step if all of the changed files are docs changes.
79+
80+
This is particularly useful for having a step that only runs, for example, when all of the other steps get filtered out because of the `excluded-regions` property.
81+
82+
#### `trigger-phrase`
83+
84+
- Type: `string` - must be a JavaScript regex
85+
- Example: `"^run\\W+elasticsearch-ci/test-full-bwc.*"`
86+
- Default: `.*run\\W+elasticsearch-ci/<step-name>.*` (`<step-name>` is generated from the filename of the yml file).
87+
88+
Trigger this step, and ignore all other steps, if the build was triggered by a comment and that comment matches this regex.
89+
90+
Note that the entire build itself is triggered via [`.buildkite/pull-requests.json`](../pull-requests.json). So, a comment has to first match the trigger configured there.

benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/AggregatorBenchmark.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ public class AggregatorBenchmark {
6464
private static final int OP_COUNT = 1024;
6565
private static final int GROUPS = 5;
6666

67-
private static final BigArrays BIG_ARRAYS = BigArrays.NON_RECYCLING_INSTANCE; // TODO real big arrays?
6867
private static final BlockFactory blockFactory = BlockFactory.getInstance(
6968
new NoopCircuitBreaker("noop"),
70-
BigArrays.NON_RECYCLING_INSTANCE
69+
BigArrays.NON_RECYCLING_INSTANCE // TODO real big arrays?
7170
);
7271

7372
private static final String LONGS = "longs";
@@ -155,25 +154,25 @@ private static Operator operator(DriverContext driverContext, String grouping, S
155154

156155
private static AggregatorFunctionSupplier supplier(String op, String dataType, int dataChannel) {
157156
return switch (op) {
158-
case COUNT -> CountAggregatorFunction.supplier(BIG_ARRAYS, List.of(dataChannel));
157+
case COUNT -> CountAggregatorFunction.supplier(List.of(dataChannel));
159158
case COUNT_DISTINCT -> switch (dataType) {
160-
case LONGS -> new CountDistinctLongAggregatorFunctionSupplier(BIG_ARRAYS, List.of(dataChannel), 3000);
161-
case DOUBLES -> new CountDistinctDoubleAggregatorFunctionSupplier(BIG_ARRAYS, List.of(dataChannel), 3000);
159+
case LONGS -> new CountDistinctLongAggregatorFunctionSupplier(List.of(dataChannel), 3000);
160+
case DOUBLES -> new CountDistinctDoubleAggregatorFunctionSupplier(List.of(dataChannel), 3000);
162161
default -> throw new IllegalArgumentException("unsupported data type [" + dataType + "]");
163162
};
164163
case MAX -> switch (dataType) {
165-
case LONGS -> new MaxLongAggregatorFunctionSupplier(BIG_ARRAYS, List.of(dataChannel));
166-
case DOUBLES -> new MaxDoubleAggregatorFunctionSupplier(BIG_ARRAYS, List.of(dataChannel));
164+
case LONGS -> new MaxLongAggregatorFunctionSupplier(List.of(dataChannel));
165+
case DOUBLES -> new MaxDoubleAggregatorFunctionSupplier(List.of(dataChannel));
167166
default -> throw new IllegalArgumentException("unsupported data type [" + dataType + "]");
168167
};
169168
case MIN -> switch (dataType) {
170-
case LONGS -> new MinLongAggregatorFunctionSupplier(BIG_ARRAYS, List.of(dataChannel));
171-
case DOUBLES -> new MinDoubleAggregatorFunctionSupplier(BIG_ARRAYS, List.of(dataChannel));
169+
case LONGS -> new MinLongAggregatorFunctionSupplier(List.of(dataChannel));
170+
case DOUBLES -> new MinDoubleAggregatorFunctionSupplier(List.of(dataChannel));
172171
default -> throw new IllegalArgumentException("unsupported data type [" + dataType + "]");
173172
};
174173
case SUM -> switch (dataType) {
175-
case LONGS -> new SumLongAggregatorFunctionSupplier(BIG_ARRAYS, List.of(dataChannel));
176-
case DOUBLES -> new SumDoubleAggregatorFunctionSupplier(BIG_ARRAYS, List.of(dataChannel));
174+
case LONGS -> new SumLongAggregatorFunctionSupplier(List.of(dataChannel));
175+
case DOUBLES -> new SumDoubleAggregatorFunctionSupplier(List.of(dataChannel));
177176
default -> throw new IllegalArgumentException("unsupported data type [" + dataType + "]");
178177
};
179178
default -> throw new IllegalArgumentException("unsupported op [" + op + "]");

benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/MultivalueDedupeBenchmark.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
@State(Scope.Thread)
4646
@Fork(1)
4747
public class MultivalueDedupeBenchmark {
48-
private static final BigArrays BIG_ARRAYS = BigArrays.NON_RECYCLING_INSTANCE; // TODO real big arrays?
4948
private static final BlockFactory blockFactory = BlockFactory.getInstance(
5049
new NoopCircuitBreaker("noop"),
5150
BigArrays.NON_RECYCLING_INSTANCE

0 commit comments

Comments
 (0)