Skip to content

Commit

Permalink
Merge branch 'main' into esql-div-mod-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
not-napoleon committed Apr 11, 2024
2 parents cf4b35b + 648c9cb commit fa8f5d6
Show file tree
Hide file tree
Showing 1,616 changed files with 37,754 additions and 11,685 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipelines/intake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ steps:
timeout_in_minutes: 300
matrix:
setup:
BWC_VERSION: ["7.17.20", "8.13.2", "8.14.0"]
BWC_VERSION: ["7.17.21", "8.13.3", "8.14.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
Expand Down
12 changes: 6 additions & 6 deletions .buildkite/pipelines/periodic-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ steps:
env:
BWC_VERSION: 7.16.3

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

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

- label: "{{matrix.image}} / 8.13.2 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.13.2
- label: "{{matrix.image}} / 8.13.3 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.13.3
timeout_in_minutes: 300
matrix:
setup:
Expand All @@ -543,7 +543,7 @@ steps:
machineType: custom-16-32768
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 8.13.2
BWC_VERSION: 8.13.3

- label: "{{matrix.image}} / 8.14.0 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.14.0
Expand Down
16 changes: 8 additions & 8 deletions .buildkite/pipelines/periodic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,16 @@ steps:
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 7.16.3
- label: 7.17.20 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v7.17.20#bwcTest
- label: 7.17.21 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v7.17.21#bwcTest
timeout_in_minutes: 300
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 7.17.20
BWC_VERSION: 7.17.21
- label: 8.0.1 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.0.1#bwcTest
timeout_in_minutes: 300
Expand Down Expand Up @@ -312,16 +312,16 @@ steps:
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 8.12.2
- label: 8.13.2 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.13.2#bwcTest
- label: 8.13.3 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.13.3#bwcTest
timeout_in_minutes: 300
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 8.13.2
BWC_VERSION: 8.13.3
- label: 8.14.0 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.14.0#bwcTest
timeout_in_minutes: 300
Expand Down Expand Up @@ -396,7 +396,7 @@ steps:
setup:
ES_RUNTIME_JAVA:
- openjdk17
BWC_VERSION: ["7.17.20", "8.13.2", "8.14.0"]
BWC_VERSION: ["7.17.21", "8.13.3", "8.14.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
Expand Down Expand Up @@ -438,7 +438,7 @@ steps:
- graalvm-ce17
- openjdk17
- openjdk21
BWC_VERSION: ["7.17.20", "8.13.2", "8.14.0"]
BWC_VERSION: ["7.17.21", "8.13.3", "8.14.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
Expand Down
4 changes: 2 additions & 2 deletions .ci/bwcVersions
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BWC_VERSION:
- "7.14.2"
- "7.15.2"
- "7.16.3"
- "7.17.20"
- "7.17.21"
- "8.0.1"
- "8.1.3"
- "8.2.3"
Expand All @@ -30,5 +30,5 @@ BWC_VERSION:
- "8.10.4"
- "8.11.4"
- "8.12.2"
- "8.13.2"
- "8.13.3"
- "8.14.0"
4 changes: 2 additions & 2 deletions .ci/snapshotBwcVersions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BWC_VERSION:
- "7.17.20"
- "8.13.2"
- "7.17.21"
- "8.13.3"
- "8.14.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

package org.elasticsearch.gradle.internal.doc

import org.elasticsearch.gradle.fixtures.AbstractGradleInternalPluginFuncTest
import org.elasticsearch.gradle.internal.conventions.precommit.PrecommitPlugin
import org.gradle.testkit.runner.TaskOutcome

class DocsTestPluginFuncTest extends AbstractGradleInternalPluginFuncTest {
Class<? extends PrecommitPlugin> pluginClassUnderTest = DocsTestPlugin.class

def setup() {
File docDir = new File(projectDir, 'doc');
docDir.mkdirs()
addSampleDoc(docDir)
buildApiRestrictionsDisabled = true
configurationCacheCompatible = false;
buildFile << """
tasks.named('listSnippets') {
docs = fileTree('doc')
}
tasks.named('listConsoleCandidates') {
docs = fileTree('doc')
}
"""
}

def "can list snippets"() {
when:
def result = gradleRunner("listSnippets").build()
then:
result.task(":listSnippets").outcome == TaskOutcome.SUCCESS
assertOutputContains(result.output, """
> Task :listSnippets
mapper-annotated-text.asciidoc[37:39](Painless)
mapper-annotated-text.asciidoc[42:44](js)
mapper-annotated-text.asciidoc[51:69](console)// TEST[setup:seats]
""")
}

def "can console candidates"() {
when:
def result = gradleRunner("listConsoleCandidates").build()
then:
result.task(":listConsoleCandidates").outcome == TaskOutcome.SUCCESS
assertOutputContains(result.output, """
> Task :listConsoleCandidates
mapper-annotated-text.asciidoc[42:44](js)
""")
}

void addSampleDoc(File docFolder) {
new File(docFolder, "mapper-annotated-text.asciidoc").text = """
[[painless-filter-context]]
=== Filter context
Use a Painless script as a {ref}/query-dsl-script-query.html[filter] in a
query to include and exclude documents.
*Variables*
`params` (`Map`, read-only)::
User-defined parameters passed in as part of the query.
`doc` (`Map`, read-only)::
Contains the fields of the current document where each field is a
`List` of values.
*Return*
`boolean`::
Return `true` if the current document should be returned as a result of
the query, and `false` otherwise.
*API*
The standard <<painless-api-reference-shared, Painless API>> is available.
*Example*
To run this example, first follow the steps in
<<painless-context-examples, context examples>>.
This script finds all unsold documents that cost less than \$25.
[source,Painless]
----
doc['sold'].value == false && doc['cost'].value < 25
----
[source,js]
----
curl 'hello world'
----
Defining `cost` as a script parameter enables the cost to be configured
in the script query request. For example, the following request finds
all available theatre seats for evening performances that are under \$25.
[source,console]
----
GET seats/_search
{
"query": {
"bool": {
"filter": {
"script": {
"script": {
"source": "doc['sold'].value == false && doc['cost'].value < params.cost",
"params": {
"cost": 25
}
}
}
}
}
}
}
----
// TEST[setup:seats]
"""
}
}
27 changes: 15 additions & 12 deletions build-tools-internal/src/main/groovy/elasticsearch.ide.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
':server:generateModulesList',
':server:generatePluginsList',
':generateProviderImpls',
':libs:elasticsearch-native:elasticsearch-native-libraries:extractLibs'].collect { elasticsearchProject.right()?.task(it) ?: it })
':libs:elasticsearch-native:elasticsearch-native-libraries:extractLibs',
':x-pack:libs:es-opensaml-security-api:shadowJar'].collect { elasticsearchProject.right()?.task(it) ?: it })
}

// this path is produced by the extractLibs task above
Expand Down Expand Up @@ -239,20 +240,22 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
* but before the XML document, e.g. a doctype or comment
*/
void modifyXml(Object path, Action<? super Node> action, String preface = null) {
Node xml = parseXml(path)
action.execute(xml)
if (project.file(path).exists()) {
Node xml = parseXml(path)
action.execute(xml)

File xmlFile = project.file(path)
xmlFile.withPrintWriter { writer ->
def printer = new XmlNodePrinter(writer)
printer.namespaceAware = true
printer.preserveWhitespace = true
writer.write("<?xml version=\"1.0\"?>\n")
File xmlFile = project.file(path)
xmlFile.withPrintWriter { writer ->
def printer = new XmlNodePrinter(writer)
printer.namespaceAware = true
printer.preserveWhitespace = true
writer.write("<?xml version=\"1.0\"?>\n")

if (preface != null) {
writer.write(preface)
if (preface != null) {
writer.write(preface)
}
printer.print(xml)
}
printer.print(xml)
}
}

Expand Down
Loading

0 comments on commit fa8f5d6

Please sign in to comment.