mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-24 20:28:02 +08:00
Define variables as blocks with defaults
Signed-off-by: Patrick Van Stee <patrick@vanstee.me>
This commit is contained in:
10
bake/bake.go
10
bake/bake.go
@@ -70,8 +70,9 @@ func ParseFile(fn string) (*Config, error) {
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Groups []*Group `hcl:"group,block"`
|
||||
Targets []*Target `hcl:"target,block"`
|
||||
Variables []*Variable `json:"-" hcl:"variable,block"`
|
||||
Groups []*Group `json:"groups" hcl:"group,block"`
|
||||
Targets []*Target `json:"targets" hcl:"target,block"`
|
||||
}
|
||||
|
||||
func mergeConfig(c1, c2 Config) Config {
|
||||
@@ -316,6 +317,11 @@ func (c Config) target(name string, visited map[string]struct{}, overrides map[s
|
||||
return tt, nil
|
||||
}
|
||||
|
||||
type Variable struct {
|
||||
Name string `json:"-" hcl:"name,label"`
|
||||
Default string `json:"default,omitempty" hcl:"default,optional"`
|
||||
}
|
||||
|
||||
type Group struct {
|
||||
Name string `json:"-" hcl:"name,label"`
|
||||
Targets []string `json:"targets" hcl:"targets"`
|
||||
|
Reference in New Issue
Block a user