File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ package loader
1919import (
2020 "fmt"
2121 "strconv"
22+ "strings"
2223
2324 "github.com/compose-spec/compose-go/v2/tree"
2425 "gopkg.in/yaml.v3"
@@ -40,6 +41,21 @@ func (p *ResetProcessor) UnmarshalYAML(value *yaml.Node) error {
4041
4142// resolveReset detects `!reset` tag being set on yaml nodes and record position in the yaml tree
4243func (p * ResetProcessor ) resolveReset (node * yaml.Node , path tree.Path ) (* yaml.Node , error ) {
44+ // If the path contains "<<", removing the "<<" element and merging the path
45+ if strings .Contains (path .String (), "<<" ) {
46+ pathArr := strings .Split (path .String (), "." )
47+ path = tree .NewPath (pathArr [0 ])
48+ for _ , el := range pathArr [1 :] {
49+ if el != "<<" {
50+ path = tree .Path (strings .Join ([]string {path .String (), el }, "." ))
51+ }
52+ }
53+ }
54+ // If the node is an alias, We need to process the alias field in order to consider the !override and !reset tags
55+ if node .Kind == yaml .AliasNode {
56+ return p .resolveReset (node .Alias , path )
57+ }
58+
4359 if node .Tag == "!reset" {
4460 p .paths = append (p .paths , path )
4561 return nil , nil
You can’t perform that action at this time.
0 commit comments