[Bug]: Watch paths do not work
Description
I set watch paths to /packages/mtc-artillery/**, I create a file in that folder. A new deployment is not queued when I push it.
I tried !/packages/mtc-artillery/** !/packages/mtc-artillery and /packages/mtc-artillery
Minimal Reproduction (if possible, example repository)
Repository: mtc-artillery
Exception or Error
No response
Version
v4.0.0-beta.306
Try removing the / infront of the watch paths: packages/mtc-artillery/**
Try removing the / infront of the watch paths: packages/mtc-artillery/**
ahh thank you that fixes it.
but this issue should in my opinion remain open as that slash should work as project root...
Try removing the / infront of the watch paths: packages/mtc-artillery/**
ahh thank you that fixes it.
but this issue should in my opinion remain open as that slash should work as project root...
I believe the way the watch paths work it does a string pattern match on the committed files list received from the webhook (source control) https://github.com/coollabsio/coolify/blob/e9158b7305bb9253fe75a0e76ef34af62f75199b/app/Models/Application.php#L1077-L1090
Also, the watch paths are gitignore styled matched from the root of the repository
A note: You need to escape special characters if you use them within the folder name, i.e. [blog] needs to be escaped \[blog\]
I have a monorepo like this:
someFile.tmp
/apps
/appA
/appB
/packages
/common
/stuff
In the appA I would like an auto deploy if anything changes ignoring what is in /apps/appB/*. And this is not working.
To watch a folder, this is my experience:
/apps/appA # not working
/apps/appA/** # not working
apps/appA/** # working
The problem with watching, is that I want to watch also the root files and /common with appA. That's why ignore would be great.
I tried prefixing with !, but it's not supported.
Maybe this would support it
public function isWatchPathsTriggered(Collection $modified_files): bool
{
if (is_null($this->watch_paths)) {
return false;
}
$watch_paths = collect(explode("\n", $this->watch_paths));
// Separate includes and excludes
$excludes = $watch_paths->filter(fn ($glob) => str_starts_with($glob, '!'))
->map(fn ($glob) => substr($glob, 1)); // Remove '!'
$includes = $watch_paths->reject(fn ($glob) => str_starts_with($glob, '!'));
$matches = $modified_files->filter(function ($file) use ($includes, $excludes) {
// If the file matches any exclusion pattern, ignore it
if ($excludes->contains(fn ($glob) => fnmatch($glob, $file))) {
return false;
}
// Check if the file matches any inclusion pattern
return $includes->contains(fn ($glob) => fnmatch($glob, $file));
});
return $matches->count() > 0;
}
Like this, I would be able to do in my appA:
!apps/appB/**
!packages/stuff/**
Would love to have this 🙏
This will be fixed in the next version.
Negotiate prefixes are working + we parse the paths so it will match the incoming changed_files from Git webhooks (If you set /path/something, but webhook sends path/something, they will match)
I would like to check on my https://app.coolify.io/ but we are still in v4.0.0-beta.428. You know when is the plan to move up?
Thx