diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/test/DistroTestPlugin.java b/buildSrc/src/main/java/org/elasticsearch/gradle/test/DistroTestPlugin.java index 801313ccaf4..c874dafed5c 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/test/DistroTestPlugin.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/test/DistroTestPlugin.java @@ -106,10 +106,12 @@ public class DistroTestPlugin implements Plugin { TaskProvider copyUpgradeTask = configureCopyUpgradeTask(project, upgradeVersion, upgradeDir); TaskProvider copyPluginsTask = configureCopyPluginsTask(project, pluginsDir); + Map> lifecyleTasks = lifecyleTasks(project, "distructiveDistroTest"); TaskProvider 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> batsTests = new HashMap<>(); configureBatsTest(project, "plugins", distributionsDir, copyDistributionsTask, copyPluginsTask).configure( @@ -125,6 +127,7 @@ public class DistroTestPlugin implements Plugin { List vmDependencies = new ArrayList<>(configureVM(vmProject)); vmDependencies.add(project.getConfigurations().getByName("testRuntimeClasspath")); + Map> vmLifecyleTasks = lifecyleTasks(vmProject, "distroTest"); TaskProvider distroTest = vmProject.getTasks().register("distroTest"); for (ElasticsearchDistribution distribution : distributions) { String destructiveTaskName = destructiveDistroTestTaskName(distribution); @@ -139,6 +142,7 @@ public class DistroTestPlugin implements Plugin { ); vmTask.configure(t -> t.dependsOn(distribution)); + vmLifecyleTasks.get(distribution.getType()).configure(t -> t.dependsOn(vmTask)); distroTest.configure(t -> { // Only VM sub-projects that are specifically opted-in to testing Docker should // have the Docker task added as a dependency. Although we control whether Docker @@ -168,6 +172,17 @@ public class DistroTestPlugin implements Plugin { }); } + private static Map> lifecyleTasks(Project project, String taskPrefix) { + Map> lifecyleTasks = new HashMap<>(); + + lifecyleTasks.put(Type.DOCKER, project.getTasks().register(taskPrefix + ".docker")); + lifecyleTasks.put(Type.ARCHIVE, project.getTasks().register(taskPrefix + ".archives")); + lifecyleTasks.put(Type.DEB, project.getTasks().register(taskPrefix + ".packages")); + lifecyleTasks.put(Type.RPM, lifecyleTasks.get(Type.DEB)); + + return lifecyleTasks; + } + private static Jdk createJdk( NamedDomainObjectContainer jdksContainer, String name,