garden icon indicating copy to clipboard operation
garden copied to clipboard

In watch mode, garden watches files and directories that are excluded in ignorefiles

Open FBurner opened this issue 3 years ago • 5 comments

Bug

Current Behavior

garden deploy tries to watch node modules

UnhandledPromiseRejectionWarning: Error: ENOSPC: System limit for number of file watchers reached, watch '/home/user/orojects/root-config/node_modules/yargs/build/lib/yerror.d.ts'

Expected behavior

Not to watch node_modules since its excluded in gardenignore

.idea
/shared-dependencies/core/.yarn/
/shared-dependencies/core/.yarnrc.yml
node_modules/
.gitignore
.prettierignore
doc

Reproducible example

garden deploy -w

Your environment

  • OS: Ubuntu
  • How I'm running Kubernetes: Digitalocean

garden version 0.12.24

FBurner avatar Aug 15 '21 17:08 FBurner

i now excluded multiple folders and checked every gardenignore

keeps still popping up

Process memory threshold reached. This most likely means there are too many files in the project, and that you need to exclude large dependency directories. Please see https://docs.garden.io/using-garden/configuration-overview#including-excluding-files-and-directories for information on how to do that.

If this keeps occurring after configuring exclusions, please file an issue at https://github.com/garden-io/garden/issues.

*edit

i now added gardenignore to subfolder still no change.

  • edit

in addition the hotreload only worked once after code change after that no codechange triggered the hot reload :/

*edit

after executing garden deploy -w again its stuck for a long time in

Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready" Status of Deployment campaign-frontend is "deploying" Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready" Status of Deployment campaign-frontend is "deploying" Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready" Status of Deployment campaign-frontend is "deploying" Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready" Status of Deployment campaign-frontend is "deploying" Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready" Status of Deployment campaign-frontend is "deploying" Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready" Status of Deployment campaign-frontend is "deploying" Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready" Status of Deployment campaign-frontend is "deploying" Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready" Status of Deployment campaign-frontend is "deploying" Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready" Status of Deployment campaign-frontend is "deploying" Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready" Status of Deployment campaign-frontend is "deploying" Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready" Status of Deployment campaign-frontend is "deploying" Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready" Status of Deployment campaign-frontend is "deploying" Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready" Status of Deployment campaign-frontend is "deploying" Status of Service campaign-frontend is "ready" Status of Ingress campaign-frontend-0 is "ready"

and after that the code changes are not deployed, this is getting a bit frustrating. :/

FBurner avatar Aug 15 '21 18:08 FBurner

kind: Module

type: container

name: campaign-frontend

hotReload:
  sync:
    - target: /app

services:
  - name: campaign-frontend
    ports:
      - name: http
        containerPort: 80
        servicePort: 80
    ingresses:
      - path: /
        hostname: domain.com
        port: http

dockerfile: Dockerfile

after multiple tries "garden deploy -w" still doesnt work anymore and changes arent deployed anymore

  • edit

redeploy now shows Watcher: Watching paths /home/fabian_boerner/PhpstormProjects/breitseite.io Watcher: Starting FSWatcher Waiting for code changes...

after i change a tsx file it does nothing

*edit

now used garden dev changes in my files are still dont recoginized. It says images already build and the old code is deployed....

FBurner avatar Aug 15 '21 19:08 FBurner

Hey @FBurner. Thanks for the detailed report!

This is something that we're working on fixing, as well as improving our docs. In the meantime, you can resolve your issue by adding node_modules to module.exclude[] in your project configuration, e.g.:

kind: Project
...
modules:
  exclude:
    - "node_modules/**/*"

edvald avatar Aug 27 '21 14:08 edvald

Related to #2518

edvald avatar Aug 27 '21 14:08 edvald

The proposed solution by @edvald didn't fix this for me (working on Linux). The following did work:

kind: Project
...
modules:
  exclude:
    - "**/node_modules/**"

It might have something to do with Garden using https://github.com/paulmillr/chokidar and Chokidar using https://github.com/micromatch/anymatch.

From the anymatch documentation (see readme):

anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true

Combined with the fact that Garden is using path.resolve() on the project excludes. And path.resolve() results in an absolute path.

jin-harmoney avatar Apr 01 '22 13:04 jin-harmoney

Might be related with #3605

stefreak avatar Jan 31 '23 11:01 stefreak

Closing this. The watch mode was removed in 0.13.

vvagaytsev avatar Jul 04 '23 11:07 vvagaytsev