earthly: Windows native path wrongly prepended with Unix root /
I’m using Earthly version v0.6.14 831d37ee160252d612e6c8cbaf8681e8062f8227 windows/amd64; Windows 10 and I’ve got this error:
ongoing | internal (25 seconds ago)
internal | --> 271c67a1-94d9-4241-8bca-cbae334622ae /bin/sh -c cat 'C:\Users\GIANLU~1.MAS\AppData\Local\Temp\earthly-docker-load3121115275/image.tar' | docker load
internal | WARN: (271c67a1-94d9-4241-8bca-cbae334622ae /bin/sh -c cat 'C:\Users\GIANLU~1.MAS\AppData\Local\Temp\earthly-docker-load3121115275/image.tar' | docker load) error calling LocalhostExec: rpc error: code = Unknown desc = mkdir /C:: The filename, directory name, or volume label syntax is incorrect.
Share your logs with an Earthly account (experimental)! Register for one at https://ci.earthly.dev.
Error: build target: build main: failed to solve: mkdir /C:: The filename, directory name, or volume label syntax is incorrect.
It’s marked as internal and I’m not sure where to look for a fix, but in the past a similar issue was due to the fact the code was manipulating the path assuming that an absolute path always start with / that is false in case of Windows OS.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 16 (11 by maintainers)
@MicheleBuselli I strongly recommend to avoid having your build system depends and requires stuff outside the context of your sources. In your case, you are trying to achieve something that in general Docker doesn’t really like. So, I would suggest to analyse why that approach is necessary and think a way to refactor the build process to avoid that.
In the meantime, a workaround to keep going is to use an Earthfile rule like the following:
This achieve:
Of course the drawback is that config.json can get off-sync with the one in $HOME, but if you rarely change it, it may not be a big drawback.
I’ve found an even shorter example that reproduce the issue: