scaffold-workflow and scaffold-gateway fails with error
Description
When /tmp and the destination directory is mounted on a different disk then fails with following error
Expected Behavior Should not fail Actual Behavior
*** Your new workflow can be found here: /home/uva/opensource/clutch/frontend/workflows/amiibo
For information on how to register this new workflow see our configuration guide: https://clutch.sh/docs/configuration
2020/11/26 15:18:51 rename /tmp/clutch-scaffolding-151574568 /home/uva/opensource/clutch/frontend/workflows/amiibo: invalid cross-device link
exit status 1
make: *** [Makefile:142: scaffold-workflow] Error 1
Version
85392760b0538dce8be9830bd4a3c05e265a215d
Other Context OS : ubuntu 20.04 x86_64
Thanks for the report. We are currently using os.Rename which does not work across filesystems.
https://github.com/lyft/clutch/blob/a4f7b7d46ec972be83c1e046feacf232ac763b94/tools/scaffolding/scaffolder.go#L319
The scaffolder is currently zero dep so instead of pulling in a library for this, we'll need to vendor some code or use filepath.Walk and copy the files in the event that the filesystems are not the same.
I made some code to test this - looks like the manual walk way is obviously much slower than os.rename, however that should be fine since it doesn't take that long anyways. The manual walk way just copies each file using io.Copy()
https://pastebin.com/KrQSyrHe
Looks great, feel free to open a PR with the copy code. We can always use copy (in my previous comment I suggested we might only use it if the filesystems are the same). Performance should be fine for the number of files we're dealing with.