odo: odo doesn't honor directory .gitignore entries like `/target`

/kind bug

What versions of software are you using?

Operating System: Win 10

Output of odo version: odo v2.0.4 (5544b25ec) Kubernetes: v1.18.3+47c0e71

How did you run odo exactly?

  1. git clone git@github.com:scottkurz/multi-module-devfile.git
  2. mvn install # populate ‘target’ subdirs on host system
  3. odo push -v 7

Actual behavior

You can see ./war/target* , ./ear/target/, ./jar/target/ files get copied into the pod container, both with the odo verbose logging and if you exec into the container.

E.g.:

I0125 21:43:15.735257 12928 sync.go:127] Corrected destinations: base: /projects file: ear/target/test-classes/it/io/openliberty/guides/multimodules I0125 21:43:15.735257 12928 sync.go:121] recursiveTar arguments: srcBase: C:\git, srcFile: multi-mod-dev\ear\target\test-classes\it\io\openliberty\guides\multimodules\IT.class, destBase: /projects, destFile: ear\target\test-classes\it\io\openliberty\guides\multimodules\IT.class I0125 21:43:15.735257 12928 sync.go:127] Corrected destinations: base: /projects file: ear/target/test-classes/it/io/openliberty/guides/multimodules/IT.class I0

Expected behavior

The .gitignore entry of:

target/

should be honored by odo and it should prevent the above files from getting copied into the pod container.

Any logs, error output, etc?

See above.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 27 (21 by maintainers)

Most upvoted comments

Normal behaviour of a target entry in .gitignore is to ignore all directories target, including the nested ones. odo only ignores the /target directory.

odo should use a library similar to https://github.com/monochromegane/go-gitignore to check for file inclusion instead of simple glob matching

OK you mean only filesJunk/. That doesn’t work with odo currently as it uses simple blob matching. We need to check if libraries like https://github.com/monochromegane/go-gitignore can handle such cases or write some logic to handle it ourselves.