chore: Update shared.php to fix issues with source and network variables

This commit is contained in:
Andras Bacsai
2024-09-13 11:12:28 +02:00
parent aa4980289d
commit 1738286983

View File

@@ -786,7 +786,7 @@ function replaceLocalSource(Stringable $source, Stringable $replacedWith)
if ($source->startsWith('..')) { if ($source->startsWith('..')) {
$source = $source->replaceFirst('..', $replacedWith->value()); $source = $source->replaceFirst('..', $replacedWith->value());
} }
if ($source->endsWith('/')) { if ($source->endsWith('/') && $source->value() !== '/') {
$source = $source->replaceLast('/', ''); $source = $source->replaceLast('/', '');
} }
@@ -3229,7 +3229,6 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
if ($isApplication && $isPullRequest) { if ($isApplication && $isPullRequest) {
$source = $source."-pr-$pullRequestId"; $source = $source."-pr-$pullRequestId";
} }
LocalFileVolume::updateOrCreate( LocalFileVolume::updateOrCreate(
[ [
'mount_path' => $target, 'mount_path' => $target,
@@ -3548,7 +3547,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
if ($isApplication) { if ($isApplication) {
$shouldGenerateLabelsExactly = $resource->destination->server->settings->generate_exact_labels; $shouldGenerateLabelsExactly = $resource->destination->server->settings->generate_exact_labels;
$uuid = $resource->uuid; $uuid = $resource->uuid;
$network = $resource->destination->network; $network = data_get($resource, 'destination.network');
if ($isPullRequest) { if ($isPullRequest) {
$uuid = "{$resource->uuid}-{$pullRequestId}"; $uuid = "{$resource->uuid}-{$pullRequestId}";
} }
@@ -3558,7 +3557,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
} else { } else {
$shouldGenerateLabelsExactly = $resource->server->settings->generate_exact_labels; $shouldGenerateLabelsExactly = $resource->server->settings->generate_exact_labels;
$uuid = $resource->uuid; $uuid = $resource->uuid;
$network = $resource->destination->network; $network = data_get($resource, 'destination.network');
} }
if ($shouldGenerateLabelsExactly) { if ($shouldGenerateLabelsExactly) {
switch ($server->proxyType()) { switch ($server->proxyType()) {