refactor: Improve Docker Compose parsing for services
This commit is contained in:
parent
0445052898
commit
94de62e503
@ -1375,15 +1375,19 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
||||
if ($pull_request_id !== 0) {
|
||||
$name = $name . "-pr-$pull_request_id";
|
||||
$volume = str("$name:$mount");
|
||||
if (!$topLevelVolumes->has($name)) {
|
||||
$topLevelVolumes->put($name, [
|
||||
'name' => $name,
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
if (!$topLevelVolumes->has($name->value())) {
|
||||
$topLevelVolumes->put($name->value(), [
|
||||
'name' => $name->value(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($volume->startsWith('/')) {
|
||||
$name = $volume->before(':');
|
||||
@ -1425,6 +1429,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
||||
data_set($volume, 'source', $source . ':' . $target);
|
||||
}
|
||||
if (!str($source)->startsWith('/')) {
|
||||
if (!$topLevelVolumes->has($source)) {
|
||||
$topLevelVolumes->put($source, [
|
||||
'name' => $source,
|
||||
]);
|
||||
@ -1432,6 +1437,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_array($volume)) {
|
||||
return data_get($volume, 'source');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user