bake: add cty tags to hcl structures

Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
Justin Chadwell 2022-11-29 11:59:52 +00:00 committed by Tonis Tiigi
parent 2a6ff4cbfc
commit 7c6b840199
No known key found for this signature in database
GPG Key ID: AFA9DE5F8AB7AF39

View File

@ -270,8 +270,8 @@ func ParseFile(dt []byte, fn string) (*Config, error) {
} }
type Config struct { type Config struct {
Groups []*Group `json:"group" hcl:"group,block"` Groups []*Group `json:"group" hcl:"group,block" cty:"group"`
Targets []*Target `json:"target" hcl:"target,block"` Targets []*Target `json:"target" hcl:"target,block" cty:"target"`
} }
func mergeConfig(c1, c2 Config) Config { func mergeConfig(c1, c2 Config) Config {
@ -547,36 +547,36 @@ func (c Config) target(name string, visited map[string]*Target, overrides map[st
} }
type Group struct { type Group struct {
Name string `json:"-" hcl:"name,label"` Name string `json:"-" hcl:"name,label" cty:"name"`
Targets []string `json:"targets" hcl:"targets"` Targets []string `json:"targets" hcl:"targets" cty:"targets"`
// Target // TODO? // Target // TODO?
} }
type Target struct { type Target struct {
Name string `json:"-" hcl:"name,label"` Name string `json:"-" hcl:"name,label" cty:"name"`
// Inherits is the only field that cannot be overridden with --set // Inherits is the only field that cannot be overridden with --set
Inherits []string `json:"inherits,omitempty" hcl:"inherits,optional"` Attest []string `json:"attest,omitempty" hcl:"attest,optional" cty:"attest"`
Inherits []string `json:"inherits,omitempty" hcl:"inherits,optional" cty:"inherits"`
Attest []string `json:"attest,omitempty" hcl:"attest,optional"` Context *string `json:"context,omitempty" hcl:"context,optional" cty:"context"`
Context *string `json:"context,omitempty" hcl:"context,optional"` Contexts map[string]string `json:"contexts,omitempty" hcl:"contexts,optional" cty:"contexts"`
Contexts map[string]string `json:"contexts,omitempty" hcl:"contexts,optional"` Dockerfile *string `json:"dockerfile,omitempty" hcl:"dockerfile,optional" cty:"dockerfile"`
Dockerfile *string `json:"dockerfile,omitempty" hcl:"dockerfile,optional"` DockerfileInline *string `json:"dockerfile-inline,omitempty" hcl:"dockerfile-inline,optional" cty:"dockerfile-inline"`
DockerfileInline *string `json:"dockerfile-inline,omitempty" hcl:"dockerfile-inline,optional"` Args map[string]string `json:"args,omitempty" hcl:"args,optional" cty:"args"`
Args map[string]string `json:"args,omitempty" hcl:"args,optional"` Labels map[string]string `json:"labels,omitempty" hcl:"labels,optional" cty:"labels"`
Labels map[string]string `json:"labels,omitempty" hcl:"labels,optional"` Tags []string `json:"tags,omitempty" hcl:"tags,optional" cty:"tags"`
Tags []string `json:"tags,omitempty" hcl:"tags,optional"` CacheFrom []string `json:"cache-from,omitempty" hcl:"cache-from,optional" cty:"cache-from"`
CacheFrom []string `json:"cache-from,omitempty" hcl:"cache-from,optional"` CacheTo []string `json:"cache-to,omitempty" hcl:"cache-to,optional" cty:"cache-to"`
CacheTo []string `json:"cache-to,omitempty" hcl:"cache-to,optional"` Target *string `json:"target,omitempty" hcl:"target,optional" cty:"target"`
Target *string `json:"target,omitempty" hcl:"target,optional"` Secrets []string `json:"secret,omitempty" hcl:"secret,optional" cty:"secret"`
Secrets []string `json:"secret,omitempty" hcl:"secret,optional"` SSH []string `json:"ssh,omitempty" hcl:"ssh,optional" cty:"ssh"`
SSH []string `json:"ssh,omitempty" hcl:"ssh,optional"` Platforms []string `json:"platforms,omitempty" hcl:"platforms,optional" cty:"platforms"`
Platforms []string `json:"platforms,omitempty" hcl:"platforms,optional"` Outputs []string `json:"output,omitempty" hcl:"output,optional" cty:"output"`
Outputs []string `json:"output,omitempty" hcl:"output,optional"` Pull *bool `json:"pull,omitempty" hcl:"pull,optional" cty:"pull"`
Pull *bool `json:"pull,omitempty" hcl:"pull,optional"` NoCache *bool `json:"no-cache,omitempty" hcl:"no-cache,optional" cty:"no-cache"`
NoCache *bool `json:"no-cache,omitempty" hcl:"no-cache,optional"` NetworkMode *string `json:"-" hcl:"-" cty:"-"`
NetworkMode *string `json:"-" hcl:"-"` NoCacheFilter []string `json:"no-cache-filter,omitempty" hcl:"no-cache-filter,optional" cty:"no-cache-filter"`
NoCacheFilter []string `json:"no-cache-filter,omitempty" hcl:"no-cache-filter,optional"`
// IMPORTANT: if you add more fields here, do not forget to update newOverrides and docs/manuals/bake/file-definition.md. // IMPORTANT: if you add more fields here, do not forget to update newOverrides and docs/manuals/bake/file-definition.md.
// linked is a private field to mark a target used as a linked one // linked is a private field to mark a target used as a linked one