Skip to content

Commit

Permalink
refactor: Improve Docker Compose parsing for services
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasbacsai committed May 31, 2024
1 parent 0445052 commit 94de62e
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions bootstrap/helpers/shared.php
Original file line number Diff line number Diff line change
Expand Up @@ -1375,13 +1375,17 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
if ($pull_request_id !== 0) {
$name = $name . "-pr-$pull_request_id";
$volume = str("$name:$mount");
$topLevelVolumes->put($name, [
'name' => $name,
]);
if (!$topLevelVolumes->has($name)) {
$topLevelVolumes->put($name, [
'name' => $name,
]);
}
} else {
$topLevelVolumes->put($name->value(), [
'name' => $name->value(),
]);
if (!$topLevelVolumes->has($name->value())) {
$topLevelVolumes->put($name->value(), [
'name' => $name->value(),
]);
}
}
}
} else {
Expand Down Expand Up @@ -1425,9 +1429,11 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
data_set($volume, 'source', $source . ':' . $target);
}
if (!str($source)->startsWith('/')) {
$topLevelVolumes->put($source, [
'name' => $source,
]);
if (!$topLevelVolumes->has($source)) {
$topLevelVolumes->put($source, [
'name' => $source,
]);
}
}
}
}
Expand Down

0 comments on commit 94de62e

Please sign in to comment.