mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-12 15:53:46 -04:00
fix(compose): report an empty Compose file as empty, not as not found
Closes #12477 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a70e856882
commit
acacbf9747
@@ -0,0 +1,6 @@
|
||||
---
|
||||
type: fixed
|
||||
---
|
||||
Wrong `Docker Compose file not found` error for an empty Compose file ([#12477](https://github.com/coollabsio/coolify/issues/12477))
|
||||
|
||||
- An empty Compose file now gives an error that says that the file is empty
|
||||
@@ -2823,7 +2823,7 @@ class Application extends BaseModel
|
||||
$this->base_directory = $initialBaseDirectory;
|
||||
$this->save();
|
||||
|
||||
throw new RuntimeException("Docker Compose file not found at: $workdir$composeFile (branch: {$this->git_branch})<br><br>Check if you used the right extension (.yaml or .yml) in the compose file name.");
|
||||
throw new RuntimeException("Docker Compose file at $workdir$composeFile (branch: {$this->git_branch}) is empty.<br><br>Check that the file in the repository has content and that your changes are committed and pushed.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,3 +86,21 @@ it('tells the user that a symlinked Compose file is not loaded', function () {
|
||||
->toThrow(RuntimeException::class, 'Docker Compose file at /docker-compose.yml (branch: main) is a symbolic link.');
|
||||
expect($this->application->fresh()->docker_compose_raw)->toBe("services:\n web:\n image: nginx\n");
|
||||
});
|
||||
|
||||
it('tells the user that the Compose file is empty, not that it is missing', function () {
|
||||
fakeComposeLoadServer(null, '');
|
||||
|
||||
expect(fn () => $this->application->loadComposeFile())
|
||||
->toThrow(function (RuntimeException $exception) {
|
||||
expect($exception->getMessage())
|
||||
->toContain('Docker Compose file at /docker-compose.yml (branch: main) is empty.')
|
||||
->not->toContain('not found');
|
||||
});
|
||||
});
|
||||
|
||||
it('tells the user that the Compose file is missing', function () {
|
||||
fakeComposeLoadServer('git ls-tree', 'No such file');
|
||||
|
||||
expect(fn () => $this->application->loadComposeFile())
|
||||
->toThrow(RuntimeException::class, 'Docker Compose file not found at: /docker-compose.yml (branch: main)');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user