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.
This commit is contained in:
Andras Bacsai
2025-09-24 18:19:36 +02:00
parent 4ce495d91e
commit 667c8e6432

View File

@@ -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)) {