fix: properly populating dependencies
This commit is contained in:
parent
24f923e88e
commit
5321a75272
@ -1259,6 +1259,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
$servicePorts = collect(data_get($service, 'ports', []));
|
$servicePorts = collect(data_get($service, 'ports', []));
|
||||||
$serviceNetworks = collect(data_get($service, 'networks', []));
|
$serviceNetworks = collect(data_get($service, 'networks', []));
|
||||||
$serviceVariables = collect(data_get($service, 'environment', []));
|
$serviceVariables = collect(data_get($service, 'environment', []));
|
||||||
|
$serviceDependencies = collect(data_get($service, 'depends_on', []));
|
||||||
$serviceLabels = collect(data_get($service, 'labels', []));
|
$serviceLabels = collect(data_get($service, 'labels', []));
|
||||||
$serviceBuildVariables = collect(data_get($service, 'build.args', []));
|
$serviceBuildVariables = collect(data_get($service, 'build.args', []));
|
||||||
$serviceVariables = $serviceVariables->merge($serviceBuildVariables);
|
$serviceVariables = $serviceVariables->merge($serviceBuildVariables);
|
||||||
@ -1370,6 +1371,13 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
data_set($service, 'volumes', $serviceVolumes->toArray());
|
data_set($service, 'volumes', $serviceVolumes->toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($pull_request_id !== 0 && count($serviceDependencies) > 0) {
|
||||||
|
$serviceDependencies = $serviceDependencies->map(function ($dependency) use ($pull_request_id) {
|
||||||
|
return $dependency . "-pr-$pull_request_id";
|
||||||
|
});
|
||||||
|
data_set($service, 'depends_on', $serviceDependencies->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
// Decide if the service is a database
|
// Decide if the service is a database
|
||||||
$isDatabase = isDatabaseImage(data_get_str($service, 'image'));
|
$isDatabase = isDatabaseImage(data_get_str($service, 'image'));
|
||||||
data_set($service, 'is_database', $isDatabase);
|
data_set($service, 'is_database', $isDatabase);
|
||||||
@ -1665,9 +1673,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
});
|
});
|
||||||
if ($pull_request_id !== 0) {
|
if ($pull_request_id !== 0) {
|
||||||
$services->each(function ($service, $serviceName) use ($pull_request_id, $services) {
|
$services->each(function ($service, $serviceName) use ($pull_request_id, $services) {
|
||||||
$service->depends_on = $service->depends_on->map(function ($dependency) use ($pull_request_id) {
|
|
||||||
return $dependency . "-pr-$pull_request_id";
|
|
||||||
});
|
|
||||||
$services[$serviceName . "-pr-$pull_request_id"] = $service;
|
$services[$serviceName . "-pr-$pull_request_id"] = $service;
|
||||||
data_forget($services, $serviceName);
|
data_forget($services, $serviceName);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user