Skip to content

Commit 5bdc1cb

Browse files
committed
Merge branch 'main' into bk-cost-opt-spot
2 parents 536ac62 + 1d0e3cf commit 5bdc1cb

File tree

2,431 files changed

+49660
-17671
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,431 files changed

+49660
-17671
lines changed

.buildkite/pipelines/intake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ steps:
4848
timeout_in_minutes: 300
4949
matrix:
5050
setup:
51-
BWC_VERSION: ["7.17.20", "8.13.1", "8.14.0"]
51+
BWC_VERSION: ["7.17.21", "8.13.3", "8.14.0"]
5252
agents:
5353
provider: gcp
5454
image: family/elasticsearch-ubuntu-2004

.buildkite/pipelines/periodic-packaging.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ steps:
305305
env:
306306
BWC_VERSION: 7.16.3
307307

308-
- label: "{{matrix.image}} / 7.17.20 / packaging-tests-upgrade"
309-
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v7.17.20
308+
- label: "{{matrix.image}} / 7.17.21 / packaging-tests-upgrade"
309+
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v7.17.21
310310
timeout_in_minutes: 300
311311
matrix:
312312
setup:
@@ -319,7 +319,7 @@ steps:
319319
machineType: custom-16-32768
320320
buildDirectory: /dev/shm/bk
321321
env:
322-
BWC_VERSION: 7.17.20
322+
BWC_VERSION: 7.17.21
323323

324324
- label: "{{matrix.image}} / 8.0.1 / packaging-tests-upgrade"
325325
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.0.1
@@ -529,8 +529,8 @@ steps:
529529
env:
530530
BWC_VERSION: 8.12.2
531531

532-
- label: "{{matrix.image}} / 8.13.1 / packaging-tests-upgrade"
533-
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.13.1
532+
- label: "{{matrix.image}} / 8.13.3 / packaging-tests-upgrade"
533+
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.13.3
534534
timeout_in_minutes: 300
535535
matrix:
536536
setup:
@@ -543,7 +543,7 @@ steps:
543543
machineType: custom-16-32768
544544
buildDirectory: /dev/shm/bk
545545
env:
546-
BWC_VERSION: 8.13.1
546+
BWC_VERSION: 8.13.3
547547

548548
- label: "{{matrix.image}} / 8.14.0 / packaging-tests-upgrade"
549549
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.14.0

.buildkite/pipelines/periodic.template.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ steps:
6666
- graalvm-ce17
6767
- openjdk17
6868
- openjdk21
69-
- openjdk22
7069
GRADLE_TASK:
7170
- checkPart1
7271
- checkPart2
@@ -97,7 +96,6 @@ steps:
9796
- graalvm-ce17
9897
- openjdk17
9998
- openjdk21
100-
- openjdk22
10199
BWC_VERSION: $BWC_LIST
102100
agents:
103101
provider: gcp

.buildkite/pipelines/periodic.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ steps:
325325
- signal_reason: agent_stop
326326
limit: 3
327327

328-
- label: 7.17.20 / bwc
329-
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v7.17.20#bwcTest
328+
- label: 7.17.21 / bwc
329+
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v7.17.21#bwcTest
330330
timeout_in_minutes: 300
331331
agents:
332332
provider: gcp
@@ -335,7 +335,7 @@ steps:
335335
preemptible: true
336336
buildDirectory: /dev/shm/bk
337337
env:
338-
BWC_VERSION: 7.17.20
338+
BWC_VERSION: 7.17.21
339339
retry:
340340
automatic:
341341
- exit_status: '-1'
@@ -591,8 +591,8 @@ steps:
591591
- signal_reason: agent_stop
592592
limit: 3
593593

594-
- label: 8.13.1 / bwc
595-
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.13.1#bwcTest
594+
- label: 8.13.3 / bwc
595+
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.13.3#bwcTest
596596
timeout_in_minutes: 300
597597
agents:
598598
provider: gcp
@@ -601,7 +601,7 @@ steps:
601601
preemptible: true
602602
buildDirectory: /dev/shm/bk
603603
env:
604-
BWC_VERSION: 8.13.1
604+
BWC_VERSION: 8.13.3
605605
retry:
606606
automatic:
607607
- exit_status: '-1'
@@ -666,7 +666,7 @@ steps:
666666
setup:
667667
ES_RUNTIME_JAVA:
668668
- openjdk17
669-
BWC_VERSION: ["7.17.20", "8.13.1", "8.14.0"]
669+
BWC_VERSION: ["7.17.21", "8.13.3", "8.14.0"]
670670
agents:
671671
provider: gcp
672672
image: family/elasticsearch-ubuntu-2004
@@ -694,7 +694,6 @@ steps:
694694
- graalvm-ce17
695695
- openjdk17
696696
- openjdk21
697-
- openjdk22
698697
GRADLE_TASK:
699698
- checkPart1
700699
- checkPart2
@@ -725,8 +724,7 @@ steps:
725724
- graalvm-ce17
726725
- openjdk17
727726
- openjdk21
728-
- openjdk22
729-
BWC_VERSION: ["7.17.20", "8.13.1", "8.14.0"]
727+
BWC_VERSION: ["7.17.21", "8.13.3", "8.14.0"]
730728
agents:
731729
provider: gcp
732730
image: family/elasticsearch-ubuntu-2004

.ci/bwcVersions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ BWC_VERSION:
1616
- "7.14.2"
1717
- "7.15.2"
1818
- "7.16.3"
19-
- "7.17.20"
19+
- "7.17.21"
2020
- "8.0.1"
2121
- "8.1.3"
2222
- "8.2.3"
@@ -30,5 +30,5 @@ BWC_VERSION:
3030
- "8.10.4"
3131
- "8.11.4"
3232
- "8.12.2"
33-
- "8.13.1"
33+
- "8.13.3"
3434
- "8.14.0"

.ci/snapshotBwcVersions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
BWC_VERSION:
2-
- "7.17.20"
3-
- "8.13.1"
2+
- "7.17.21"
3+
- "8.13.3"
44
- "8.14.0"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ testfixtures_shared/
6868

6969
# Generated
7070
checkstyle_ide.xml
71-
x-pack/plugin/esql/gen/
71+
x-pack/plugin/esql/src/main/generated-src/generated/

build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/precommit/LicenseHeadersTask.java

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.gradle.api.file.FileCollection;
2626
import org.gradle.api.file.ProjectLayout;
2727
import org.gradle.api.file.RegularFileProperty;
28+
import org.gradle.api.model.ObjectFactory;
2829
import org.gradle.api.provider.ListProperty;
2930
import org.gradle.api.tasks.CacheableTask;
3031
import org.gradle.api.tasks.IgnoreEmptyDirectories;
@@ -39,21 +40,22 @@
3940
import org.w3c.dom.Element;
4041
import org.w3c.dom.NodeList;
4142
import org.xml.sax.SAXException;
42-
import org.gradle.api.model.ObjectFactory;
43-
import javax.xml.parsers.DocumentBuilderFactory;
44-
import javax.xml.parsers.ParserConfigurationException;
43+
4544
import java.io.BufferedWriter;
4645
import java.io.File;
4746
import java.io.FileWriter;
4847
import java.io.IOException;
48+
import java.io.Serializable;
4949
import java.io.Writer;
5050
import java.nio.file.Files;
5151
import java.util.ArrayList;
5252
import java.util.Arrays;
5353
import java.util.List;
5454
import java.util.stream.Collectors;
5555
import javax.inject.Inject;
56-
import java.io.Serializable;
56+
import javax.xml.XMLConstants;
57+
import javax.xml.parsers.DocumentBuilderFactory;
58+
import javax.xml.parsers.ParserConfigurationException;
5759

5860
/**
5961
* Checks files for license headers..
@@ -232,7 +234,7 @@ private ClaimStatistic toXmlReportFile(ReportConfiguration config, Writer writer
232234

233235
private static List<String> unapprovedFiles(File xmlReportFile) {
234236
try {
235-
NodeList resourcesNodes = DocumentBuilderFactory.newInstance()
237+
NodeList resourcesNodes = createXmlDocumentBuilderFactory()
236238
.newDocumentBuilder()
237239
.parse(xmlReportFile)
238240
.getElementsByTagName("resource");
@@ -249,6 +251,21 @@ private static List<String> unapprovedFiles(File xmlReportFile) {
249251
}
250252
}
251253

254+
private static DocumentBuilderFactory createXmlDocumentBuilderFactory() throws ParserConfigurationException {
255+
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
256+
dbf.setXIncludeAware(false);
257+
dbf.setIgnoringComments(true);
258+
dbf.setExpandEntityReferences(false);
259+
dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
260+
dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
261+
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
262+
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
263+
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
264+
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
265+
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
266+
return dbf;
267+
}
268+
252269
private static List<Element> elementList(NodeList resourcesNodes) {
253270
List<Element> nodeList = new ArrayList<>(resourcesNodes.getLength());
254271
for (int idx = 0; idx < resourcesNodes.getLength(); idx++) {
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
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 and the Server Side Public License, v 1; you may not use this file except
5+
* in compliance with, at your election, the Elastic License 2.0 or the Server
6+
* Side Public License, v 1.
7+
*/
8+
9+
package org.elasticsearch.gradle.internal.doc
10+
11+
import org.elasticsearch.gradle.fixtures.AbstractGradleInternalPluginFuncTest
12+
import org.elasticsearch.gradle.internal.conventions.precommit.PrecommitPlugin
13+
import org.gradle.testkit.runner.TaskOutcome
14+
15+
class DocsTestPluginFuncTest extends AbstractGradleInternalPluginFuncTest {
16+
Class<? extends PrecommitPlugin> pluginClassUnderTest = DocsTestPlugin.class
17+
18+
def setup() {
19+
File docDir = new File(projectDir, 'doc');
20+
docDir.mkdirs()
21+
addSampleDoc(docDir)
22+
buildApiRestrictionsDisabled = true
23+
configurationCacheCompatible = false;
24+
buildFile << """
25+
tasks.named('listSnippets') {
26+
docs = fileTree('doc')
27+
}
28+
29+
tasks.named('listConsoleCandidates') {
30+
docs = fileTree('doc')
31+
}
32+
"""
33+
}
34+
35+
def "can list snippets"() {
36+
when:
37+
def result = gradleRunner("listSnippets").build()
38+
then:
39+
result.task(":listSnippets").outcome == TaskOutcome.SUCCESS
40+
assertOutputContains(result.output, """
41+
> Task :listSnippets
42+
mapper-annotated-text.asciidoc[37:39](Painless)
43+
mapper-annotated-text.asciidoc[42:44](js)
44+
mapper-annotated-text.asciidoc[51:69](console)// TEST[setup:seats]
45+
""")
46+
}
47+
48+
def "can console candidates"() {
49+
when:
50+
def result = gradleRunner("listConsoleCandidates").build()
51+
then:
52+
result.task(":listConsoleCandidates").outcome == TaskOutcome.SUCCESS
53+
assertOutputContains(result.output, """
54+
> Task :listConsoleCandidates
55+
mapper-annotated-text.asciidoc[42:44](js)
56+
""")
57+
}
58+
59+
void addSampleDoc(File docFolder) {
60+
new File(docFolder, "mapper-annotated-text.asciidoc").text = """
61+
[[painless-filter-context]]
62+
=== Filter context
63+
64+
Use a Painless script as a {ref}/query-dsl-script-query.html[filter] in a
65+
query to include and exclude documents.
66+
67+
68+
*Variables*
69+
70+
`params` (`Map`, read-only)::
71+
User-defined parameters passed in as part of the query.
72+
73+
`doc` (`Map`, read-only)::
74+
Contains the fields of the current document where each field is a
75+
`List` of values.
76+
77+
*Return*
78+
79+
`boolean`::
80+
Return `true` if the current document should be returned as a result of
81+
the query, and `false` otherwise.
82+
83+
84+
*API*
85+
86+
The standard <<painless-api-reference-shared, Painless API>> is available.
87+
88+
*Example*
89+
90+
To run this example, first follow the steps in
91+
<<painless-context-examples, context examples>>.
92+
93+
This script finds all unsold documents that cost less than \$25.
94+
95+
[source,Painless]
96+
----
97+
doc['sold'].value == false && doc['cost'].value < 25
98+
----
99+
100+
[source,js]
101+
----
102+
curl 'hello world'
103+
----
104+
105+
Defining `cost` as a script parameter enables the cost to be configured
106+
in the script query request. For example, the following request finds
107+
all available theatre seats for evening performances that are under \$25.
108+
109+
[source,console]
110+
----
111+
GET seats/_search
112+
{
113+
"query": {
114+
"bool": {
115+
"filter": {
116+
"script": {
117+
"script": {
118+
"source": "doc['sold'].value == false && doc['cost'].value < params.cost",
119+
"params": {
120+
"cost": 25
121+
}
122+
}
123+
}
124+
}
125+
}
126+
}
127+
}
128+
----
129+
// TEST[setup:seats]
130+
"""
131+
}
132+
}

0 commit comments

Comments
 (0)