|
@@ -19,6 +19,7 @@
|
|
|
|
|
|
package org.elasticsearch.gradle.test;
|
|
|
|
|
|
+import org.elasticsearch.gradle.Architecture;
|
|
|
import org.elasticsearch.gradle.BwcVersions;
|
|
|
import org.elasticsearch.gradle.DistributionDownloadPlugin;
|
|
|
import org.elasticsearch.gradle.ElasticsearchDistribution;
|
|
@@ -110,11 +111,13 @@ public class DistroTestPlugin implements Plugin<Project> {
|
|
|
|
|
|
Map<ElasticsearchDistribution.Type, TaskProvider<?>> lifecyleTasks = lifecyleTasks(project, "destructiveDistroTest");
|
|
|
TaskProvider<Task> destructiveDistroTest = project.getTasks().register("destructiveDistroTest");
|
|
|
+
|
|
|
for (ElasticsearchDistribution distribution : distributions) {
|
|
|
TaskProvider<?> destructiveTask = configureDistroTest(project, distribution, dockerSupport);
|
|
|
destructiveDistroTest.configure(t -> t.dependsOn(destructiveTask));
|
|
|
lifecyleTasks.get(distribution.getType()).configure(t -> t.dependsOn(destructiveTask));
|
|
|
}
|
|
|
+
|
|
|
Map<String, TaskProvider<?>> batsTests = new HashMap<>();
|
|
|
configureBatsTest(project, "plugins", distributionsDir, copyDistributionsTask, copyPluginsTask).configure(
|
|
|
t -> t.setPluginsDir(pluginsDir)
|
|
@@ -348,6 +351,8 @@ public class DistroTestPlugin implements Plugin<Project> {
|
|
|
return project.getTasks().register(destructiveDistroTestTaskName(distribution), Test.class, t -> {
|
|
|
// Disable Docker distribution tests unless a Docker installation is available
|
|
|
t.onlyIf(t2 -> distribution.getType() != Type.DOCKER || dockerSupport.get().getDockerAvailability().isAvailable);
|
|
|
+ // Only run tests for the current architecture
|
|
|
+ t.onlyIf(t3 -> distribution.getArchitecture() == Architecture.current());
|
|
|
t.getOutputs().doNotCacheIf("Build cache is disabled for packaging tests", Specs.satisfyAll());
|
|
|
t.setMaxParallelForks(1);
|
|
|
t.setWorkingDir(project.getProjectDir());
|
|
@@ -381,47 +386,68 @@ public class DistroTestPlugin implements Plugin<Project> {
|
|
|
List<ElasticsearchDistribution> currentDistros = new ArrayList<>();
|
|
|
List<ElasticsearchDistribution> upgradeDistros = new ArrayList<>();
|
|
|
|
|
|
- for (Type type : List.of(Type.DEB, Type.RPM, Type.DOCKER)) {
|
|
|
- for (Flavor flavor : Flavor.values()) {
|
|
|
- for (boolean bundledJdk : Arrays.asList(true, false)) {
|
|
|
- // All our Docker images include a bundled JDK so it doesn't make sense to test without one
|
|
|
- boolean skip = type == Type.DOCKER && bundledJdk == false;
|
|
|
-
|
|
|
- if (skip == false) {
|
|
|
- addDistro(distributions, type, null, flavor, bundledJdk, VersionProperties.getElasticsearch(), currentDistros);
|
|
|
+ for (Architecture architecture : Architecture.values()) {
|
|
|
+ for (Type type : List.of(Type.DEB, Type.RPM, Type.DOCKER)) {
|
|
|
+ for (Flavor flavor : Flavor.values()) {
|
|
|
+ for (boolean bundledJdk : Arrays.asList(true, false)) {
|
|
|
+ // All our Docker images include a bundled JDK so it doesn't make sense to test without one.
|
|
|
+ // Also we'll never publish an ARM (aarch64) build without a bundled JDK.
|
|
|
+ boolean skip = bundledJdk == false && (type == Type.DOCKER || architecture == Architecture.AARCH64);
|
|
|
+
|
|
|
+ if (skip == false) {
|
|
|
+ addDistro(
|
|
|
+ distributions,
|
|
|
+ architecture,
|
|
|
+ type,
|
|
|
+ null,
|
|
|
+ flavor,
|
|
|
+ bundledJdk,
|
|
|
+ VersionProperties.getElasticsearch(),
|
|
|
+ currentDistros
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- // We don't configure distributions for prior versions for Docker. This is because doing
|
|
|
- // so prompts Gradle to try and resolve the Docker dependencies, which doesn't work as
|
|
|
- // they can't be downloaded via Ivy (configured in DistributionDownloadPlugin). Since we
|
|
|
- // need these for the BATS upgrade tests, and those tests only cover .rpm and .deb, it's
|
|
|
- // OK to omit creating such distributions in the first place. We may need to revisit
|
|
|
- // this in the future, so allow upgrade testing using Docker containers.
|
|
|
- if (type != Type.DOCKER) {
|
|
|
- // upgrade version is always bundled jdk
|
|
|
- // NOTE: this is mimicking the old VagrantTestPlugin upgrade behavior. It will eventually be replaced
|
|
|
- // witha dedicated upgrade test from every bwc version like other bwc tests
|
|
|
- addDistro(distributions, type, null, Flavor.DEFAULT, true, upgradeVersion.toString(), upgradeDistros);
|
|
|
- if (upgradeVersion.onOrAfter("6.3.0")) {
|
|
|
- addDistro(distributions, type, null, Flavor.OSS, true, upgradeVersion.toString(), upgradeDistros);
|
|
|
+ // We don't configure distributions for prior versions for Docker. This is because doing
|
|
|
+ // so prompts Gradle to try and resolve the Docker dependencies, which doesn't work as
|
|
|
+ // they can't be downloaded via Ivy (configured in DistributionDownloadPlugin). Since we
|
|
|
+ // need these for the BATS upgrade tests, and those tests only cover .rpm and .deb, it's
|
|
|
+ // OK to omit creating such distributions in the first place. We may need to revisit
|
|
|
+ // this in the future, so allow upgrade testing using Docker containers.
|
|
|
+ if (type != Type.DOCKER) {
|
|
|
+ // upgrade version is always bundled jdk
|
|
|
+ // NOTE: this is mimicking the old VagrantTestPlugin upgrade behavior. It will eventually be replaced
|
|
|
+ // witha dedicated upgrade test from every bwc version like other bwc tests
|
|
|
+ addDistro(distributions, architecture, type, null, Flavor.DEFAULT, true, upgradeVersion.toString(), upgradeDistros);
|
|
|
+ if (upgradeVersion.onOrAfter("6.3.0")) {
|
|
|
+ addDistro(distributions, architecture, type, null, Flavor.OSS, true, upgradeVersion.toString(), upgradeDistros);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for (Platform platform : Arrays.asList(Platform.LINUX, Platform.WINDOWS)) {
|
|
|
- for (Flavor flavor : Flavor.values()) {
|
|
|
- for (boolean bundledJdk : Arrays.asList(true, false)) {
|
|
|
- addDistro(
|
|
|
- distributions,
|
|
|
- Type.ARCHIVE,
|
|
|
- platform,
|
|
|
- flavor,
|
|
|
- bundledJdk,
|
|
|
- VersionProperties.getElasticsearch(),
|
|
|
- currentDistros
|
|
|
- );
|
|
|
+ for (Architecture architecture : Architecture.values()) {
|
|
|
+ for (Platform platform : Arrays.asList(Platform.LINUX, Platform.WINDOWS)) {
|
|
|
+ for (Flavor flavor : Flavor.values()) {
|
|
|
+ for (boolean bundledJdk : Arrays.asList(true, false)) {
|
|
|
+ if (bundledJdk == false && architecture != Architecture.X64) {
|
|
|
+ // We will never publish distributions for non-x86 (amd64) platforms
|
|
|
+ // without a bundled JDK
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ addDistro(
|
|
|
+ distributions,
|
|
|
+ architecture,
|
|
|
+ Type.ARCHIVE,
|
|
|
+ platform,
|
|
|
+ flavor,
|
|
|
+ bundledJdk,
|
|
|
+ VersionProperties.getElasticsearch(),
|
|
|
+ currentDistros
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -445,6 +471,7 @@ public class DistroTestPlugin implements Plugin<Project> {
|
|
|
|
|
|
private static void addDistro(
|
|
|
NamedDomainObjectContainer<ElasticsearchDistribution> distributions,
|
|
|
+ Architecture architecture,
|
|
|
Type type,
|
|
|
Platform platform,
|
|
|
Flavor flavor,
|
|
@@ -452,11 +479,12 @@ public class DistroTestPlugin implements Plugin<Project> {
|
|
|
String version,
|
|
|
List<ElasticsearchDistribution> container
|
|
|
) {
|
|
|
- String name = distroId(type, platform, flavor, bundledJdk) + "-" + version;
|
|
|
+ String name = distroId(type, platform, flavor, bundledJdk, architecture) + "-" + version;
|
|
|
if (distributions.findByName(name) != null) {
|
|
|
return;
|
|
|
}
|
|
|
ElasticsearchDistribution distro = distributions.create(name, d -> {
|
|
|
+ d.setArchitecture(architecture);
|
|
|
d.setFlavor(flavor);
|
|
|
d.setType(type);
|
|
|
if (type == Type.ARCHIVE) {
|
|
@@ -482,12 +510,18 @@ public class DistroTestPlugin implements Plugin<Project> {
|
|
|
return project.getName().contains("windows");
|
|
|
}
|
|
|
|
|
|
- private static String distroId(Type type, Platform platform, Flavor flavor, boolean bundledJdk) {
|
|
|
- return flavor + "-" + (type == Type.ARCHIVE ? platform + "-" : "") + type + (bundledJdk ? "" : "-no-jdk");
|
|
|
+ private static String distroId(Type type, Platform platform, Flavor flavor, boolean bundledJdk, Architecture architecture) {
|
|
|
+ return flavor
|
|
|
+ + "-"
|
|
|
+ + (type == Type.ARCHIVE ? platform + "-" : "")
|
|
|
+ + type
|
|
|
+ + (bundledJdk ? "" : "-no-jdk")
|
|
|
+ + (architecture == Architecture.X64 ? "" : "-" + architecture.toString().toLowerCase());
|
|
|
}
|
|
|
|
|
|
private static String destructiveDistroTestTaskName(ElasticsearchDistribution distro) {
|
|
|
Type type = distro.getType();
|
|
|
- return "destructiveDistroTest." + distroId(type, distro.getPlatform(), distro.getFlavor(), distro.getBundledJdk());
|
|
|
+ return "destructiveDistroTest."
|
|
|
+ + distroId(type, distro.getPlatform(), distro.getFlavor(), distro.getBundledJdk(), distro.getArchitecture());
|
|
|
}
|
|
|
}
|