fix: deleting application should delete preview deployments
This commit is contained in:
		| @@ -9,7 +9,7 @@ class StopApplication | ||||
| { | ||||
|     use AsAction; | ||||
| 
 | ||||
|     public function handle(Application $application) | ||||
|     public function handle(Application $application, bool $previewDeployments = false) | ||||
|     { | ||||
|         if ($application->destination->server->isSwarm()) { | ||||
|             instant_remote_process(["docker stack rm {$application->uuid}"], $application->destination->server); | ||||
| @@ -26,7 +26,12 @@ class StopApplication | ||||
|             if (! $server->isFunctional()) { | ||||
|                 return 'Server is not functional'; | ||||
|             } | ||||
|             if ($previewDeployments) { | ||||
|                 $containers = getCurrentApplicationContainerStatus($server, $application->id, includePullrequests: true); | ||||
|             } else { | ||||
|                 $containers = getCurrentApplicationContainerStatus($server, $application->id, 0); | ||||
|             } | ||||
|             ray($containers); | ||||
|             if ($containers->count() > 0) { | ||||
|                 foreach ($containers as $container) { | ||||
|                     $containerName = data_get($container, 'Names'); | ||||
|   | ||||
| @@ -40,7 +40,7 @@ class DeleteResourceJob implements ShouldBeEncrypted, ShouldQueue | ||||
|             switch ($this->resource->type()) { | ||||
|                 case 'application': | ||||
|                     $persistentStorages = $this->resource?->persistentStorages()?->get(); | ||||
|                     StopApplication::run($this->resource); | ||||
|                     StopApplication::run($this->resource, previewDeployments: true); | ||||
|                     break; | ||||
|                 case 'standalone-postgresql': | ||||
|                 case 'standalone-redis': | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Andras Bacsai
					Andras Bacsai