From 667c8e6432332d4ec8728452a47f368b3dba9e9d Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Wed, 24 Sep 2025 18:19:36 +0200 Subject: [PATCH] fix(deployment-job): enhance build time variable analysis - Introduced logic to filter user-defined build time variables from the database based on the pull request context. - Improved handling of build time variables to ensure only relevant variables are analyzed, enhancing the deployment process. --- app/Jobs/ApplicationDeploymentJob.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index c5ab62136..e10422848 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)) {