Skip to content

YAML Anchors Not Fully Supported Yet #154

@kylhuk

Description

@kylhuk

In regards to issue #58

According to the YAML specifications (https://yaml.org/type/merge.html), the following merge variants are valid:

- # Merge one map
  << : *CENTER

- # Merge multiple maps
  << : [ *CENTER, *BIG ]

Variant number 1 seems to be supported now because of k9withabone/compose_spec_rs#2

However, variant number 2 seems to cause issues.

Error log:

Error: 
   0: error converting compose file
   1: error reading compose file
   2: File `docker-compose.yaml` is not a valid compose file
   3: unknown anchor at line 69 column 11

Location:
   /home/admin/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/podlet-0.3.0/src/cli/compose.rs:203

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: color_eyre::config::EyreHook::into_eyre_hook::{{closure}}::heb83b7ecd99b6378
      at <unknown source file>:<unknown line>
   2: eyre::capture_handler::h2d5f2a58549e90ee
      at <unknown source file>:<unknown line>
   3: eyre::error::<impl eyre::Report>::from_msg::h066738ed4de690b7
      at <unknown source file>:<unknown line>
   4: podlet::cli::compose::Compose::try_into_files::h933401fdb1913013
      at <unknown source file>:<unknown line>
   5: podlet::cli::Cli::try_into_files::h7abb95bd96550b46
      at <unknown source file>:<unknown line>
   6: podlet::cli::Cli::print_or_write_files::h7d2c0f81561e5663
      at <unknown source file>:<unknown line>
   7: podlet::main::h87393c11d805095a
      at <unknown source file>:<unknown line>
   8: std::sys::backtrace::__rust_begin_short_backtrace::hc69a0508aa052acd
      at <unknown source file>:<unknown line>
   9: std::rt::lang_start::{{closure}}::h30a74f0c3d770230
      at <unknown source file>:<unknown line>
  10: std::rt::lang_start_internal::h31bbb7f936fd6b5d
      at <unknown source file>:<unknown line>
  11: main<unknown>
      at <unknown source file>:<unknown line>
  12: __libc_start_main<unknown>
      at <unknown source file>:<unknown line>
  13: _start<unknown>
      at <unknown source file>:<unknown line>

YAML file docker-compose.yaml

x-stdin-tty: &stdin-tty
  stdin_open: true
  tty: true

x-container-default: &container-default
  <<: *stdin-tty
  networks:
    - custom

x-resource-high: &resource-high
  deploy:
    resources:
      limits:
        cpus: '7.0' # Limit to 50% of a CPU
        memory: 12G # Limit to 256 megabytes of RAM
      reservations:
        memory: 5G # Reserve 128 megabytes of RAM

x-dns: &dns
  dns:
    - 192.168.72.1
    - 9.9.9.9

services:
  sonarr:
    container_name: "sonarr"
    <<: [ *x-container-default, *x-resource-high, *x-dns ]
    image: linuxserver/sonarr:latest
    environment:
      - TZ=${TZ} # timezone, defined in .env
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - sonarr:/config # config files
      - lama-nas-tvshows:/tv # tv shows folder
#      - lama-nas-downloads:/downloads # download folder
      - sabnzbd-downloads:/downloads
    ports:
      - 8989:8989

# config for volumes has been omitted as it is not relevant in this case

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions