An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix(preview): exclude bind mounts from preview deployment suffix
Andras Bacsai5b424f1f0e44
diff --git a/bootstrap/helpers/parsers.php b/bootstrap/helpers/parsers.phpindex e84df55f91..95f5fa9c06 100644--- a/bootstrap/helpers/parsers.php+++ b/bootstrap/helpers/parsers.php@@ -789,9 +789,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int$mainDirectory = str(base_configuration_dir().'/applications/'.$uuid);}$source = replaceLocalSource($source, $mainDirectory);- if ($isPullRequest) {- $source = addPreviewDeploymentSuffix($source, $pull_request_id);- }LocalFileVolume::updateOrCreate(['mount_path' => $target,diff --git a/coolify-examples-1 b/coolify-examples-1new file mode 160000index 0000000000..a5964d89a9--- /dev/null+++ b/coolify-examples-1@@ -0,0 +1 @@+Subproject commit a5964d89a9d361dea373ddabaec265916266c4fcdiff --git a/tests/Unit/PreviewDeploymentBindMountTest.php b/tests/Unit/PreviewDeploymentBindMountTest.phpnew file mode 100644index 0000000000..acc560e685--- /dev/null+++ b/tests/Unit/PreviewDeploymentBindMountTest.php@@ -0,0 +1,41 @@+<?php++/**+ * Tests for GitHub issue #7802: volume mappings from repo content in Preview Deployments.+ *+ * Bind mount volumes (e.g., ./scripts:/scripts:ro) should NOT get a -pr-N suffix+ * during preview deployments, because the repo files exist at the original path.+ * Only named Docker volumes need the suffix for isolation between PRs.+ */+it('does not apply preview deployment suffix to bind mount source paths', function () {+ // Read the applicationParser volume handling in parsers.php+ $parsersFile = file_get_contents(__DIR__.'/../../bootstrap/helpers/parsers.php');++ // Find the bind mount handling block (type === 'bind')+ $bindBlockStart = strpos($parsersFile, "if (\$type->value() === 'bind')");+ $volumeBlockStart = strpos($parsersFile, "} elseif (\$type->value() === 'volume')");+ $bindBlock = substr($parsersFile, $bindBlockStart, $volumeBlockStart - $bindBlockStart);++ // Bind mount paths should NOT be suffixed with -pr-N+ expect($bindBlock)->not->toContain('addPreviewDeploymentSuffix');+});++it('still applies preview deployment suffix to named volume paths', function () {+ // Read the applicationParser volume handling in parsers.php+ $parsersFile = file_get_contents(__DIR__.'/../../bootstrap/helpers/parsers.php');++ // Find the named volume handling block (type === 'volume')+ $volumeBlockStart = strpos($parsersFile, "} elseif (\$type->value() === 'volume')");+ $volumeBlock = substr($parsersFile, $volumeBlockStart, 1000);++ // Named volumes SHOULD still get the -pr-N suffix for isolation+ expect($volumeBlock)->toContain('addPreviewDeploymentSuffix');+});++it('confirms addPreviewDeploymentSuffix works correctly', function () {+ $result = addPreviewDeploymentSuffix('myvolume', 3);+ expect($result)->toBe('myvolume-pr-3');++ $result = addPreviewDeploymentSuffix('myvolume', 0);+ expect($result)->toBe('myvolume');+});