feat: support depends_on
All checks were successful
continuous-integration/drone/push Build is passing

This PR supports the extended pattern of `depends_on`. If the short version of
`depends_on` is defined, it will be migrated to the extended version like the
example below:

```yaml
services:
  web:
    depends_on
    - database

services:
  web:
    depends_on:
      database:
        condition: service_started
```

All three types of merging strategies are supported.
This commit is contained in:
2025-02-24 22:44:11 +01:00
parent 003db26fe5
commit ab282e5173
7 changed files with 211 additions and 90 deletions

View File

@ -8,7 +8,7 @@ import (
"git.cryptic.systems/volker.raschek/dcmerge/pkg/domain/dockerCompose"
"git.cryptic.systems/volker.raschek/dcmerge/pkg/fetcher"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"
)
func Execute(version string) error {
@ -100,10 +100,12 @@ func run(cmd *cobra.Command, args []string) error {
defer f.Close()
yamlEncoder := yaml.NewEncoder(f)
yamlEncoder.SetIndent(0)
return yamlEncoder.Encode(dockerComposeConfig)
default:
yamlEncoder := yaml.NewEncoder(os.Stdout)
yamlEncoder.SetIndent(0)
return yamlEncoder.Encode(dockerComposeConfig)
}