Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Error parsing volume source: invalid start character /; AND Error: volume container path is not absolute #99

Open
plicit opened this issue Aug 30, 2024 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@plicit
Copy link

plicit commented Aug 30, 2024

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. :)

@cob-web-corner
Copy link

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

@plicit plicit changed the title Error parsing volume source: invalid start character /; AND Error: volume container path is not absolute [Windows] Error parsing volume source: invalid start character /; AND Error: volume container path is not absolute Sep 8, 2024
@plicit
Copy link
Author

plicit commented Sep 8, 2024

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! :)

@k9withabone
Copy link
Member

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.

@k9withabone k9withabone added bug Something isn't working help wanted Extra attention is needed labels Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants