[Windows] Error parsing volume source: invalid start character `/`; AND Error: volume container path is not absolute
The "volumes" field is not being parsed properly in v0.3.0 (v0.2.4 is ok).
(1) Error parsing volume source: invalid start character /:
$ cat <<'EOF' >docker-compose.yml
version: '3'
services:
busybox-test:
image: busybox
command: ["ash", "-c", "while true; do echo Hello; sleep 2; done"]
volumes:
- /var/run:/var/run
EOF
$ podlet --version
podlet 0.3.0
$ podlet compose docker-compose.yml
Error:
0: error converting compose file
1: error reading compose file
2: File `docker-compose.yml` is not a valid compose file
3: services.busybox-test.volumes[0]: error parsing volume source: error parsing volume identifier: invalid start character `/`, identifiers must start with an ASCII letter (a-z, A-Z) or digit (0-9) at line 7 column 9
Location:
src\cli\compose.rs:203
(2) Error: volume container path ... is not absolute
$ podlet --version
podlet 0.3.0
$ podlet compose compose-example.yaml
Error:
0: error converting compose file
1: error reading compose file
2: File `compose-example.yaml` is not a valid compose file
3: services.caddy.volumes[0]: volume container path `/etc/caddy/Caddyfile` is not absolute at line 9 column 9
Location:
src\cli\compose.rs:203
Your compose-example.yaml also appears to be broken since it starts with name: caddy.
Both tests run fine in v0.2.4, after removing that first line in compose-example.yaml.
Thank you for podlet! I am new to quadlets and your tool helps me learn the basic conversion. :)
Your compose-example.yaml also appears to be broken since it starts with name: caddy.
name: field in the docker-compose.yaml, its required by the generator for this example
ex: docker-compose.yaml
name: namefieldincompose
version: "3"
translates to
# namefieldincompose.kube
[Kube]
Yaml=namefieldincompose-kube.yaml
---
# namefieldincompose-kube.yaml
apiVersion: v1
kind: Pod
metadata:
name: namefieldincompose
in the output after running podlet compose -kube
Thank you for your comment! I looked into it further and you are correct -- compose-example.yaml is a valid docker compose file with the top-level "name" field for the project name:
https://docs.docker.com/compose/project-name/
I was confused because podlet v0.2.4 claims it is "not a valid compose file" due to the top-level project "name" field.
However, I just tested podlet v0.3.0 on Debian and it appears to work correctly, as you indicate. I thought I tested it previously on Linux, but I must have been mistaken.
So it looks like only the volume parsing for the Windows version is broken and I updated the title of this issue to reflect that fact.
Thanks again! :)
I don't have easy access to a Windows machine to test changes on, so someone else will need to work on this. I'm guessing that Path::is_absolute() is being used in compose_spec::service::volumes where it maybe shouldn't be.
I don't have easy access to a Windows machine to test changes on, so someone else will need to work on this. I'm guessing that
Path::is_absolute()is being used incompose_spec::service::volumeswhere it maybe shouldn't be.
~~I'd be happy to assist with testing.~~ I regret to say that I don't seem to be planning to use podlet directly on Windows.