graph

package
v0.0.0-...-7280f38 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2020 License: Apache-2.0 Imports: 15 Imported by: 5

Documentation

Index

Constants

View Source
const EnvOverridesPrefix = "BINCASTLE_OVERRIDE_"

Variables

View Source
var SkipDeps = errors.New("skipping deps during walk")
View Source
var StopWalk = errors.New("stopping walk")

Functions

func IsLocalOverride

func IsLocalOverride(m Metadata) bool

func NameOf

func NameOf(m Metadata) string

Types

type AlwaysRun

type AlwaysRun bool

TODO better name?

func (AlwaysRun) ApplyToLayerSpecOpts

func (alwaysRun AlwaysRun) ApplyToLayerSpecOpts(ls LayerSpecOpts) LayerSpecOpts

type AsSpec

type AsSpec interface {
	Spec() Spec
}

func Override

func Override(asSpec, overridee, overrider AsSpec) AsSpec

func Replace

func Replace(asSpec AsSpec, replacee AsSpec, replacer AsSpec) AsSpec

TODO need to doc how Replace is different than Override... Maybe choose some better names too to help?

func Wrap

func Wrap(asSpec AsSpec, wraps ...GraphOpt) AsSpec

type Buildable

type Buildable interface {
	Metadata
	Deps() []AsSpec
	Build([]*Graph) *Graph
}

type BuildableSpec

type BuildableSpec struct {
	Buildable
}

BuildableSpec upgrades a Buildable w/ some generic methods that allow it to satisfy the full Spec interface

func (BuildableSpec) Spec

func (s BuildableSpec) Spec() Spec

func (BuildableSpec) With

func (s BuildableSpec) With(opts ...SpecOpt) Spec

type EnvOverrides

type EnvOverrides struct{}

func (EnvOverrides) ApplyToSpec

func (EnvOverrides) ApplyToSpec(s AsSpec) AsSpec

type Graph

type Graph struct {
	// contains filtered or unexported fields
}

func Build

func Build(asSpec AsSpec) *Graph

TODO docs, creates a transitively reduced graph of layers from the specs, transitive reduction gives consistent, easy-to-understand and minimized result that I think matches most closely what you usually mean when you specify the existence of a dep.

func (*Graph) DumpDot

func (g *Graph) DumpDot(w io.Writer) error

TODO it would probably be better to just expose Walk and have this and similar implementations exist outside Graph directly

func (*Graph) DumpJSON

func (g *Graph) DumpJSON(w io.Writer) error

func (*Graph) MarshalLayers

func (g *Graph) MarshalLayers(ctx context.Context, co ...llb.ConstraintsOpt) ([]MarshalLayer, error)

func (*Graph) Spec

func (g *Graph) Spec() Spec

type GraphOpt

type GraphOpt interface {
	ApplyToGraph(*Graph) *Graph
}

func AppendOutputDir

func AppendOutputDir(dir string) GraphOpt

type GraphOptFunc

type GraphOptFunc func(*Graph) *Graph

func (GraphOptFunc) ApplyToGraph

func (f GraphOptFunc) ApplyToGraph(g *Graph) *Graph

type Image

type Image struct {
	Ref string
}

func (Image) Spec

func (i Image) Spec() Spec

type Layer

type Layer struct {
	Graph
	// contains filtered or unexported fields
}

func (Layer) DumpJSON

func (l Layer) DumpJSON(w io.Writer) error

func (Layer) Metadata

func (l Layer) Metadata(key interface{}) interface{}

type LayerSpecOpt

type LayerSpecOpt interface {
	ApplyToLayerSpecOpts(LayerSpecOpts) LayerSpecOpts
}

func BuildArgs

func BuildArgs(args ...string) LayerSpecOpt

func BuildDep

func BuildDep(asSpec AsSpec) LayerSpecOpt

func BuildEnv

func BuildEnv(k string, v string) LayerSpecOpt

func BuildScratch

func BuildScratch(dest string) LayerSpecOpt

func BuildScript

func BuildScript(lines ...string) LayerSpecOpt

func Dep

func Dep(asSpec AsSpec) LayerSpecOpt

func Env

func Env(k string, v string) LayerSpecOpt

func MergeLayerSpecOpts

func MergeLayerSpecOpts(opts ...LayerSpecOpt) LayerSpecOpt

func Name

func Name(name string) LayerSpecOpt

TODO maybe there should be support for multiple Names?

func RunArgs

func RunArgs(args ...string) LayerSpecOpt

func RunDep

func RunDep(asSpec AsSpec) LayerSpecOpt

func RunEnv

func RunEnv(k string, v string) LayerSpecOpt

func RunScript

func RunScript(lines ...string) LayerSpecOpt

func RunWorkingDir

func RunWorkingDir(dir string) LayerSpecOpt

type LayerSpecOptFunc

type LayerSpecOptFunc func(LayerSpecOpts) LayerSpecOpts

func (LayerSpecOptFunc) ApplyToLayerSpecOpts

func (f LayerSpecOptFunc) ApplyToLayerSpecOpts(ls LayerSpecOpts) LayerSpecOpts

type LayerSpecOpts

type LayerSpecOpts struct {
	BuildDeps     []AsSpec
	BaseState     llb.State
	BuildExecOpts []llb.RunOption

	RunDeps       []AsSpec
	MountDir      string
	OutputDir     string
	RunArgs       []string
	RunEnv        map[string]string
	RunWorkingDir string
	// contains filtered or unexported fields
}

func (LayerSpecOpts) Apply

func (ls LayerSpecOpts) Apply(opts ...LayerSpecOpt) *LayerSpecOpts

func (*LayerSpecOpts) Build

func (ls *LayerSpecOpts) Build(depGraphs []*Graph) *Graph

func (*LayerSpecOpts) Deps

func (ls *LayerSpecOpts) Deps() []AsSpec

func (LayerSpecOpts) Metadata

func (ls LayerSpecOpts) Metadata(key interface{}) interface{}

func (*LayerSpecOpts) SetValue

func (ls *LayerSpecOpts) SetValue(key interface{}, value interface{})

type Local

type Local struct {
	Path       string
	IsOverride bool
}

func (Local) Spec

func (l Local) Spec() Spec

type LocalOverride

type LocalOverride bool

func (LocalOverride) ApplyToLayerSpecOpts

func (o LocalOverride) ApplyToLayerSpecOpts(ls LayerSpecOpts) LayerSpecOpts

type MarshalLayer

type MarshalLayer struct {
	LLB        []byte   `json:"LLB"`
	OutputDir  string   `json:"OutputDir"`
	MountDir   string   `json:"MountDir"`
	Env        []string `json:"Env"`
	Args       []string `json:"Args"`
	WorkingDir string   `json:"WorkingDir"`
	// contains filtered or unexported fields
}

func UnmarshalLayers

func UnmarshalLayers(b []byte) ([]MarshalLayer, error)

type Metadata

type Metadata interface {
	Metadata(interface{}) interface{}
}

type MountDir

type MountDir string

func (MountDir) ApplyToGraph

func (dir MountDir) ApplyToGraph(g *Graph) *Graph

func (MountDir) ApplyToLayerSpecOpts

func (dir MountDir) ApplyToLayerSpecOpts(ls LayerSpecOpts) LayerSpecOpts

type OutputDir

type OutputDir string

func (OutputDir) ApplyToLayerSpecOpts

func (dir OutputDir) ApplyToLayerSpecOpts(ls LayerSpecOpts) LayerSpecOpts

type Spec

type Spec interface {
	Buildable
	AsSpec
	// TODO add AsGraph method that allows this to be converted to a Graph?
	With(opts ...SpecOpt) Spec
}

func LayerSpec

func LayerSpec(opts ...LayerSpecOpt) Spec

func Merge

func Merge(asSpecs ...AsSpec) Spec

type SpecOpt

type SpecOpt interface {
	ApplyToSpec(AsSpec) AsSpec
}

func LocalOverrides

func LocalOverrides(overrides map[string]string) SpecOpt

overrides is a map of layer name -> local path to use instead

func Overridden

func Overridden(overridee, overrider AsSpec) SpecOpt

func Replaced

func Replaced(replacee AsSpec, replacer AsSpec) SpecOpt

func Wrapped

func Wrapped(wraps ...GraphOpt) SpecOpt

type SpecOptFunc

type SpecOptFunc func(AsSpec) AsSpec

func (SpecOptFunc) ApplyToSpec

func (f SpecOptFunc) ApplyToSpec(s AsSpec) AsSpec

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL