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) {
|
if ($pull_request_id !== 0) {
|
||||||
$name = $name . "-pr-$pull_request_id";
|
$name = $name . "-pr-$pull_request_id";
|
||||||
$volume = str("$name:$mount");
|
$volume = str("$name:$mount");
|
||||||
|
if (!$topLevelVolumes->has($name)) {
|
||||||
$topLevelVolumes->put($name, [
|
$topLevelVolumes->put($name, [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (!$topLevelVolumes->has($name->value())) {
|
||||||
$topLevelVolumes->put($name->value(), [
|
$topLevelVolumes->put($name->value(), [
|
||||||
'name' => $name->value(),
|
'name' => $name->value(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($volume->startsWith('/')) {
|
if ($volume->startsWith('/')) {
|
||||||
$name = $volume->before(':');
|
$name = $volume->before(':');
|
||||||
@ -1425,6 +1429,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
data_set($volume, 'source', $source . ':' . $target);
|
data_set($volume, 'source', $source . ':' . $target);
|
||||||
}
|
}
|
||||||
if (!str($source)->startsWith('/')) {
|
if (!str($source)->startsWith('/')) {
|
||||||
|
if (!$topLevelVolumes->has($source)) {
|
||||||
$topLevelVolumes->put($source, [
|
$topLevelVolumes->put($source, [
|
||||||
'name' => $source,
|
'name' => $source,
|
||||||
]);
|
]);
|
||||||
@ -1432,6 +1437,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (is_array($volume)) {
|
if (is_array($volume)) {
|
||||||
return data_get($volume, 'source');
|
return data_get($volume, 'source');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user