package bake

import "github.com/docker/buildx/bake"

Index

Functions

func ListTargets

func ListTargets(files []File) ([]string, error)

func ParseHCLFile

func ParseHCLFile(dt []byte, fn string) (*hcl.File, bool, error)

func ReadRemoteFiles

func ReadRemoteFiles(ctx context.Context, nodes []builder.Node, url string, names []string, pw progress.Writer) ([]File, *Input, error)

func ReadTargets

func ReadTargets(ctx context.Context, files []File, targets, overrides []string, defaults map[string]string) (map[string]*Target, map[string]*Group, error)

func TargetsToBuildOpt

func TargetsToBuildOpt(m map[string]*Target, inp *Input) (map[string]build.Options, error)

Types

type Config

type Config struct {
	Groups  []*Group  `json:"group" hcl:"group,block" cty:"group"`
	Targets []*Target `json:"target" hcl:"target,block" cty:"target"`
}

func ParseCompose

func ParseCompose(cfgs []compose.ConfigFile, envs map[string]string) (*Config, error)

func ParseComposeFiles

func ParseComposeFiles(fs []File) (*Config, error)

func ParseFile

func ParseFile(dt []byte, fn string) (*Config, error)

func ParseFiles

func ParseFiles(files []File, defaults map[string]string) (_ *Config, err error)

func (Config) ResolveGroup

func (c Config) ResolveGroup(name string) ([]string, []string)

func (Config) ResolveTarget

func (c Config) ResolveTarget(name string, overrides map[string]map[string]Override) (*Target, error)

type File

type File struct {
	Name string
	Data []byte
}

func ReadLocalFiles

func ReadLocalFiles(names []string, stdin io.Reader) ([]File, error)

type Group

type Group struct {
	Name    string   `json:"-" hcl:"name,label" cty:"name"`
	Targets []string `json:"targets" hcl:"targets" cty:"targets"`
}

func (*Group) GetEvalContexts

func (g *Group) GetEvalContexts(ectx *hcl.EvalContext, block *hcl.Block, loadDeps func(hcl.Expression) hcl.Diagnostics) ([]*hcl.EvalContext, error)

func (*Group) GetName

func (g *Group) GetName(ectx *hcl.EvalContext, block *hcl.Block, loadDeps func(hcl.Expression) hcl.Diagnostics) (string, error)

type Input

type Input struct {
	State *llb.State
	URL   string
}

type Override

type Override struct {
	Value    string
	ArrValue []string
}

type Target

type Target struct {
	Name string `json:"-" hcl:"name,label" cty:"name"`

	// Inherits is the only field that cannot be overridden with --set
	Attest   []string `json:"attest,omitempty" hcl:"attest,optional" cty:"attest"`
	Inherits []string `json:"inherits,omitempty" hcl:"inherits,optional" cty:"inherits"`

	Context          *string            `json:"context,omitempty" hcl:"context,optional" cty:"context"`
	Contexts         map[string]string  `json:"contexts,omitempty" hcl:"contexts,optional" cty:"contexts"`
	Dockerfile       *string            `json:"dockerfile,omitempty" hcl:"dockerfile,optional" cty:"dockerfile"`
	DockerfileInline *string            `json:"dockerfile-inline,omitempty" hcl:"dockerfile-inline,optional" cty:"dockerfile-inline"`
	Args             map[string]*string `json:"args,omitempty" hcl:"args,optional" cty:"args"`
	Labels           map[string]*string `json:"labels,omitempty" hcl:"labels,optional" cty:"labels"`
	Tags             []string           `json:"tags,omitempty" hcl:"tags,optional" cty:"tags"`
	CacheFrom        []string           `json:"cache-from,omitempty"  hcl:"cache-from,optional" cty:"cache-from"`
	CacheTo          []string           `json:"cache-to,omitempty"  hcl:"cache-to,optional" cty:"cache-to"`
	Target           *string            `json:"target,omitempty" hcl:"target,optional" cty:"target"`
	Secrets          []string           `json:"secret,omitempty" hcl:"secret,optional" cty:"secret"`
	SSH              []string           `json:"ssh,omitempty" hcl:"ssh,optional" cty:"ssh"`
	Platforms        []string           `json:"platforms,omitempty" hcl:"platforms,optional" cty:"platforms"`
	Outputs          []string           `json:"output,omitempty" hcl:"output,optional" cty:"output"`
	Pull             *bool              `json:"pull,omitempty" hcl:"pull,optional" cty:"pull"`
	NoCache          *bool              `json:"no-cache,omitempty" hcl:"no-cache,optional" cty:"no-cache"`
	NetworkMode      *string            `json:"-" hcl:"-" cty:"-"`
	NoCacheFilter    []string           `json:"no-cache-filter,omitempty" hcl:"no-cache-filter,optional" cty:"no-cache-filter"`
	// contains filtered or unexported fields
}

func (*Target) AddOverrides

func (t *Target) AddOverrides(overrides map[string]Override) error

func (*Target) GetEvalContexts

func (t *Target) GetEvalContexts(ectx *hcl.EvalContext, block *hcl.Block, loadDeps func(hcl.Expression) hcl.Diagnostics) ([]*hcl.EvalContext, error)

func (*Target) GetName

func (t *Target) GetName(ectx *hcl.EvalContext, block *hcl.Block, loadDeps func(hcl.Expression) hcl.Diagnostics) (string, error)

func (*Target) Merge

func (t *Target) Merge(t2 *Target)

Source Files

bake.go compose.go hcl.go remote.go

Directories

PathSynopsis
bake/hclparser
Version
v0.11.0
Published
Jun 13, 2023
Platform
js/wasm
Imports
39 packages
Last checked
10 hours ago

Tools for package owners.