Skip to content

Merging multiple compose files containing include in wrong order #1300

@Psy-Kai

Description

@Psy-Kai

Describe the bug

If you pass multiple compoe files (multiple -f) the files get merged in the wrong order.

This only happens if the file which includes other files are not at the last position.

To Reproduce

We need a project containing of multiple compose files like

/dev.yml
/dev/db.yml
/foo.yml
# /dev.yml
include:
  - ./dev/db.yml
# /dev/db.yml
services:
  db:
    image: ubuntu
# /foo.yml
services:
  db:
    image: debian

Steps to reproduce the behavior:

  1. call `podman-compose -f dev.yml -f foo.yml config

Expected behavior
The service db should have image: debian.

Actual behavior
The service db should have image: debian.

Additional context

The problem is that includes files are just appended to the list of files. But it should be inserted into the files list after the current processing file!

So the file list looks like

[
  "/dev.yml", # first cmd parameter
  "/foo.yml", # second cmd parameter
  "/dev/db.yml" # the file included in /dev.yml
]

But it should look like

[
  "/dev.yml", # first cmd parameter
  "/dev/db.yml" # the file(s) included in /dev.yml
  "/foo.yml", # next cmd parameter
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions