Skip to content

fix: match run_watch patterns only against events from their own watched directory - #3329

Open
cvas22 wants to merge 1 commit into
devspace-sh:mainfrom
cvas22:fix/3222-run-watch-pattern-base
Open

cvas22 wants to merge 1 commit into
devspace-sh:mainfrom
cvas22:fix/3222-run-watch-pattern-base

Conversation

@cvas22

@cvas22 cvas22 commented Oct 21, 2026

Copy link
Copy Markdown

What issue type does this pull request address?
/kind bugfix

What does this pull request do? Which issues does it resolve?
resolves #3222

run_watch makes each pattern relative to the directory it is watched in (for example /var/tmp/chart/** becomes ** with /var/tmp/chart as the watched directory). Events from all watched directories were then matched against all patterns, so ** from one path matched every event from the other paths (e.g. everything under . when devspace.yaml is also watched) and restarted the command on unrelated changes.

Each pattern now keeps its base directory, each event carries the base it came from, and only patterns with the same base are matched (matchesPatterns). Exclude handling is unchanged.

Tested with go test ./pkg/devspace/pipeline/engine/basichandler/commands/. The new table test fails if the base check is removed. I did not run the end-to-end run_watch with a real file watcher.

Please provide a short message that should be published in the DevSpace release notes
Fixed an issue where run_watch restarted the command for changes that did not match any of the given --path patterns when several paths were watched.

What else do we need to know?

…hed directory

Patterns are made relative to the directory they are watched in (for
example /var/tmp/chart/** becomes **), but events from every watched
directory were matched against every pattern. A pattern such as ** from
one path therefore matched all events from the other paths and restarted
the command on unrelated changes. Track the base directory per pattern
and per event and only match patterns with the same base.

Resolves devspace-sh#3222

Signed-off-by: Srinivas Chippagiri <[email protected]>
@netlify

netlify Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devspace-docs canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 5b66f05
🔍 Latest deploy log https://app.netlify.com/projects/devspace-docs/deploys/6ad94e2763ab3f63dcd42550

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

run_watch patterns match filesystem events from unrelated watchers after prefix-stripping

1 participant