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:
@@ -2715,7 +2715,27 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
|||||||
|
|
||||||
private function analyzeBuildTimeVariables($variables)
|
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);
|
$warnings = self::analyzeBuildVariables($variablesArray);
|
||||||
|
|
||||||
if (empty($warnings)) {
|
if (empty($warnings)) {
|
||||||
|
Reference in New Issue
Block a user