Skip to content

Commit

Permalink
Merge remote-tracking branch 'es/main' into synthetic_source_gold_pla…
Browse files Browse the repository at this point in the history
…tinum_licenses
  • Loading branch information
martijnvg committed Nov 18, 2024
2 parents 3d5abfe + 366fa74 commit 83d19cd
Show file tree
Hide file tree
Showing 1,006 changed files with 17,385 additions and 6,533 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipelines/intake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ steps:
timeout_in_minutes: 300
matrix:
setup:
BWC_VERSION: ["8.15.4", "8.16.0", "8.17.0", "9.0.0"]
BWC_VERSION: ["8.16.1", "8.17.0", "9.0.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
Expand Down
6 changes: 3 additions & 3 deletions .buildkite/pipelines/periodic-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ steps:
env:
BWC_VERSION: 8.15.4

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

- label: "{{matrix.image}} / 8.17.0 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.17.0
Expand Down
10 changes: 5 additions & 5 deletions .buildkite/pipelines/periodic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ steps:
- signal_reason: agent_stop
limit: 3

- label: 8.16.0 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.16.0#bwcTest
- label: 8.16.1 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.16.1#bwcTest
timeout_in_minutes: 300
agents:
provider: gcp
Expand All @@ -316,7 +316,7 @@ steps:
buildDirectory: /dev/shm/bk
preemptible: true
env:
BWC_VERSION: 8.16.0
BWC_VERSION: 8.16.1
retry:
automatic:
- exit_status: "-1"
Expand Down Expand Up @@ -429,7 +429,7 @@ steps:
setup:
ES_RUNTIME_JAVA:
- openjdk21
BWC_VERSION: ["8.15.4", "8.16.0", "8.17.0", "9.0.0"]
BWC_VERSION: ["8.16.1", "8.17.0", "9.0.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
Expand Down Expand Up @@ -471,7 +471,7 @@ steps:
ES_RUNTIME_JAVA:
- openjdk21
- openjdk23
BWC_VERSION: ["8.15.4", "8.16.0", "8.17.0", "9.0.0"]
BWC_VERSION: ["8.16.1", "8.17.0", "9.0.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
Expand Down
9 changes: 4 additions & 5 deletions .buildkite/scripts/gradle-configuration-cache-validation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

set -euo pipefail

# TODO/ FIXIT without a full resolved gradle home, we see issues configuration cache reuse
./gradlew --max-workers=8 --parallel --scan --no-daemon precommit
# This is a workaround for https://github.com/gradle/gradle/issues/28159
.ci/scripts/run-gradle.sh --no-daemon precommit

./gradlew --max-workers=8 --parallel --scan --configuration-cache precommit -Dorg.gradle.configuration-cache.inputs.unsafe.ignore.file-system-checks=build/*.tar.bz2
.ci/scripts/run-gradle.sh --configuration-cache precommit -Dorg.gradle.configuration-cache.inputs.unsafe.ignore.file-system-checks=build/*.tar.bz2

# Create a temporary file
tmpOutputFile=$(mktemp)
trap "rm $tmpOutputFile" EXIT

echo "2nd run"
# TODO run-gradle.sh script causes issues because of init script handling
./gradlew --max-workers=8 --parallel --scan --configuration-cache precommit -Dorg.gradle.configuration-cache.inputs.unsafe.ignore.file-system-checks=build/*.tar.bz2 | tee $tmpOutputFile
.ci/scripts/run-gradle.sh --configuration-cache precommit -Dorg.gradle.configuration-cache.inputs.unsafe.ignore.file-system-checks=build/*.tar.bz2 | tee $tmpOutputFile

# Check if the command was successful
if grep -q "Configuration cache entry reused." $tmpOutputFile; then
Expand Down
2 changes: 1 addition & 1 deletion .ci/bwcVersions
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ BWC_VERSION:
- "8.13.4"
- "8.14.3"
- "8.15.4"
- "8.16.0"
- "8.16.1"
- "8.17.0"
- "9.0.0"
3 changes: 1 addition & 2 deletions .ci/snapshotBwcVersions
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
BWC_VERSION:
- "8.15.4"
- "8.16.0"
- "8.16.1"
- "8.17.0"
- "9.0.0"
8 changes: 4 additions & 4 deletions TESTING.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ You can run a group of YAML test by using wildcards:
--tests "org.elasticsearch.test.rest.ClientYamlTestSuiteIT.test {yaml=index/*/*}"
---------------------------------------------------------------------------

or
or

---------------------------------------------------------------------------
./gradlew :rest-api-spec:yamlRestTest \
Expand Down Expand Up @@ -564,8 +564,8 @@ Sometimes a backward compatibility change spans two versions.
A common case is a new functionality that needs a BWC bridge in an unreleased versioned of a release branch (for example, 5.x).
Another use case, since the introduction of serverless, is to test BWC against main in addition to the other released branches.
To do so, specify the `bwc.refspec` remote and branch to use for the BWC build as `origin/main`.
To test against main, you will also need to create a new version in link:./server/src/main/java/org/elasticsearch/Version.java[Version.java],
increment `elasticsearch` in link:./build-tools-internal/version.properties[version.properties], and hard-code the `project.version` for ml-cpp
To test against main, you will also need to create a new version in link:./server/src/main/java/org/elasticsearch/Version.java[Version.java],
increment `elasticsearch` in link:./build-tools-internal/version.properties[version.properties], and hard-code the `project.version` for ml-cpp
in link:./x-pack/plugin/ml/build.gradle[ml/build.gradle].

In general, to test the changes, you can instruct Gradle to build the BWC version from another remote/branch combination instead of pulling the release branch from GitHub.
Expand Down Expand Up @@ -625,7 +625,7 @@ For specific YAML rest tests one can use
For disabling entire types of tests for subprojects, one can use for example:

------------------------------------------------
if (BuildParams.inFipsJvm){
if (buildParams.inFipsJvm) {
// This test cluster is using a BASIC license and FIPS 140 mode is not supported in BASIC
tasks.named("javaRestTest").configure{enabled = false }
}
Expand Down
3 changes: 1 addition & 2 deletions benchmarks/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import org.elasticsearch.gradle.internal.info.BuildParams
import org.elasticsearch.gradle.internal.test.TestUtil

/*
Expand Down Expand Up @@ -78,7 +77,7 @@ tasks.register("copyPainless", Copy) {
}

tasks.named("run").configure {
executable = "${BuildParams.runtimeJavaHome}/bin/java"
executable = "${buildParams.runtimeJavaHome.get()}/bin/java"
args << "-Dplugins.dir=${buildDir}/plugins" << "-Dtests.index=${buildDir}/index"
dependsOn "copyExpression", "copyPainless", configurations.nativeLib
systemProperty 'es.nativelibs.path', TestUtil.getTestLibraryPath(file("../libs/native/libraries/build/platform/").toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.elasticsearch.benchmark.index.mapper;

import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.util.Accountable;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.cluster.ClusterModule;
import org.elasticsearch.cluster.metadata.IndexMetadata;
Expand All @@ -28,7 +27,6 @@
import org.elasticsearch.index.mapper.MapperRegistry;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.mapper.ProvidedIdFieldMapper;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.index.similarity.SimilarityService;
import org.elasticsearch.indices.IndicesModule;
import org.elasticsearch.script.Script;
Expand Down Expand Up @@ -56,13 +54,7 @@ public static MapperService create(String mappings) {
MapperRegistry mapperRegistry = new IndicesModule(Collections.emptyList()).getMapperRegistry();

SimilarityService similarityService = new SimilarityService(indexSettings, null, Map.of());
BitsetFilterCache bitsetFilterCache = new BitsetFilterCache(indexSettings, new BitsetFilterCache.Listener() {
@Override
public void onCache(ShardId shardId, Accountable accountable) {}

@Override
public void onRemoval(ShardId shardId, Accountable accountable) {}
});
BitsetFilterCache bitsetFilterCache = new BitsetFilterCache(indexSettings, BitsetFilterCache.Listener.NOOP);
MapperService mapperService = new MapperService(
() -> TransportVersion.current(),
indexSettings,
Expand Down
7 changes: 0 additions & 7 deletions build-conventions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder

buildscript {
repositories {
maven {
url 'https://jitpack.io'
}
mavenCentral()
}
}
Expand Down Expand Up @@ -70,10 +67,6 @@ gradlePlugin {
}

repositories {
maven {
url 'https://jitpack.io'
}

mavenCentral()
gradlePluginPortal()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ public abstract class GUtils {
public static String capitalize(String s) {
return s.substring(0, 1).toUpperCase(Locale.ROOT) + s.substring(1);
}

public static <T> T elvis(T given, T fallback) {
if (given == null) {
return fallback;
} else {
return given;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@

package org.elasticsearch.gradle.internal.conventions;

import org.elasticsearch.gradle.internal.conventions.precommit.PomValidationPrecommitPlugin;
import groovy.util.Node;

import com.github.jengelman.gradle.plugins.shadow.ShadowExtension;
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin;
import groovy.util.Node;
import org.elasticsearch.gradle.internal.conventions.util.Util;

import org.elasticsearch.gradle.internal.conventions.info.GitInfo;
import org.elasticsearch.gradle.internal.conventions.precommit.PomValidationPrecommitPlugin;
import org.elasticsearch.gradle.internal.conventions.util.Util;
import org.gradle.api.NamedDomainObjectSet;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
Expand All @@ -35,11 +37,12 @@
import org.gradle.api.tasks.bundling.Jar;
import org.gradle.initialization.layout.BuildLayout;
import org.gradle.language.base.plugins.LifecycleBasePlugin;
import org.w3c.dom.Element;

import javax.inject.Inject;
import java.io.File;
import java.util.Map;
import java.util.concurrent.Callable;
import javax.inject.Inject;

public class PublishPlugin implements Plugin<Project> {

Expand All @@ -64,6 +67,7 @@ public void apply(Project project) {
configureSourcesJar(project);
configurePomGeneration(project);
configurePublications(project);
formatGeneratedPom(project);
}

private void configurePublications(Project project) {
Expand Down Expand Up @@ -113,29 +117,32 @@ private void configurePomGeneration(Project project) {
var archivesBaseName = providerFactory.provider(() -> getArchivesBaseName(extensions));
var projectVersion = providerFactory.provider(() -> project.getVersion());
var generateMavenPoms = project.getTasks().withType(GenerateMavenPom.class);
generateMavenPoms.configureEach(
pomTask -> pomTask.setDestination(
generateMavenPoms.configureEach(pomTask -> {
pomTask.setDestination(
(Callable<String>) () -> String.format(
"%s/distributions/%s-%s.pom",
projectLayout.getBuildDirectory().get().getAsFile().getPath(),
archivesBaseName.get(),
projectVersion.get()
)
)
);
);
});

var publishing = extensions.getByType(PublishingExtension.class);
final var mavenPublications = publishing.getPublications().withType(MavenPublication.class);
addNameAndDescriptiontoPom(project, mavenPublications);
addNameAndDescriptionToPom(project, mavenPublications);
mavenPublications.configureEach(publication -> {
// Add git origin info to generated POM files for internal builds
publication.getPom().withXml(xml -> addScmInfo(xml, gitInfo.get()));
publication.getPom().withXml(xml -> {
// Add git origin info to generated POM files for internal builds
addScmInfo(xml, gitInfo.get());
});
// have to defer this until archivesBaseName is set
project.afterEvaluate(p -> publication.setArtifactId(archivesBaseName.get()));
generatePomTask.configure(t -> t.dependsOn(generateMavenPoms));
});
}

private void addNameAndDescriptiontoPom(Project project, NamedDomainObjectSet<MavenPublication> mavenPublications) {
private void addNameAndDescriptionToPom(Project project, NamedDomainObjectSet<MavenPublication> mavenPublications) {
var name = project.getName();
var description = providerFactory.provider(() -> project.getDescription() != null ? project.getDescription() : "");
mavenPublications.configureEach(p -> p.getPom().withXml(xml -> {
Expand Down Expand Up @@ -186,4 +193,32 @@ static void configureSourcesJar(Project project) {
project.getTasks().named(BasePlugin.ASSEMBLE_TASK_NAME).configure(t -> t.dependsOn(sourcesJarTask));
});
}


/**
* Format the generated pom files to be in a sort of reproducible order.
*/
private void formatGeneratedPom(Project project) {
var publishing = project.getExtensions().getByType(PublishingExtension.class);
final var mavenPublications = publishing.getPublications().withType(MavenPublication.class);
mavenPublications.configureEach(publication -> {
publication.getPom().withXml(xml -> {
// Add some pom formatting
formatDependencies(xml);
});
});
}

/**
* just ensure we put dependencies to the end. more a cosmetic thing than anything else
* */
private void formatDependencies(XmlProvider xml) {
Element rootElement = xml.asElement();
var dependencies = rootElement.getElementsByTagName("dependencies");
if (dependencies.getLength() == 1 && dependencies.item(0) != null) {
org.w3c.dom.Node item = dependencies.item(0);
rootElement.removeChild(item);
rootElement.appendChild(item);
}
}
}
14 changes: 7 additions & 7 deletions build-tools-internal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,6 @@ tasks.named('licenseHeaders').configure {
*****************************************************************************/

repositories {
maven {
url 'https://jitpack.io'
}
mavenCentral()
gradlePluginPortal()
}
Expand Down Expand Up @@ -386,10 +383,13 @@ tasks.named("jar") {

spotless {
java {
// IDEs can sometimes run annotation processors that leave files in
// here, causing Spotless to complain. Even though this path ought not
// to exist, exclude it anyway in order to avoid spurious failures.
toggleOffOn()

// workaround for https://github.com/diffplug/spotless/issues/2317
//toggleOffOn()
target project.fileTree("src/main/java") {
include '**/*.java'
exclude '**/DockerBase.java'
}
}
}

Expand Down
3 changes: 0 additions & 3 deletions build-tools-internal/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
pluginManagement {
repositories {
maven {
url 'https://jitpack.io'
}
mavenCentral()
gradlePluginPortal()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ElasticsearchJavadocPluginFuncTest extends AbstractGradleFuncTest {
buildFile << """
plugins {
id 'elasticsearch.java-doc'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.gradleup.shadow'
id 'java'
}
group = 'org.acme.depending'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@

package org.elasticsearch.gradle.internal

import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.fixtures.AbstractGitAwareGradleFuncTest
import org.gradle.testkit.runner.TaskOutcome
import spock.lang.IgnoreIf
import spock.lang.Unroll

/*
* Test is ignored on ARM since this test case tests the ability to build certain older BWC branches that we don't support on ARM
*/
@IgnoreIf({ Architecture.current() == Architecture.AARCH64 })
class InternalDistributionBwcSetupPluginFuncTest extends AbstractGitAwareGradleFuncTest {

def setup() {
Expand Down
Loading

0 comments on commit 83d19cd

Please sign in to comment.