llb

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NetModeSandbox = pb.NetMode_UNSET
	NetModeHost    = pb.NetMode_HOST
	NetModeNone    = pb.NetMode_NONE
)
View Source
const (
	SecurityModeInsecure = pb.SecurityMode_INSECURE
	SecurityModeSandbox  = pb.SecurityMode_SANDBOX
)

Variables

View Source
var (
	LinuxAmd64   = Platform(specs.Platform{OS: "linux", Architecture: "amd64"})
	LinuxArmhf   = Platform(specs.Platform{OS: "linux", Architecture: "arm", Variant: "v7"})
	LinuxArm     = LinuxArmhf
	LinuxArmel   = Platform(specs.Platform{OS: "linux", Architecture: "arm", Variant: "v6"})
	LinuxArm64   = Platform(specs.Platform{OS: "linux", Architecture: "arm64"})
	LinuxS390x   = Platform(specs.Platform{OS: "linux", Architecture: "s390x"})
	LinuxPpc64le = Platform(specs.Platform{OS: "linux", Architecture: "ppc64le"})
	Darwin       = Platform(specs.Platform{OS: "darwin", Architecture: "amd64"})
	Windows      = Platform(specs.Platform{OS: "windows", Architecture: "amd64"})
)
View Source
var IgnoreCache = constraintsOptFunc(func(c *Constraints) {
	c.Metadata.IgnoreCache = true
})
View Source
var MarkImageInternal = imageOptionFunc(func(ii *ImageInfo) {
	ii.RecordType = "internal"
})
View Source
var SSHOptional = sshOptionFunc(func(si *SSHInfo) {
	si.Optional = true
})
View Source
var SecretOptional = secretOptionFunc(func(si *SecretInfo) {
	si.Optional = true
})

Functions

func ForceNoOutput added in v0.6.4

func ForceNoOutput(m *mount)

func MarshalConstraints

func MarshalConstraints(base, override *Constraints) (*pb.Op, *pb.OpMetadata)

func Readonly

func Readonly(m *mount)

func WriteTo

func WriteTo(def *Definition, w io.Writer) error

Types

type CacheMountSharingMode

type CacheMountSharingMode int
const (
	CacheMountShared CacheMountSharingMode = iota
	CacheMountPrivate
	CacheMountLocked
)

type ChownOpt added in v0.6.4

type ChownOpt struct {
	User  *UserOpt
	Group *UserOpt
}

func (ChownOpt) SetCopyOption added in v0.6.4

func (co ChownOpt) SetCopyOption(mi *CopyInfo)

func (ChownOpt) SetMkdirOption added in v0.6.4

func (co ChownOpt) SetMkdirOption(mi *MkdirInfo)

func (ChownOpt) SetMkfileOption added in v0.6.4

func (co ChownOpt) SetMkfileOption(mi *MkfileInfo)

type ChownOption added in v0.6.4

type ChownOption interface {
	MkdirOption
	MkfileOption
	CopyOption
}

func WithUIDGID added in v0.6.4

func WithUIDGID(uid, gid int) ChownOption

func WithUser added in v0.6.4

func WithUser(name string) ChownOption

type Constraints

type Constraints struct {
	Platform          *specs.Platform
	WorkerConstraints []string
	Metadata          pb.OpMetadata
	LocalUniqueID     string
	Caps              *apicaps.CapSet
}

type ConstraintsOpt

type ConstraintsOpt interface {
	SetConstraintsOption(*Constraints)
	RunOption
	LocalOption
	HTTPOption
	ImageOption
	GitOption
}

func LocalUniqueID

func LocalUniqueID(v string) ConstraintsOpt

func Platform

func Platform(p specs.Platform) ConstraintsOpt

func Require

func Require(filters ...string) ConstraintsOpt

func WithCaps

func WithCaps(caps apicaps.CapSet) ConstraintsOpt

WithCaps exposes supported LLB caps to the marshaler

func WithCustomName

func WithCustomName(name string) ConstraintsOpt

func WithCustomNamef added in v0.6.4

func WithCustomNamef(name string, a ...interface{}) ConstraintsOpt

func WithDescription

func WithDescription(m map[string]string) ConstraintsOpt

func WithExportCache

func WithExportCache() ConstraintsOpt

WithExportCache forces results for this vertex to be exported with the cache

func WithoutDefaultExportCache

func WithoutDefaultExportCache() ConstraintsOpt

WithoutDefaultExportCache resets the cache export for the vertex to use the default defined by the build configuration.

func WithoutExportCache

func WithoutExportCache() ConstraintsOpt

WithoutExportCache sets results for this vertex to be not exported with the cache

type CopyInfo added in v0.6.4

type CopyInfo struct {
	Mode                *os.FileMode
	FollowSymlinks      bool
	CopyDirContentsOnly bool
	AttemptUnpack       bool
	CreateDestPath      bool
	AllowWildcard       bool
	AllowEmptyWildcard  bool
	ChownOpt            *ChownOpt
	CreatedTime         *time.Time
}

func (*CopyInfo) SetCopyOption added in v0.6.4

func (mi *CopyInfo) SetCopyOption(mi2 *CopyInfo)

type CopyInput added in v0.6.4

type CopyInput interface {
	// contains filtered or unexported methods
}

CopyInput is either llb.State or *FileActionWithState

type CopyOption added in v0.6.4

type CopyOption interface {
	SetCopyOption(*CopyInfo)
}

type CreatedTime added in v0.6.4

type CreatedTime time.Time

func WithCreatedTime added in v0.6.4

func WithCreatedTime(t time.Time) CreatedTime

func (CreatedTime) SetCopyOption added in v0.6.4

func (c CreatedTime) SetCopyOption(mi *CopyInfo)

func (CreatedTime) SetMkdirOption added in v0.6.4

func (c CreatedTime) SetMkdirOption(mi *MkdirInfo)

func (CreatedTime) SetMkfileOption added in v0.6.4

func (c CreatedTime) SetMkfileOption(mi *MkfileInfo)

type Definition

type Definition struct {
	Def      [][]byte
	Metadata map[digest.Digest]pb.OpMetadata
}

Definition is the LLB definition structure with per-vertex metadata entries Corresponds to the Definition structure defined in solver/pb.Definition.

func ReadFrom

func ReadFrom(r io.Reader) (*Definition, error)

func (*Definition) FromPB

func (def *Definition) FromPB(x *pb.Definition)

func (*Definition) ToPB

func (def *Definition) ToPB() *pb.Definition

type EnvList

type EnvList []KeyValue

func (EnvList) AddOrReplace

func (e EnvList) AddOrReplace(k, v string) EnvList

func (EnvList) Delete

func (e EnvList) Delete(k string) EnvList

func (EnvList) Get

func (e EnvList) Get(k string) (string, bool)

func (EnvList) Index

func (e EnvList) Index(k string) (int, bool)

func (EnvList) SetDefault

func (e EnvList) SetDefault(k, v string) EnvList

func (EnvList) ToArray

func (e EnvList) ToArray() []string

type ExecInfo

type ExecInfo struct {
	State          State
	Mounts         []MountInfo
	ReadonlyRootFS bool
	ProxyEnv       *ProxyEnv
	Secrets        []SecretInfo
	SSH            []SSHInfo
	// contains filtered or unexported fields
}

type ExecOp

type ExecOp struct {
	MarshalCache
	// contains filtered or unexported fields
}

func NewExecOp

func NewExecOp(root Output, meta Meta, readOnly bool, c Constraints) *ExecOp

func (*ExecOp) AddMount

func (e *ExecOp) AddMount(target string, source Output, opt ...MountOption) Output

func (*ExecOp) GetMount

func (e *ExecOp) GetMount(target string) Output

func (*ExecOp) Inputs

func (e *ExecOp) Inputs() (inputs []Output)

func (*ExecOp) Marshal

func (e *ExecOp) Marshal(c *Constraints) (digest.Digest, []byte, *pb.OpMetadata, error)

func (*ExecOp) Output

func (e *ExecOp) Output() Output

func (*ExecOp) Validate

func (e *ExecOp) Validate() error

type ExecState

type ExecState struct {
	State
	// contains filtered or unexported fields
}

func (ExecState) AddMount

func (e ExecState) AddMount(target string, source State, opt ...MountOption) State

func (ExecState) GetMount

func (e ExecState) GetMount(target string) State

func (ExecState) Root

func (e ExecState) Root() State

type FileAction added in v0.6.4

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

func Copy added in v0.6.4

func Copy(input CopyInput, src, dest string, opts ...CopyOption) *FileAction

func Mkdir added in v0.6.4

func Mkdir(p string, m os.FileMode, opt ...MkdirOption) *FileAction

func Mkfile added in v0.6.4

func Mkfile(p string, m os.FileMode, dt []byte, opts ...MkfileOption) *FileAction

func Rm added in v0.6.4

func Rm(p string, opts ...RmOption) *FileAction

func (*FileAction) Copy added in v0.6.4

func (fa *FileAction) Copy(input CopyInput, src, dest string, opt ...CopyOption) *FileAction

func (*FileAction) Mkdir added in v0.6.4

func (fa *FileAction) Mkdir(p string, m os.FileMode, opt ...MkdirOption) *FileAction

func (*FileAction) Mkfile added in v0.6.4

func (fa *FileAction) Mkfile(p string, m os.FileMode, dt []byte, opt ...MkfileOption) *FileAction

func (*FileAction) Rm added in v0.6.4

func (fa *FileAction) Rm(p string, opt ...RmOption) *FileAction

func (*FileAction) WithState added in v0.6.4

func (fa *FileAction) WithState(s State) CopyInput

type FileOp added in v0.6.4

type FileOp struct {
	MarshalCache
	// contains filtered or unexported fields
}

func NewFileOp added in v0.6.4

func NewFileOp(s State, action *FileAction, c Constraints) *FileOp

func (*FileOp) Inputs added in v0.6.4

func (f *FileOp) Inputs() (inputs []Output)

func (*FileOp) Marshal added in v0.6.4

func (f *FileOp) Marshal(c *Constraints) (digest.Digest, []byte, *pb.OpMetadata, error)

func (*FileOp) Output added in v0.6.4

func (f *FileOp) Output() Output

func (*FileOp) Validate added in v0.6.4

func (f *FileOp) Validate() error

type GitInfo

type GitInfo struct {
	KeepGitDir bool
	// contains filtered or unexported fields
}

type GitOption

type GitOption interface {
	SetGitOption(*GitInfo)
}

func KeepGitDir

func KeepGitDir() GitOption

type HTTPInfo

type HTTPInfo struct {
	Checksum digest.Digest
	Filename string
	Perm     int
	UID      int
	GID      int
	// contains filtered or unexported fields
}

type HTTPOption

type HTTPOption interface {
	SetHTTPOption(*HTTPInfo)
}

func Checksum

func Checksum(dgst digest.Digest) HTTPOption

func Chmod

func Chmod(perm os.FileMode) HTTPOption

func Chown

func Chown(uid, gid int) HTTPOption

func Filename

func Filename(name string) HTTPOption

type HostIP

type HostIP struct {
	Host string
	IP   net.IP
}

type ImageInfo

type ImageInfo struct {
	RecordType string
	// contains filtered or unexported fields
}

type ImageMetaResolver

type ImageMetaResolver interface {
	ResolveImageConfig(ctx context.Context, ref string, opt gw.ResolveImageConfigOpt) (digest.Digest, []byte, error)
}

ImageMetaResolver can resolve image config metadata from a reference

type ImageOption

type ImageOption interface {
	SetImageOption(*ImageInfo)
}

func WithMetaResolver

func WithMetaResolver(mr ImageMetaResolver) ImageOption

WithMetaResolver adds a metadata resolver to an image

type KeyValue

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

type LocalInfo

type LocalInfo struct {
	SessionID       string
	IncludePatterns string
	ExcludePatterns string
	FollowPaths     string
	SharedKeyHint   string
	// contains filtered or unexported fields
}

type LocalOption

type LocalOption interface {
	SetLocalOption(*LocalInfo)
}

func ExcludePatterns

func ExcludePatterns(p []string) LocalOption

func FollowPaths

func FollowPaths(p []string) LocalOption

func IncludePatterns

func IncludePatterns(p []string) LocalOption

func SessionID

func SessionID(id string) LocalOption

func SharedKeyHint

func SharedKeyHint(h string) LocalOption

type MarshalCache

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

func (*MarshalCache) Cached

func (mc *MarshalCache) Cached(c *Constraints) bool

func (*MarshalCache) Load

func (mc *MarshalCache) Load() (digest.Digest, []byte, *pb.OpMetadata, error)

func (*MarshalCache) Store

func (mc *MarshalCache) Store(dt []byte, md *pb.OpMetadata, c *Constraints)

type Meta

type Meta struct {
	Args       []string
	Env        EnvList
	Cwd        string
	User       string
	ProxyEnv   *ProxyEnv
	ExtraHosts []HostIP
	Network    pb.NetMode
	Security   pb.SecurityMode
}

type MkdirInfo added in v0.6.4

type MkdirInfo struct {
	MakeParents bool
	ChownOpt    *ChownOpt
	CreatedTime *time.Time
}

func (*MkdirInfo) SetMkdirOption added in v0.6.4

func (mi *MkdirInfo) SetMkdirOption(mi2 *MkdirInfo)

type MkdirOption added in v0.6.4

type MkdirOption interface {
	SetMkdirOption(*MkdirInfo)
}

func WithParents added in v0.6.4

func WithParents(b bool) MkdirOption

type MkfileInfo added in v0.6.4

type MkfileInfo struct {
	ChownOpt    *ChownOpt
	CreatedTime *time.Time
}

func (*MkfileInfo) SetMkfileOption added in v0.6.4

func (mi *MkfileInfo) SetMkfileOption(mi2 *MkfileInfo)

type MkfileOption added in v0.6.4

type MkfileOption interface {
	SetMkfileOption(*MkfileInfo)
}

type MountInfo

type MountInfo struct {
	Target string
	Source Output
	Opts   []MountOption
}

type MountOption

type MountOption func(*mount)

func AsPersistentCacheDir

func AsPersistentCacheDir(id string, sharing CacheMountSharingMode) MountOption

func SourcePath

func SourcePath(src string) MountOption

func Tmpfs

func Tmpfs() MountOption

type Output

type Output interface {
	ToInput(*Constraints) (*pb.Input, error)
	Vertex() Vertex
}

type ProxyEnv

type ProxyEnv struct {
	HttpProxy  string
	HttpsProxy string
	FtpProxy   string
	NoProxy    string
}

type ResolveMode

type ResolveMode int
const (
	ResolveModeDefault ResolveMode = iota
	ResolveModeForcePull
	ResolveModePreferLocal
)

func (ResolveMode) SetImageOption

func (r ResolveMode) SetImageOption(ii *ImageInfo)

func (ResolveMode) String

func (r ResolveMode) String() string

type RmInfo added in v0.6.4

type RmInfo struct {
	AllowNotFound bool
	AllowWildcard bool
}

func (*RmInfo) SetRmOption added in v0.6.4

func (mi *RmInfo) SetRmOption(mi2 *RmInfo)

type RmOption added in v0.6.4

type RmOption interface {
	SetRmOption(*RmInfo)
}

func WithAllowNotFound added in v0.6.4

func WithAllowNotFound(b bool) RmOption

func WithAllowWildcard added in v0.6.4

func WithAllowWildcard(b bool) RmOption

type RunOption

type RunOption interface {
	SetRunOption(es *ExecInfo)
}

func AddEnv

func AddEnv(key, value string) RunOption

func AddEnvf

func AddEnvf(key, value string, v ...interface{}) RunOption

func AddExtraHost

func AddExtraHost(host string, ip net.IP) RunOption

func AddMount

func AddMount(dest string, mountState State, opts ...MountOption) RunOption

func AddSSHSocket

func AddSSHSocket(opts ...SSHOption) RunOption

func AddSecret

func AddSecret(dest string, opts ...SecretOption) RunOption

func Args

func Args(a []string) RunOption

func Dir

func Dir(str string) RunOption

func Dirf

func Dirf(str string, v ...interface{}) RunOption

func Network

func Network(n pb.NetMode) RunOption

func ReadonlyRootFS

func ReadonlyRootFS() RunOption

func Reset

func Reset(s State) RunOption

func Security added in v0.6.4

func Security(s pb.SecurityMode) RunOption

func Shlex

func Shlex(str string) RunOption

func Shlexf

func Shlexf(str string, v ...interface{}) RunOption

func User

func User(str string) RunOption

func With

func With(so ...StateOption) RunOption

func WithProxy

func WithProxy(ps ProxyEnv) RunOption

type SSHInfo

type SSHInfo struct {
	ID       string
	Target   string
	Mode     int
	UID      int
	GID      int
	Optional bool
}

type SSHOption

type SSHOption interface {
	SetSSHOption(*SSHInfo)
}

func SSHID

func SSHID(id string) SSHOption

func SSHSocketOpt

func SSHSocketOpt(target string, uid, gid, mode int) SSHOption

func SSHSocketTarget

func SSHSocketTarget(target string) SSHOption

type SecretInfo

type SecretInfo struct {
	ID       string
	Target   string
	Mode     int
	UID      int
	GID      int
	Optional bool
}

type SecretOption

type SecretOption interface {
	SetSecretOption(*SecretInfo)
}

func SecretFileOpt

func SecretFileOpt(uid, gid, mode int) SecretOption

func SecretID

func SecretID(id string) SecretOption

type SourceOp

type SourceOp struct {
	MarshalCache
	// contains filtered or unexported fields
}

func NewSource

func NewSource(id string, attrs map[string]string, c Constraints) *SourceOp

func (*SourceOp) Inputs

func (s *SourceOp) Inputs() []Output

func (*SourceOp) Marshal

func (s *SourceOp) Marshal(constraints *Constraints) (digest.Digest, []byte, *pb.OpMetadata, error)

func (*SourceOp) Output

func (s *SourceOp) Output() Output

func (*SourceOp) Validate

func (s *SourceOp) Validate() error

type State

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

func Git

func Git(remote, ref string, opts ...GitOption) State

func HTTP

func HTTP(url string, opts ...HTTPOption) State

func Image

func Image(ref string, opts ...ImageOption) State

func Local

func Local(name string, opts ...LocalOption) State

func NewState

func NewState(o Output) State

func Scratch

func Scratch() State

func (State) AddEnv

func (s State) AddEnv(key, value string) State

func (State) AddEnvf

func (s State) AddEnvf(key, value string, v ...interface{}) State

func (State) AddExtraHost

func (s State) AddExtraHost(host string, ip net.IP) State

func (State) Dir

func (s State) Dir(str string) State

func (State) Dirf

func (s State) Dirf(str string, v ...interface{}) State

func (State) Env

func (s State) Env() []string

func (State) File added in v0.6.4

func (s State) File(a *FileAction, opts ...ConstraintsOpt) State

func (State) GetArgs

func (s State) GetArgs() []string

func (State) GetDir

func (s State) GetDir() string

func (State) GetEnv

func (s State) GetEnv(key string) (string, bool)

func (State) GetNetwork

func (s State) GetNetwork() pb.NetMode

func (State) GetPlatform

func (s State) GetPlatform() *specs.Platform

func (State) GetSecurity added in v0.6.4

func (s State) GetSecurity() pb.SecurityMode

func (State) Marshal

func (s State) Marshal(co ...ConstraintsOpt) (*Definition, error)

func (State) Network

func (s State) Network(n pb.NetMode) State

func (State) Output

func (s State) Output() Output

func (State) Platform

func (s State) Platform(p specs.Platform) State

func (State) Reset

func (s State) Reset(s2 State) State

func (State) Run

func (s State) Run(ro ...RunOption) ExecState

func (State) Security added in v0.6.4

func (s State) Security(n pb.SecurityMode) State

func (State) SetMarshalDefaults

func (s State) SetMarshalDefaults(co ...ConstraintsOpt) State

func (State) User

func (s State) User(v string) State

func (State) Validate

func (s State) Validate() error

func (State) Value

func (s State) Value(k interface{}) interface{}

func (State) With

func (s State) With(so ...StateOption) State

func (State) WithImageConfig added in v0.3.2

func (s State) WithImageConfig(c []byte) (State, error)

func (State) WithOutput

func (s State) WithOutput(o Output) State

func (State) WithValue

func (s State) WithValue(k, v interface{}) State

type StateOption

type StateOption func(State) State

type UserOpt added in v0.6.4

type UserOpt struct {
	UID  int
	Name string
}

type Vertex

type Vertex interface {
	Validate() error
	Marshal(*Constraints) (digest.Digest, []byte, *pb.OpMetadata, error)
	Output() Output
	Inputs() []Output
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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