garden
garden copied to clipboard
"Attempted to copy non-file" when a symlink target is a folder
Bug
Building breaks when a module contains a symlink to a folder.
The offending line only checks if the target of a symlink is a file, but doesn't check if it's a folder.
https://github.com/garden-io/garden/blob/893e55b6e4932dda671509248ce2acf513eb8526/core/src/build-staging/helpers.ts#L68
Current Behavior
An error of "Attempted to copy non-file" is raised.
Expected behavior
The build will be successful.
Reproducible example
Projects that contain a symlink to a folder.
Suggested solution(s)
Add a condition that checks if the target is a folder and if so don't raise an error.
Additional context
Your environment
- OS: macOS BigSur 11.3
- How I'm running Kubernetes: Docker Desktop
garden version
0.12.21
Thanks for the detailed report @orarbel. Should be a quick fix on our end.
@edvald, could you confirm that the suggestion makes sense? If that's the case I can fix it on my end.
Yeah I think that does make sense, but I wanna take a quick look to make sure. Lots of little devils in the details in this stuff .)
All right, I'll assign this to you then. Feel free to re-assign.
This issue has been automatically marked as stale because it hasn't had any activity in 90 days. It will be closed in 14 days if no further activity occurs (e.g. changing labels, comments, commits, etc.). Please feel free to tag a maintainer and ask them to remove the label if you think it doesn't apply. Thank you for submitting this issue and helping make Garden a better product!
hi there, any update on this? I found the same issue with one of our projects. We have some symlinks to directories and it fails when building the module.
Thanks.
@jondeandres is this still a problem in 0.13
?
@vvagaytsev hey I can attest this is also a problem for me. In 0.13
this code is still checking only if it symlinks a file not a folder.
This would be fixed if the code was:
if (!sourceStats.isFile() && !sourceStats.isDirectory()) {