containers / containers/podlet
YAML Anchors Not Fully Supported Yet
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 48
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 1
Description
In regards to issue #58
According to the YAML specifications (https://yaml.org/type/merge.html), the following merge variants are valid:
```yaml
- # Merge one map
<< : *CENTER
- # Merge multiple maps
<< : [ *CENTER, *BIG ]
```
Variant number 1 seems to be supported now because of https://github.com/k9withabone/compose_spec_rs/issues/2
However, variant number 2 seems to cause issues.
Error log:
```bash
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 :
2: eyre::capture_handler::h2d5f2a58549e90ee
at :
3: eyre::error::::from_msg::h066738ed4de690b7
at :
4: podlet::cli::compose::Compose::try_into_files::h933401fdb1913013
at :
5: podlet::cli::Cli::try_into_files::h7abb95bd96550b46
at :
6: podlet::cli::Cli::print_or_write_files::h7d2c0f81561e5663
at :
7: podlet::main::h87393c11d805095a
at :
8: std::sys::backtrace::__rust_begin_short_backtrace::hc69a0508aa052acd
at :
9: std::rt::lang_start::{{closure}}::h30a74f0c3d770230
at :
10: std::rt::lang_start_internal::h31bbb7f936fd6b5d
at :
11: main
at :
12: __libc_start_main
at :
13: _start
at :
```
YAML file `docker-compose.yaml`
```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
```
Contributor guide
Research direction
Start at src/cli/compose.rs, particularly Compose::try_into_files, where the reported conversion error occurs. Reproduce the failure with the provided docker-compose.yaml and verify that the sequence merge form [*x-container-default, *x-resource-high, *x-dns] is accepted and converted successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100