@@ -108,10 +108,12 @@ public void apply(Project project) {
108108 TaskProvider <Copy > copyUpgradeTask = configureCopyUpgradeTask (project , upgradeVersion , upgradeDir );
109109 TaskProvider <Copy > copyPluginsTask = configureCopyPluginsTask (project , pluginsDir );
110110
111+ Map <ElasticsearchDistribution .Type , TaskProvider <?>> lifecyleTasks = lifecyleTasks (project , "distructiveDistroTest" );
111112 TaskProvider <Task > destructiveDistroTest = project .getTasks ().register ("destructiveDistroTest" );
112113 for (ElasticsearchDistribution distribution : distributions ) {
113114 TaskProvider <?> destructiveTask = configureDistroTest (project , distribution , dockerSupport );
114115 destructiveDistroTest .configure (t -> t .dependsOn (destructiveTask ));
116+ lifecyleTasks .get (distribution .getType ()).configure (t -> t .dependsOn (destructiveTask ));
115117 }
116118 Map <String , TaskProvider <?>> batsTests = new HashMap <>();
117119 configureBatsTest (project , "plugins" , distributionsDir , copyDistributionsTask , copyPluginsTask ).configure (
@@ -127,6 +129,7 @@ public void apply(Project project) {
127129 List <Object > vmDependencies = new ArrayList <>(configureVM (vmProject ));
128130 vmDependencies .add (project .getConfigurations ().getByName ("testRuntimeClasspath" ));
129131
132+ Map <ElasticsearchDistribution .Type , TaskProvider <?>> vmLifecyleTasks = lifecyleTasks (vmProject , "distroTest" );
130133 TaskProvider <Task > distroTest = vmProject .getTasks ().register ("distroTest" );
131134 for (ElasticsearchDistribution distribution : distributions ) {
132135 String destructiveTaskName = destructiveDistroTestTaskName (distribution );
@@ -141,6 +144,7 @@ public void apply(Project project) {
141144 );
142145 vmTask .configure (t -> t .dependsOn (distribution ));
143146
147+ vmLifecyleTasks .get (distribution .getType ()).configure (t -> t .dependsOn (vmTask ));
144148 distroTest .configure (t -> {
145149 // Only VM sub-projects that are specifically opted-in to testing Docker should
146150 // have the Docker task added as a dependency. Although we control whether Docker
@@ -171,6 +175,17 @@ public void apply(Project project) {
171175 });
172176 }
173177
178+ private static Map <ElasticsearchDistribution .Type , TaskProvider <?>> lifecyleTasks (Project project , String taskPrefix ) {
179+ Map <ElasticsearchDistribution .Type , TaskProvider <?>> lifecyleTasks = new HashMap <>();
180+
181+ lifecyleTasks .put (Type .DOCKER , project .getTasks ().register (taskPrefix + ".docker" ));
182+ lifecyleTasks .put (Type .ARCHIVE , project .getTasks ().register (taskPrefix + ".archives" ));
183+ lifecyleTasks .put (Type .DEB , project .getTasks ().register (taskPrefix + ".packages" ));
184+ lifecyleTasks .put (Type .RPM , lifecyleTasks .get (Type .DEB ));
185+
186+ return lifecyleTasks ;
187+ }
188+
174189 private static Jdk createJdk (
175190 NamedDomainObjectContainer <Jdk > jdksContainer ,
176191 String name ,
0 commit comments