fix(deployment): prevent removal of running containers for pull request deployments in case of failure

This commit is contained in:
Andras Bacsai
2025-09-18 11:30:49 +02:00
parent 65a50f2112
commit b34dc11d8e

View File

@@ -2979,8 +2979,8 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
$code = $exception->getCode();
if ($code !== 69420) {
// 69420 means failed to push the image to the registry, so we don't need to remove the new version as it is the currently running one
if ($this->application->settings->is_consistent_container_name_enabled || str($this->application->settings->custom_internal_name)->isNotEmpty()) {
// do not remove already running container
if ($this->application->settings->is_consistent_container_name_enabled || str($this->application->settings->custom_internal_name)->isNotEmpty() || $this->pull_request_id !== 0) {
// do not remove already running container for PR deployments
} else {
$this->application_deployment_queue->addLogEntry('Deployment failed. Removing the new version of your application.', 'stderr');
$this->execute_remote_command(