Skip to content

Commit 9836cc9

Browse files
authored
Merge branch 'main' into inlinestats-test-check
2 parents 39e542f + 1aed2bc commit 9836cc9

File tree

377 files changed

+9918
-4765
lines changed

Some content is hidden

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

377 files changed

+9918
-4765
lines changed

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,23 @@ public void apply(Project project) {
5252
// Spotless resolves required dependencies from project repositories, so we need maven central
5353
project.getRepositories().mavenCentral();
5454

55+
// we cannot update to a newer spotless plugin version yet but we want to use the latest eclipse formatter to be compatible
56+
// with latest java versions
57+
project.getConfigurations().matching(it -> it.getName().startsWith("spotless")).configureEach(conf -> {
58+
project.getDependencies().constraints(constraints -> {
59+
constraints.add(conf.getName(), "org.eclipse.jdt:org.eclipse.jdt.core:3.42.0", dependencyConstraint -> {
60+
dependencyConstraint.because(
61+
"We want to use a recent version of the Eclipse formatter libraries to support latest Java"
62+
);
63+
});
64+
constraints.add(conf.getName(), "org.eclipse.jdt:ecj:3.42.0", dependencyConstraint -> {
65+
dependencyConstraint.because(
66+
"We want to use a recent version of the Eclipse formatter libraries to support latest Java"
67+
);
68+
});
69+
});
70+
});
71+
5572
project.getExtensions().getByType(SpotlessExtension.class).java(java -> {
5673
File elasticsearchWorkspace = Util.locateElasticsearchWorkspace(project.getGradle());
5774
String importOrderPath = "build-conventions/elastic.importorder";
@@ -74,7 +91,7 @@ public void apply(Project project) {
7491
// When running build benchmarks we alter the source in some scenarios.
7592
// The gradle-profiler unfortunately does not generate compliant formatted
7693
// sources so we ignore that altered file when running build benchmarks
77-
if(Boolean.getBoolean("BUILD_PERFORMANCE_TEST") && project.getPath().equals(":server")) {
94+
if (Boolean.getBoolean("BUILD_PERFORMANCE_TEST") && project.getPath().equals(":server")) {
7895
java.targetExclude("src/main/java/org/elasticsearch/bootstrap/BootstrapInfo.java");
7996
}
8097
});

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/transport/ResolveTransportVersionConflictFuncTest.groovy

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,13 @@ class ResolveTransportVersionConflictFuncTest extends AbstractTransportVersionFu
8787
assertUpperBound("9.1", "new_tv,8012002")
8888
assertUpperBound("8.19", "new_tv,7123002")
8989
}
90+
91+
def "no new transport version is idempotent"() {
92+
when:
93+
def result = runResolveAndValidateTask().build()
94+
95+
then:
96+
assertResolveAndValidateSuccess(result)
97+
assertUpperBound("9.2", "existing_92,8123000")
98+
}
9099
}

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/transport/TransportVersionGenerationFuncTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ class TransportVersionGenerationFuncTest extends AbstractTransportVersionFuncTes
428428

429429
def "upper bounds files must exist for backport branches"() {
430430
when:
431-
def result = runGenerateTask("--backport-branches=9.1,8.13,7.17,6.0").buildAndFail()
431+
def result = runGenerateTask("--name", "new_tv", "--backport-branches=9.1,8.13,7.17,6.0").buildAndFail()
432432

433433
then:
434434
assertGenerateFailure(result, "Missing upper bounds files for branches [6.0, 7.17, 8.13], known branches are [8.19, 9.0, 9.1, 9.2]")

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/transport/TransportVersionValidationFuncTest.groovy

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,21 @@ class TransportVersionValidationFuncTest extends AbstractTransportVersionFuncTes
294294
then:
295295
result.task(":myserver:validateTransportVersionResources").outcome == TaskOutcome.SUCCESS
296296
}
297+
298+
def "only current upper bound validated on release branch"() {
299+
given:
300+
file("myserver/build.gradle") << """
301+
tasks.named('validateTransportVersionResources') {
302+
currentUpperBoundName = '9.0'
303+
}
304+
"""
305+
referableAndReferencedTransportVersion("some_tv", "8124000,8012004")
306+
transportVersionUpperBound("9.1", "some_tv", "8012004")
307+
308+
when:
309+
def result = gradleRunner("validateTransportVersionResources").build()
310+
311+
then:
312+
result.task(":myserver:validateTransportVersionResources").outcome == TaskOutcome.SUCCESS
313+
}
297314
}

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/GenerateTransportVersionDefinitionTask.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ public void run() throws IOException {
9898
List<String> changedDefinitionNames = resources.getChangedReferableDefinitionNames();
9999
String targetDefinitionName = getTargetDefinitionName(resources, referencedNames, changedDefinitionNames);
100100

101-
List<TransportVersionUpperBound> upstreamUpperBounds = resources.getUpperBoundsFromUpstream();
102-
Set<String> targetUpperBoundNames = getTargetUpperBoundNames(resources, upstreamUpperBounds, targetDefinitionName);
103-
104101
getLogger().lifecycle("Generating transport version name: " + targetDefinitionName);
105102
if (targetDefinitionName.isEmpty()) {
106103
// TODO: resetting upper bounds needs to be done locally, otherwise it pulls in some (incomplete) changes from upstream main
107104
// resetAllUpperBounds(resources);
108105
} else {
106+
List<TransportVersionUpperBound> upstreamUpperBounds = resources.getUpperBoundsFromUpstream();
107+
Set<String> targetUpperBoundNames = getTargetUpperBoundNames(resources, upstreamUpperBounds, targetDefinitionName);
108+
109109
List<TransportVersionId> ids = updateUpperBounds(resources, upstreamUpperBounds, targetUpperBoundNames, targetDefinitionName);
110110
// (Re)write the definition file.
111111
resources.writeDefinition(new TransportVersionDefinition(targetDefinitionName, ids, true));

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/transport/ValidateTransportVersionResourcesTask.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public void validateTransportVersions() throws IOException {
8383
Map<String, TransportVersionDefinition> allDefinitions = collectAllDefinitions(referableDefinitions, unreferableDefinitions);
8484
Map<Integer, List<IdAndDefinition>> idsByBase = collectIdsByBase(allDefinitions.values());
8585
Map<String, TransportVersionUpperBound> upperBounds = resources.getUpperBounds();
86+
TransportVersionUpperBound currentUpperBound = upperBounds.get(getCurrentUpperBoundName().get());
8687
boolean onReleaseBranch = checkIfDefinitelyOnReleaseBranch(upperBounds);
8788

8889
for (var definition : referableDefinitions.values()) {
@@ -94,14 +95,21 @@ public void validateTransportVersions() throws IOException {
9495
}
9596

9697
for (var entry : idsByBase.entrySet()) {
97-
validateBase(entry.getKey(), entry.getValue());
98+
int baseId = entry.getKey();
99+
// on main we validate all bases, but on release branches we only validate up to the current upper bound
100+
if (onReleaseBranch == false || baseId <= currentUpperBound.definitionId().base()) {
101+
validateBase(baseId, entry.getValue());
102+
}
98103
}
99104

100-
for (var upperBound : upperBounds.values()) {
101-
validateUpperBound(upperBound, allDefinitions, idsByBase);
102-
}
105+
if (onReleaseBranch) {
106+
// on release branches we only check the current upper bound, others may be inaccurate
107+
validateUpperBound(currentUpperBound, allDefinitions, idsByBase);
108+
} else {
109+
for (var upperBound : upperBounds.values()) {
110+
validateUpperBound(upperBound, allDefinitions, idsByBase);
111+
}
103112

104-
if (onReleaseBranch == false) {
105113
validatePrimaryIds(resources, upperBounds, allDefinitions);
106114
}
107115
}

build-tools/src/integTest/groovy/org/elasticsearch/gradle/TestClustersPluginFuncTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class TestClustersPluginFuncTest extends AbstractGradleFuncTest {
250250

251251
buildFile << """
252252
testClusters {
253-
myCluster1 {
253+
myCluster {
254254
testDistribution = 'default'
255255
version = '8.10.4'
256256
}

build.gradle

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -338,18 +338,13 @@ allprojects {
338338
tasks.register('resolveAllDependencies', ResolveAllDependencies) {
339339
def ignoredPrefixes = [DistributionDownloadPlugin.ES_DISTRO_CONFIG_PREFIX, "jdbcDriver"]
340340
configs = project.configurations.matching { config -> ignoredPrefixes.any { config.name.startsWith(it) } == false }
341+
341342
if (project.path == ':') {
342343
resolveJavaToolChain = true
343-
344-
// ensure we have best possible caching of bwc builds
345-
dependsOn ":distribution:bwc:major1:buildBwcLinuxTar"
346-
dependsOn ":distribution:bwc:major2:buildBwcLinuxTar"
347-
dependsOn ":distribution:bwc:major3:buildBwcLinuxTar"
348-
dependsOn ":distribution:bwc:major4:buildBwcLinuxTar"
349-
dependsOn ":distribution:bwc:minor1:buildBwcLinuxTar"
350-
dependsOn ":distribution:bwc:minor2:buildBwcLinuxTar"
351-
dependsOn ":distribution:bwc:minor3:buildBwcLinuxTar"
352-
dependsOn ":distribution:bwc:minor4:buildBwcLinuxTar"
344+
}
345+
// ensure we have best possible caching of bwc builds
346+
if(project.path.startsWith(":distribution:bwc:")) {
347+
dependsOn project.tasks.matching { it.name == 'buildBwcLinuxTar' }
353348
}
354349
if (project.path.contains("fixture")) {
355350
dependsOn tasks.withType(ComposePull)

docs/changelog/134585.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 134585
2+
summary: Add classes to represent raw docs sampling configs
3+
area: Ingest Node
4+
type: feature
5+
issues: []

docs/changelog/134673.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 134673
2+
summary: Gracefully shutdown model deployment when node is removed from assignment
3+
routing
4+
area: Machine Learning
5+
type: bug
6+
issues: []

0 commit comments

Comments
 (0)