mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-20 18:28:03 +08:00
bake: generate implicit groups for matrixes
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
19
bake/bake.go
19
bake/bake.go
@@ -246,13 +246,28 @@ func ParseFiles(files []File, defaults map[string]string) (_ *Config, err error)
|
||||
}
|
||||
|
||||
if len(hclFiles) > 0 {
|
||||
if err := hclparser.Parse(hcl.MergeFiles(hclFiles), hclparser.Opt{
|
||||
renamed, err := hclparser.Parse(hcl.MergeFiles(hclFiles), hclparser.Opt{
|
||||
LookupVar: os.LookupEnv,
|
||||
Vars: defaults,
|
||||
ValidateLabel: validateTargetName,
|
||||
}, &c); err.HasErrors() {
|
||||
}, &c)
|
||||
if err.HasErrors() {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, renamed := range renamed {
|
||||
for oldName, newNames := range renamed {
|
||||
newNames = dedupSlice(newNames)
|
||||
if len(newNames) == 1 && oldName == newNames[0] {
|
||||
continue
|
||||
}
|
||||
c.Groups = append(c.Groups, &Group{
|
||||
Name: oldName,
|
||||
Targets: newNames,
|
||||
})
|
||||
}
|
||||
}
|
||||
c = dedupeConfig(c)
|
||||
}
|
||||
|
||||
return &c, nil
|
||||
|
Reference in New Issue
Block a user