containers / containers/podman-compose
Incorrect implementation of `include`
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Looking at [compose spec](https://github.com/compose-spec/compose-spec/blob/main/14-include.md) (which `docker-compose` conforms with here), this should be valid:
```
include:
- path: ../commons/compose.yaml
project_directory: ..
env_file: ../another/.env
- path: composefiles/compose2.yaml
project_directory: ./project2
env_file: ./envfiles/project2
```
Yet, this causes a runtime error at https://github.com/containers/podman-compose/blob/daab93b762951d02eaf5ff6a9bf51318c503dede/podman_compose.py#L1835:
```
AttributeError: 'dict' object has no attribute 'strip'
```
Looking at the implementation, only the "short syntax" is supported and attempting use of the long syntax causes a crash.
This also means that it's not possible to make use of [`project_directory`](https://github.com/compose-spec/compose-spec/blob/main/14-include.md#project_directory) or [`env_file`](https://github.com/compose-spec/compose-spec/blob/main/14-include.md#env_file) for includes.
Looking at the current implementation, it also seems that even if this is addressed, it would still not properly merge multiple entries in `env_file` unless the handling of env files is reworked.
**Additional context**
Going back in history, [this was always part of the `include` spec](https://github.com/compose-spec/compose-spec/commit/27008f85ac127e4d91e89bcad8bf7686ffde241f), so podman-compose does not implement an older version here - it's simply incorrect/incomplete?
Related:
- https://github.com/containers/podman-compose/issues/726
- https://github.com/containers/podman-compose/pull/727
- https://github.com/containers/podman-compose/issues/947
- https://github.com/containers/podman-compose/pull/804
- https://github.com/containers/podman-compose/issues/759
- https://github.com/containers/podman-compose/issues/813
- https://github.com/containers/podman-compose/issues/891
- https://github.com/containers/podman-compose/issues/970
Contributor guide
Assessment
This issue has not been assessed yet.