Skip to content

Commit

Permalink
Change
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Brooks committed Nov 4, 2024
2 parents 4741f81 + 409fb8d commit 905532d
Show file tree
Hide file tree
Showing 1,391 changed files with 37,330 additions and 26,981 deletions.
4 changes: 3 additions & 1 deletion .buildkite/packer_cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ for branch in "${branches[@]}"; do
fi

export JAVA_HOME="$HOME/.java/$ES_BUILD_JAVA"
"checkout/${branch}/gradlew" --project-dir "$CHECKOUT_DIR" --parallel -s resolveAllDependencies -Dorg.gradle.warning.mode=none -DisCI
"checkout/${branch}/gradlew" --project-dir "$CHECKOUT_DIR" --parallel -s resolveAllDependencies -Dorg.gradle.warning.mode=none -DisCI --max-workers=4
"checkout/${branch}/gradlew" --stop
pkill -f '.*GradleDaemon.*'
rm -rf "checkout/${branch}"
done
6 changes: 3 additions & 3 deletions .buildkite/scripts/cloud-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

set -euo pipefail

.ci/scripts/run-gradle.sh buildCloudDockerImage
.ci/scripts/run-gradle.sh buildCloudEssDockerImage

ES_VERSION=$(grep 'elasticsearch' build-tools-internal/version.properties | awk '{print $3}')
DOCKER_TAG="docker.elastic.co/elasticsearch-ci/elasticsearch-cloud:${ES_VERSION}-${BUILDKITE_COMMIT:0:7}"
docker tag elasticsearch-cloud:test "$DOCKER_TAG"
DOCKER_TAG="docker.elastic.co/elasticsearch-ci/elasticsearch-cloud-ess:${ES_VERSION}-${BUILDKITE_COMMIT:0:7}"
docker tag elasticsearch-cloud-ess:test "$DOCKER_TAG"

echo "$DOCKER_REGISTRY_PASSWORD" | docker login -u "$DOCKER_REGISTRY_USERNAME" --password-stdin docker.elastic.co
unset DOCKER_REGISTRY_USERNAME DOCKER_REGISTRY_PASSWORD
Expand Down
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ gradle @elastic/es-delivery
build-conventions @elastic/es-delivery
build-tools @elastic/es-delivery
build-tools-internal @elastic/es-delivery
*.gradle @elastic/es-delivery
.buildkite @elastic/es-delivery
.ci @elastic/es-delivery
.idea @elastic/es-delivery
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/sync-main-to-jdk-branch.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ Quickly set up Elasticsearch and Kibana in Docker for local development or testi
- If you're using Microsoft Windows, then install https://learn.microsoft.com/en-us/windows/wsl/install[Windows Subsystem for Linux (WSL)].

==== Trial license
This setup comes with a one-month trial license that includes all Elastic features.

This setup comes with a one-month trial of the Elastic *Platinum* license.
After the trial period, the license reverts to *Free and open - Basic*.
Refer to https://www.elastic.co/subscriptions[Elastic subscriptions] for more information.

Expand Down
6 changes: 3 additions & 3 deletions benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ dependencies {
// us to invoke the JMH uberjar as usual.
exclude group: 'net.sf.jopt-simple', module: 'jopt-simple'
}
api(project(':libs:elasticsearch-h3'))
api(project(':libs:h3'))
api(project(':modules:aggregations'))
api(project(':x-pack:plugin:esql-core'))
api(project(':x-pack:plugin:esql'))
api(project(':x-pack:plugin:esql:compute'))
implementation project(path: ':libs:elasticsearch-simdvec')
implementation project(path: ':libs:simdvec')
expression(project(path: ':modules:lang-expression', configuration: 'zip'))
painless(project(path: ':modules:lang-painless', configuration: 'zip'))
nativeLib(project(':libs:elasticsearch-native'))
nativeLib(project(':libs:native'))
api "org.openjdk.jmh:jmh-core:$versions.jmh"
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh"
// Dependencies of JMH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {

def setup() {
// required for JarHell to work
subProject(":libs:elasticsearch-core") << "apply plugin:'java'"
subProject(":libs:core") << "apply plugin:'java'"

configurationCacheCompatible = false
}
Expand Down
37 changes: 35 additions & 2 deletions build-tools-internal/src/main/groovy/elasticsearch.ide.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,36 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
.findAll { it != null }
}

// force IntelliJ to generate *.iml files for each imported module
tasks.register("enableExternalConfiguration") {
group = 'ide'
description = 'Enable per-module *.iml files'

doLast {
modifyXml('.idea/misc.xml') {xml ->
def externalStorageConfig = xml.component.find { it.'@name' == 'ExternalStorageConfigurationManager' }
if (externalStorageConfig) {
xml.remove(externalStorageConfig)
}
}
}
}

// modifies the idea module config to enable preview features on ':libs:native' module
tasks.register("enablePreviewFeatures") {
group = 'ide'
description = 'Enables preview features on native library module'
dependsOn tasks.named("enableExternalConfiguration")

doLast {
['main', 'test'].each { sourceSet ->
modifyXml(".idea/modules/libs/native/elasticsearch.libs.${project.project(':libs:native').name}.${sourceSet}.iml") { xml ->
xml.component.find { it.'@name' == 'NewModuleRootManager' }?.'@LANGUAGE_LEVEL' = 'JDK_21_PREVIEW'
}
}
}
}

tasks.register('buildDependencyArtifacts') {
group = 'ide'
description = 'Builds artifacts needed as dependency for IDE modules'
Expand All @@ -131,7 +161,7 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
':server:generateModulesList',
':server:generatePluginsList',
':generateProviderImpls',
':libs:elasticsearch-native:elasticsearch-native-libraries:extractLibs',
':libs:native:native-libraries:extractLibs',
':x-pack:libs:es-opensaml-security-api:shadowJar'].collect { elasticsearchProject.right()?.task(it) ?: it })
}

Expand All @@ -149,7 +179,10 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
testRunner = 'choose_per_test'
}
taskTriggers {
afterSync tasks.named('configureIdeCheckstyle'), tasks.named('configureIdeaGradleJvm'), tasks.named('buildDependencyArtifacts')
afterSync tasks.named('configureIdeCheckstyle'),
tasks.named('configureIdeaGradleJvm'),
tasks.named('buildDependencyArtifacts'),
tasks.named('enablePreviewFeatures')
}
encodings {
encoding = 'UTF-8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ BuildParams.bwcVersions.withIndexCompatible({ it.onOrAfter(Version.fromString(ex
if (unreleasedVersion) {
// For unreleased snapshot versions, build them from source
"oldJar${baseName}"(files(project(unreleasedVersion.gradleProjectPath).tasks.named(buildBwcTaskName(project.name))))
} else if(bwcVersion.onOrAfter('8.7.0') && project.name.endsWith("elasticsearch-logging")==false) {
} else if(bwcVersion.onOrAfter('8.7.0') && project.name.endsWith("logging")==false) {
//there was a package rename in 8.7.0, except for es-logging
"oldJar${baseName}"("org.elasticsearch.plugin:${project.name}:${bwcVersion}")
"oldJar${baseName}"("org.elasticsearch.plugin:elasticsearch-${project.name}:${bwcVersion}")
} else {
// For released versions, download it
"oldJar${baseName}"("org.elasticsearch:${project.name}:${bwcVersion}")
"oldJar${baseName}"("org.elasticsearch:elasticsearch-${project.name}:${bwcVersion}")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ public enum DockerBase {
// The Iron Bank base image is UBI (albeit hardened), but we are required to parameterize the Docker build
IRON_BANK("${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}", "-ironbank", "yum"),

// Base image with extras for Cloud
CLOUD("ubuntu:20.04", "-cloud", "apt-get"),

// Chainguard based wolfi image with latest jdk
// This is usually updated via renovatebot
// spotless:off
WOLFI("docker.elastic.co/wolfi/chainguard-base:latest@sha256:bf163e1977002301f7b9fd28fe6837a8cb2dd5c83e4cd45fb67fb28d15d5d40f",
WOLFI("docker.elastic.co/wolfi/chainguard-base:latest@sha256:973431347ad45f40e01afbbd010bf9de929c088a63382239b90dd84f39618bc8",
"-wolfi",
"apk"
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream;
import org.apache.commons.io.IOUtils;
import org.elasticsearch.gradle.OS;
import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
Expand Down Expand Up @@ -61,7 +62,7 @@ public void apply(Project target) {
? System.getenv("BUILD_NUMBER")
: System.getenv("BUILDKITE_BUILD_NUMBER");
String performanceTest = System.getenv("BUILD_PERFORMANCE_TEST");
if (buildNumber != null && performanceTest == null && GradleUtils.isIncludedBuild(target) == false) {
if (buildNumber != null && performanceTest == null && GradleUtils.isIncludedBuild(target) == false && OS.current() != OS.WINDOWS) {
File targetFile = calculateTargetFile(target, buildNumber);
File projectDir = target.getProjectDir();
File gradleWorkersDir = new File(target.getGradle().getGradleUserHomeDir(), "workers/");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public static void configureInputNormalization(Project project) {
}

private static void configureNativeLibraryPath(Project project) {
String nativeProject = ":libs:elasticsearch-native:elasticsearch-native-libraries";
String nativeProject = ":libs:native:native-libraries";
Configuration nativeConfig = project.getConfigurations().create("nativeLibs");
nativeConfig.defaultDependencies(deps -> {
deps.add(project.getDependencies().project(Map.of("path", nativeProject, "configuration", "default")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ private void registerAndConfigureDistributionArchivesExtension(Project project)
sub.getArtifacts().add(DEFAULT_CONFIGURATION_NAME, distributionArchive.getArchiveTask());
var extractedConfiguration = sub.getConfigurations().create(EXTRACTED_CONFIGURATION_NAME);
extractedConfiguration.setCanBeResolved(false);
extractedConfiguration.setCanBeConsumed(true);
extractedConfiguration.getAttributes()
.attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.DIRECTORY_TYPE);
sub.getArtifacts().add(EXTRACTED_CONFIGURATION_NAME, distributionArchive.getExpandedDistTask());
// The "composite" configuration is specifically used for resolving transformed artifacts in an included build
var compositeConfiguration = sub.getConfigurations().create(COMPOSITE_CONFIGURATION_NAME);
compositeConfiguration.setCanBeResolved(false);
compositeConfiguration.setCanBeConsumed(true);
compositeConfiguration.getAttributes()
.attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.DIRECTORY_TYPE);
compositeConfiguration.getAttributes().attribute(Attribute.of("composite", Boolean.class), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ private static void configureBwcProject(
DistributionProjectArtifact stableAnalysisPluginProjectArtifact = new DistributionProjectArtifact(
new File(
checkoutDir.get(),
relativeDir + "/build/distributions/" + stableApiProject.getName() + "-" + bwcVersion.get() + "-SNAPSHOT.jar"
relativeDir
+ "/build/distributions/elasticsearch-"
+ stableApiProject.getName()
+ "-"
+ bwcVersion.get()
+ "-SNAPSHOT.jar"
),
null
);
Expand Down Expand Up @@ -275,7 +280,7 @@ private static List<DistributionProject> resolveArchiveProjects(File checkoutDir
}

private static List<Project> resolveStableProjects(Project project) {
Set<String> stableProjectNames = Set.of("elasticsearch-logging", "elasticsearch-plugin-api", "elasticsearch-plugin-analysis-api");
Set<String> stableProjectNames = Set.of("logging", "plugin-api", "plugin-analysis-api");
return project.findProject(":libs")
.getSubprojects()
.stream()
Expand Down Expand Up @@ -312,7 +317,9 @@ static void createBuildBwcTask(
c.getOutputs().files(expectedOutputFile);
}
c.getOutputs().doNotCacheIf("BWC distribution caching is disabled for local builds", task -> BuildParams.isCi() == false);
c.getArgs().add(projectPath.replace('/', ':') + ":" + assembleTaskName);
c.getArgs().add("-p");
c.getArgs().add(projectPath);
c.getArgs().add(assembleTaskName);
if (project.getGradle().getStartParameter().isBuildCacheEnabled()) {
c.getArgs().add("--build-cache");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,6 @@ private static String distributionProjectName(ElasticsearchDistribution distribu
if (distribution.getType() == InternalElasticsearchDistributionTypes.DOCKER_IRONBANK) {
return projectName + "ironbank-docker" + archString + "-export";
}
if (distribution.getType() == InternalElasticsearchDistributionTypes.DOCKER_CLOUD) {
return projectName + "cloud-docker" + archString + "-export";
}
if (distribution.getType() == InternalElasticsearchDistributionTypes.DOCKER_CLOUD_ESS) {
return projectName + "cloud-ess-docker" + archString + "-export";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
import org.elasticsearch.gradle.VersionProperties;
import org.gradle.api.DefaultTask;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.FileCollectionDependency;
import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
import org.gradle.api.file.FileCollection;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.ProviderFactory;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.TaskAction;
Expand All @@ -26,9 +29,6 @@

import javax.inject.Inject;

import static org.elasticsearch.gradle.DistributionDownloadPlugin.DISTRO_EXTRACTED_CONFIG_PREFIX;
import static org.elasticsearch.gradle.internal.test.rest.compat.compat.LegacyYamlRestCompatTestPlugin.BWC_MINOR_CONFIG_NAME;

public abstract class ResolveAllDependencies extends DefaultTask {

private boolean resolveJavaToolChain = false;
Expand All @@ -37,18 +37,28 @@ public abstract class ResolveAllDependencies extends DefaultTask {
protected abstract JavaToolchainService getJavaToolchainService();

private final ObjectFactory objectFactory;
private final ProviderFactory providerFactory;

private Collection<Configuration> configs;

@Inject
public ResolveAllDependencies(ObjectFactory objectFactory) {
public ResolveAllDependencies(ObjectFactory objectFactory, ProviderFactory providerFactory) {
this.objectFactory = objectFactory;
this.providerFactory = providerFactory;
}

@InputFiles
public FileCollection getResolvedArtifacts() {
return objectFactory.fileCollection()
.from(configs.stream().filter(ResolveAllDependencies::canBeResolved).collect(Collectors.toList()));
return objectFactory.fileCollection().from(configs.stream().filter(ResolveAllDependencies::canBeResolved).map(c -> {
// Make a copy of the configuration, omitting file collection dependencies to avoid building project artifacts
Configuration copy = c.copyRecursive(d -> d instanceof FileCollectionDependency == false);
copy.setCanBeConsumed(false);
return copy;
})
// Include only module dependencies, ignoring things like project dependencies so we don't unnecessarily build stuff
.map(c -> c.getIncoming().artifactView(v -> v.lenient(true).componentFilter(i -> i instanceof ModuleComponentIdentifier)))
.map(artifactView -> providerFactory.provider(artifactView::getFiles))
.collect(Collectors.toList()));
}

@TaskAction
Expand Down Expand Up @@ -95,8 +105,8 @@ private static boolean canBeResolved(Configuration configuration) {
return false;
}
}
return configuration.getName().startsWith(DISTRO_EXTRACTED_CONFIG_PREFIX) == false
&& configuration.getName().equals(BWC_MINOR_CONFIG_NAME) == false;

return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":plugins:repository-hdfs");
map.put(LegacyRestTestBasePlugin.class, ":plugins:store-smb");
map.put(LegacyRestTestBasePlugin.class, ":qa:ccs-rolling-upgrade-remote-cluster");
map.put(LegacyRestTestBasePlugin.class, ":qa:ccs-unavailable-clusters");
map.put(LegacyRestTestBasePlugin.class, ":qa:logging-config");
map.put(LegacyRestTestBasePlugin.class, ":qa:mixed-cluster");
map.put(LegacyRestTestBasePlugin.class, ":qa:multi-cluster-search");
map.put(LegacyRestTestBasePlugin.class, ":qa:remote-clusters");
Expand All @@ -65,15 +63,13 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-ingest-with-all-dependencies");
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-plugins");
map.put(LegacyRestTestBasePlugin.class, ":qa:system-indices");
map.put(LegacyRestTestBasePlugin.class, ":qa:unconfigured-node-name");
map.put(LegacyRestTestBasePlugin.class, ":qa:verify-version-constants");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-apm-integration");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-delayed-aggs");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-die-with-dignity");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-error-query");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-latency-simulating-directory");
map.put(LegacyRestTestBasePlugin.class, ":test:yaml-rest-runner");
map.put(LegacyRestTestBasePlugin.class, ":distribution:archives:integ-test-zip");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:core");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:fleet");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public class InternalElasticsearchDistributionTypes {
public static ElasticsearchDistributionType DOCKER = new DockerElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_UBI = new DockerUbiElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_IRONBANK = new DockerIronBankElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_CLOUD = new DockerCloudElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_CLOUD_ESS = new DockerCloudEssElasticsearchDistributionType();
public static ElasticsearchDistributionType DOCKER_WOLFI = new DockerWolfiElasticsearchDistributionType();

Expand All @@ -29,7 +28,6 @@ public class InternalElasticsearchDistributionTypes {
DOCKER,
DOCKER_UBI,
DOCKER_IRONBANK,
DOCKER_CLOUD,
DOCKER_CLOUD_ESS,
DOCKER_WOLFI
);
Expand Down
Loading

0 comments on commit 905532d

Please sign in to comment.