Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor(deployment): conditionally cleanup build secrets based on Docker BuildKit support and remove redundant calls for improved efficiency

Andras Bacsai8542d33a2dc0
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 497dd160d7..456d63f965 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -355,8 +355,9 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$this->write_deployment_configurations();
}
- // Cleanup build secrets if they were used
- $this->cleanup_build_secrets();
+ if ($this->dockerBuildkitSupported && ! empty($this->build_secrets)) {
+ $this->cleanup_build_secrets();
+ }
$this->application_deployment_queue->addLogEntry("Gracefully shutting down build container: {$this->deployment_uuid}");
$this->graceful_shutdown_container($this->deployment_uuid);
@@ -612,11 +613,6 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
);
}
- // Cleanup build secrets after build completes
- if ($this->dockerBuildkitSupported && ! empty($this->build_secrets)) {
- $this->cleanup_build_secrets();
- }
-
$this->stop_running_container(force: true);
$this->application_deployment_queue->addLogEntry('Starting new application.');
$networkId = $this->application->uuid;
@@ -717,7 +713,6 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$this->generate_build_env_variables();
$this->add_build_env_variables_to_dockerfile();
$this->build_image();
- $this->cleanup_build_secrets();
$this->push_to_docker_registry();
$this->rolling_update();
}
@@ -2288,7 +2283,9 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$this->build_args->push("--build-arg '{$key}'");
});
- $this->build_args = $this->build_args->implode(' ');
+ $this->build_args = $this->build_args instanceof \Illuminate\Support\Collection
+ ? $this->build_args->implode(' ')
+ : (string) $this->build_args;
}
$this->application_deployment_queue->addLogEntry('----------------------------------------');