containers / podlet

Generate Podman Quadlet files from a Podman command, compose file, or existing object
https://crates.io/crates/podlet
Mozilla Public License 2.0
312 stars 10 forks source link

Support for anchors in YAML #58

Open bsv9 opened 5 months ago

bsv9 commented 5 months ago

Hello,

It would be good to add YAML anchors support.

Example

version: '3.4'
services:
  redis: &redis
    image: docker.io/redis:7-alpine
    command:
    - sh
    - -c # this is to evaluate the $REDIS_PASSWORD from the env
    - redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
    env_file: redis.env
    volumes:
    - redis-data:/data
  redis-cache:
    <<: *redis
    env_file: redis-cache.env
    volumes:
    - redis-cache-data:/data

volumes:
  redis-cache-data:
    driver: local
  redis-data:
    driver: local

Error

$ 
Error:
   0: File `docker-compose.yaml` is not a valid compose file
   1: services.redis-cache: unknown attribute "<<", extensions must start with 'x-' (see https://docs.docker.com/compose/compose-file/#extension) at line 15 column 5

Location:
   src/cli/compose.rs:61

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Version

podlet 0.2.4

k9withabone commented 4 months ago

Blocked on #63 and k9withabone/compose_spec_rs#2.