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?
- git clone git@github.com:scottkurz/multi-module-devfile.git
- mvn install # populate ‘target’ subdirs on host system
- 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)
Normal behaviour of a
targetentry in.gitignoreis to ignore all directoriestarget, including the nested ones. odo only ignores the/targetdirectory.odoshould use a library similar tohttps://github.com/monochromegane/go-gitignoreto check for file inclusion instead of simple glob matchingOK you mean only
filesJunk/. That doesn’t work with odo currently as it uses simple blob matching. We need to check if libraries likehttps://github.com/monochromegane/go-gitignorecan handle such cases or write some logic to handle it ourselves.