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.

fix(deployment-job): enhance build time variable analysis

Andras Bacsai667c8e643233
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index c5ab621366..e104228482 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -2715,7 +2715,27 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
private function analyzeBuildTimeVariables($variables)
{
- $variablesArray = $variables->toArray();
+ $userDefinedVariables = collect([]);
+
+ $dbVariables = $this->pull_request_id === 0
+ ? $this->application->environment_variables()
+ ->where('is_buildtime', true)
+ ->pluck('key')
+ : $this->application->environment_variables_preview()
+ ->where('is_buildtime', true)
+ ->pluck('key');
+
+ foreach ($variables as $key => $value) {
+ if ($dbVariables->contains($key)) {
+ $userDefinedVariables->put($key, $value);
+ }
+ }
+
+ if ($userDefinedVariables->isEmpty()) {
+ return;
+ }
+
+ $variablesArray = $userDefinedVariables->toArray();
$warnings = self::analyzeBuildVariables($variablesArray);
if (empty($warnings)) {