Documentation ¶
Index ¶
- Constants
- Variables
- func Arg(ctx context.Context, n int) ast.Node
- func Binding(ctx context.Context) *ast.Binding
- func CheckPrototype(callable interface{}) error
- func DefaultPlatform(ctx context.Context) specs.Platform
- func ExecWithFS(ctx context.Context, cln *client.Client, fs Filesystem, opts Option, ...) error
- func ExecWithSolveErr(ctx context.Context, c gateway.Client, se *solvererrdefs.SolveError, ...) error
- func FramesToSources(frames []Frame) (sources []*errdefs.Source)
- func FramesToSpans(ctx context.Context, frames []Frame) []*diagnostic.SpanError
- func GlobalSolveOpts(ctx context.Context) []solver.SolveOption
- func ImageResolver(ctx context.Context) llb.ImageMetaResolver
- func Module(ctx context.Context) *ast.Module
- func ModuleDir(ctx context.Context) string
- func MultiWriter(ctx context.Context) *solver.MultiWriter
- func NewCachedImageResolver(cln *client.Client) llb.ImageMetaResolver
- func NopWriteCloser(w io.Writer) io.WriteCloser
- func ParseModuleURI(ctx context.Context, cln *client.Client, dir ast.Directory, uri string) (*ast.Module, error)
- func ProgramCounter(ctx context.Context) ast.Node
- func Progress(ctx context.Context) solver.Progress
- func ReflectTo(v Value, t reflect.Type) (reflect.Value, error)
- func ReturnType(ctx context.Context) ast.Kind
- func SessionID(ctx context.Context) string
- func ShlexArgs(args []string, shlex bool) ([]string, error)
- func SourceMap(ctx context.Context) (opts []llb.ConstraintsOpt)
- func SubtestDebuggerBacktrace(t *testing.T, d Debugger)
- func SubtestDebuggerBreakpoint(t *testing.T, d Debugger)
- func SubtestDebuggerEarlyExit(t *testing.T, d Debugger)
- func SubtestDebuggerMovement(t *testing.T, d Debugger)
- func SubtestDebuggerSourceDefinedBreakpoint(t *testing.T, d Debugger)
- func SubtestDebuggerSuite(t *testing.T, factory DebuggerFactory)
- func WithArg(ctx context.Context, n int, arg ast.Node) context.Context
- func WithBacktraceError(ctx context.Context, err error) error
- func WithBinding(ctx context.Context, binding *ast.Binding) context.Context
- func WithCallbackErrgroup(ctx context.Context, g *errgroup.Group) solver.SolveOption
- func WithDebugger(ctx context.Context, dbgr Debugger) context.Context
- func WithDefaultPlatform(ctx context.Context, platform specs.Platform) context.Context
- func WithDockerAPI(ctx context.Context, cln dockerclient.APIClient, auth imagetools.Auth, ...) context.Context
- func WithFrame(ctx context.Context, frame Frame) context.Context
- func WithGlobalSolveOpts(ctx context.Context, opts ...solver.SolveOption) context.Context
- func WithImageResolver(ctx context.Context, resolver llb.ImageMetaResolver) context.Context
- func WithMultiWriter(ctx context.Context, mw *solver.MultiWriter) context.Context
- func WithProgramCounter(ctx context.Context, node ast.Node) context.Context
- func WithProgress(ctx context.Context, p solver.Progress) context.Context
- func WithReturnType(ctx context.Context, kind ast.Kind) context.Context
- func WithSessionID(ctx context.Context, sessionID string) context.Context
- type AllowEmptyWildcard
- type AllowNotFound
- type AllowWildcard
- type Breakpoint
- type Cache
- type Checksum
- type Chmod
- type Chown
- type Cmd
- type CodeGen
- func (cg *CodeGen) EmitBasicLit(ctx context.Context, scope *ast.Scope, lit *ast.BasicLit, ret Register) error
- func (cg *CodeGen) EmitBinding(ctx context.Context, b *ast.Binding, args []Register, ret Register) error
- func (cg *CodeGen) EmitBlock(ctx context.Context, scope *ast.Scope, block *ast.BlockStmt, b *ast.Binding, ...) error
- func (cg *CodeGen) EmitBuiltinDecl(ctx context.Context, scope *ast.Scope, bd *ast.BuiltinDecl, args []Register, ...) (Value, error)
- func (cg *CodeGen) EmitCallExpr(ctx context.Context, scope *ast.Scope, call *ast.CallExpr, ret Register) error
- func (cg *CodeGen) EmitCallStmt(ctx context.Context, scope *ast.Scope, call *ast.CallStmt, b *ast.Binding, ...) error
- func (cg *CodeGen) EmitExpr(ctx context.Context, scope *ast.Scope, expr *ast.Expr, opts Option, ...) error
- func (cg *CodeGen) EmitFuncDecl(ctx context.Context, fd *ast.FuncDecl, args []Register, b *ast.Binding, ...) error
- func (cg *CodeGen) EmitFuncLit(ctx context.Context, scope *ast.Scope, lit *ast.FuncLit, b *ast.Binding, ...) error
- func (cg *CodeGen) EmitHeredoc(ctx context.Context, scope *ast.Scope, heredoc *ast.Heredoc, ret Register) error
- func (cg *CodeGen) EmitIdentExpr(ctx context.Context, scope *ast.Scope, ie *ast.IdentExpr, lookup *ast.Ident, ...) error
- func (cg *CodeGen) EmitImport(ctx context.Context, mod *ast.Module, id *ast.ImportDecl) (*ast.Module, error)
- func (cg *CodeGen) EmitRawHeredoc(ctx context.Context, scope *ast.Scope, heredoc *ast.RawHeredoc, ret Register) error
- func (cg *CodeGen) EmitStringLit(ctx context.Context, scope *ast.Scope, str *ast.StringLit, ret Register) error
- func (cg *CodeGen) Evaluate(ctx context.Context, scope *ast.Scope, call ast.CallNode, b *ast.Binding) []Register
- func (cg *CodeGen) Generate(ctx context.Context, mod *ast.Module, targets []Target) (result solver.Request, err error)
- type ContentsOnly
- type Copy
- type CopyAllowWildcard
- type CreateDestPath
- type CreateParents
- type CreatedTime
- type DebugMode
- type Debugger
- type DebuggerFactory
- type DebuggerOption
- type Diff
- type Dir
- type Direction
- type DockerAPIClient
- type DockerLoad
- type DockerPush
- type Download
- type DownloadDockerTarball
- type DownloadOCITarball
- type DownloadTarball
- type Entrypoint
- type Env
- type ExcludePatterns
- type Expose
- type Filename
- type Filesystem
- type FollowSymlinks
- type Format
- type Forward
- type Frame
- type Frontend
- type FrontendInput
- type FrontendOpt
- type GID
- type Git
- type HTTP
- type Host
- type IgnoreCache
- type IgnoreError
- type Image
- type IncludePatterns
- type IncludeStderr
- type KeepGitDir
- type Label
- type Local
- type LocalArch
- type LocalCwd
- type LocalEnv
- type LocalOS
- type LocalPaths
- type LocalRun
- type LocalRunOption
- type Manifest
- type Merge
- type Mkdir
- type Mkfile
- type Mount
- type MountTarget
- type Network
- type OnlyStderr
- type Option
- type Platform
- type Prototype
- type Readonly
- type ReadonlyRootfs
- type Register
- type Resolve
- type Resolver
- type Rm
- type Run
- type RunDir
- type RunEnv
- type RunUser
- type SSH
- type Scratch
- type Secret
- type Security
- type SetBreakpoint
- type Shlex
- type SourcePath
- type Stage
- type Stargz
- type State
- type StopSignal
- type StringField
- type Target
- type Template
- type TemplateField
- type Tmpfs
- type UID
- type Unpack
- type User
- type UtilChmod
- type UtilChown
- type UtilCreatedTime
- type Value
- type Volumes
Constants ¶
const ( DebugNone = iota DebugStartStop DebugContinue DebugNext DebugRestart DebugStep DebugStepOut DebugTerminate )
const ( // HistoryComment is an indicator in the image history that the history layer // was produced by the HLB compiler. HistoryComment = "hlb.v0" )
const ( // ModuleFilename is the filename of the HLB module expected to be in the // solved filesystem provided to the import declaration. ModuleFilename = "module.hlb" )
Variables ¶
var ( PrototypeIn []reflect.Type PrototypeOut []reflect.Type )
var ( Callables = map[ast.Kind]map[string]interface{}{ ast.Filesystem: { "scratch": Scratch{}, "image": Image{}, "http": HTTP{}, "git": Git{}, "local": Local{}, "frontend": Frontend{}, "run": Run{}, "env": Env{}, "dir": Dir{}, "user": User{}, "mkdir": Mkdir{}, "mkfile": Mkfile{}, "rm": Rm{}, "copy": Copy{}, "merge": Merge{}, "diff": Diff{}, "entrypoint": Entrypoint{}, "cmd": Cmd{}, "label": Label{}, "expose": Expose{}, "volumes": Volumes{}, "stopSignal": StopSignal{}, "dockerPush": DockerPush{}, "dockerLoad": DockerLoad{}, "download": Download{}, "downloadTarball": DownloadTarball{}, "downloadOCITarball": DownloadOCITarball{}, "downloadDockerTarball": DownloadDockerTarball{}, }, ast.String: { "format": Format{}, "template": Template{}, "manifest": Manifest{}, "localArch": LocalArch{}, "localOs": LocalOS{}, "localCwd": LocalCwd{}, "localEnv": LocalEnv{}, "localRun": LocalRun{}, }, ast.Pipeline: { "stage": Stage{}, "parallel": Stage{}, }, "option::image": { "resolve": Resolve{}, "platform": Platform{}, }, "option::http": { "checksum": Checksum{}, "chmod": Chmod{}, "filename": Filename{}, }, "option::git": { "keepGitDir": KeepGitDir{}, }, "option::local": { "includePatterns": IncludePatterns{}, "excludePatterns": ExcludePatterns{}, }, "option::frontend": { "input": FrontendInput{}, "opt": FrontendOpt{}, }, "option::run": { "readonlyRootfs": ReadonlyRootfs{}, "env": RunEnv{}, "dir": RunDir{}, "user": RunUser{}, "ignoreCache": IgnoreCache{}, "network": Network{}, "security": Security{}, "shlex": Shlex{}, "host": Host{}, "ssh": SSH{}, "forward": Forward{}, "secret": Secret{}, "mount": Mount{}, }, "option::ssh": { "target": MountTarget{}, "uid": UID{}, "gid": GID{}, "mode": UtilChmod{}, "localPaths": LocalPaths{}, }, "option::secret": { "uid": UID{}, "gid": GID{}, "mode": UtilChmod{}, "includePatterns": IncludePatterns{}, "excludePatterns": ExcludePatterns{}, }, "option::mount": { "readonly": Readonly{}, "tmpfs": Tmpfs{}, "sourcePath": SourcePath{}, "cache": Cache{}, }, "option::mkdir": { "createParents": CreateParents{}, "chown": Chown{}, "createdTime": CreatedTime{}, }, "option::mkfile": { "chown": Chown{}, "createdTime": CreatedTime{}, }, "option::rm": { "allowNotFound": AllowNotFound{}, "allowWildcard": AllowWildcard{}, }, "option::copy": { "followSymlinks": FollowSymlinks{}, "contentsOnly": ContentsOnly{}, "unpack": Unpack{}, "createDestPath": CreateDestPath{}, "allowWildcard": CopyAllowWildcard{}, "allowEmptyWildcard": AllowEmptyWildcard{}, "chown": UtilChown{}, "chmod": UtilChmod{}, "createdTime": UtilCreatedTime{}, "includePatterns": IncludePatterns{}, "excludePatterns": ExcludePatterns{}, }, "option::localRun": { "ignoreError": IgnoreError{}, "onlyStderr": OnlyStderr{}, "includeStderr": IncludeStderr{}, "shlex": Shlex{}, }, "option::template": { "stringField": StringField{}, }, "option::manifest": { "platform": Platform{}, }, "option::dockerPush": { "stargz": Stargz{}, }, } )
var (
// DefaultFilename is the default filename for a HLB module.
DefaultFilename = "build.hlb"
)
var ( // ErrDebugExit is a special error to early exit from a program. ErrDebugExit = errors.Errorf("exiting debugger") )
Functions ¶
func CheckPrototype ¶
func CheckPrototype(callable interface{}) error
func ExecWithFS ¶
func ExecWithSolveErr ¶
func ExecWithSolveErr(ctx context.Context, c gateway.Client, se *solvererrdefs.SolveError, stdin io.ReadCloser, stdout, stderr io.Writer, args ...string) error
func FramesToSources ¶
func FramesToSpans ¶
func FramesToSpans(ctx context.Context, frames []Frame) []*diagnostic.SpanError
func GlobalSolveOpts ¶
func GlobalSolveOpts(ctx context.Context) []solver.SolveOption
func ImageResolver ¶
func ImageResolver(ctx context.Context) llb.ImageMetaResolver
func MultiWriter ¶
func MultiWriter(ctx context.Context) *solver.MultiWriter
func NewCachedImageResolver ¶
func NewCachedImageResolver(cln *client.Client) llb.ImageMetaResolver
func NopWriteCloser ¶
func NopWriteCloser(w io.Writer) io.WriteCloser
func ParseModuleURI ¶
func ParseModuleURI(ctx context.Context, cln *client.Client, dir ast.Directory, uri string) (*ast.Module, error)
ParseModuleURI returns an ast.Module based on the URI provided. The module may live on the local filesystem or remote depending on the scheme.
func SubtestDebuggerBacktrace ¶
SubtestDebuggerBacktrace tests that the debugger produces correct backtraces.
func SubtestDebuggerBreakpoint ¶
SubtestDebuggerBreakpoint tests that the debugger create and halt at breakpoints.
func SubtestDebuggerEarlyExit ¶
SubtestDebuggerEarlyExit tests that the debugger can exit immediately.
func SubtestDebuggerMovement ¶
SubtestDebuggerMovement tests that the debugger move correctly.
func SubtestDebuggerSourceDefinedBreakpoint ¶
SubtestDebuggerSourceDefinedBreakpoint tests that the debugger can parse source defined breakpoints and halt at them.
func SubtestDebuggerSuite ¶
func SubtestDebuggerSuite(t *testing.T, factory DebuggerFactory)
SubtestDebuggerSuite is a suite of tests for debuggers. This was abstracted to share tests between codegen's native debugger and the DAP server.
func WithCallbackErrgroup ¶
func WithDefaultPlatform ¶
func WithDockerAPI ¶
func WithDockerAPI(ctx context.Context, cln dockerclient.APIClient, auth imagetools.Auth, err error, moby bool) context.Context
func WithGlobalSolveOpts ¶
func WithImageResolver ¶
func WithMultiWriter ¶
func WithProgramCounter ¶
Types ¶
type AllowEmptyWildcard ¶
type AllowEmptyWildcard struct{}
type AllowNotFound ¶
type AllowNotFound struct{}
type AllowWildcard ¶
type AllowWildcard struct{}
type Breakpoint ¶
type Breakpoint struct { ast.Node Index int // Disabled is true if the breakpoint should not halt the program. Disabled bool // SourceDefined is true if the breakpoint is defined by the source. SourceDefined bool }
Breakpoint is an intentional stopping point in a program, put in place by the source or debugger.
func (*Breakpoint) ID ¶
func (bp *Breakpoint) ID() string
type CodeGen ¶
type CodeGen struct {
// contains filtered or unexported fields
}
func (*CodeGen) EmitBasicLit ¶
func (*CodeGen) EmitBinding ¶
func (*CodeGen) EmitBuiltinDecl ¶
func (*CodeGen) EmitCallExpr ¶
func (*CodeGen) EmitCallStmt ¶
func (*CodeGen) EmitFuncDecl ¶
func (*CodeGen) EmitFuncLit ¶
func (*CodeGen) EmitHeredoc ¶
func (*CodeGen) EmitIdentExpr ¶
func (*CodeGen) EmitImport ¶
func (*CodeGen) EmitRawHeredoc ¶
func (*CodeGen) EmitStringLit ¶
type ContentsOnly ¶
type ContentsOnly struct{}
type CopyAllowWildcard ¶
type CopyAllowWildcard struct{}
type CreateDestPath ¶
type CreateDestPath struct{}
type CreateParents ¶
type CreateParents struct{}
type CreatedTime ¶
type CreatedTime struct{}
type Debugger ¶
type Debugger interface { io.Closer // GetState returns the current debugger state. // This call blocks until the debugger has stopped for any reason. GetState() (*State, error) // Restart moves the program back to the start. Restart() (*State, error) // Continue resumes execution. Continue(Direction) (*State, error) // Next continues to the next source line, not entering function calls. Next(Direction) (*State, error) // Step continues to the next source line, entering function calls. Step(Direction) (*State, error) // StepOut continues to the next source line outside the current function. StepOut(Direction) (*State, error) // Backtrace returns all the frames in the current call stack. Backtrace() ([]Frame, error) // Breakpoints gets all breakpoints. Breakpoints() ([]*Breakpoint, error) // CreateBreakpoint creates a new breakpoint. CreateBreakpoint(bp *Breakpoint) (*Breakpoint, error) // ClearBreakpoint deletes a breakpoint. ClearBreakpoint(bp *Breakpoint) error // Terminate sends a signal to end the debugging session. Terminate() error // Exec starts a process in the current debugging state. Exec(ctx context.Context, stdin io.ReadCloser, stdout, stderr io.Writer, args ...string) error }
Debugger is a source-level debugger that provides controls over the program flow and introspection of state.
func GetDebugger ¶
func NewDebugger ¶
func NewDebugger(cln *client.Client, opts ...DebuggerOption) Debugger
NewDebugger returns a headless debugger.
type DebuggerFactory ¶
type DebuggerFactory func() Debugger
DebuggerFactory is a callback that returns a debugger.
type DebuggerOption ¶
type DebuggerOption func(*debugger)
DebuggerOption is optional configuration for the debugger.
func WithInitialMode ¶
func WithInitialMode(mode DebugMode) DebuggerOption
WithInitialMode overrides the initial debug mode that the debugger starts with.
type DockerAPIClient ¶
type DockerAPIClient struct { dockerclient.APIClient Auth imagetools.Auth Moby bool Err error }
func DockerAPI ¶
func DockerAPI(ctx context.Context) DockerAPIClient
type DockerLoad ¶
type DockerLoad struct{}
type DockerPush ¶
type DockerPush struct{}
type DownloadDockerTarball ¶
type DownloadDockerTarball struct{}
type DownloadOCITarball ¶
type DownloadOCITarball struct{}
type DownloadTarball ¶
type DownloadTarball struct{}
type Entrypoint ¶
type Entrypoint struct{}
type ExcludePatterns ¶
type ExcludePatterns struct{}
type Filesystem ¶
type Filesystem struct { State llb.State Image *solver.ImageSpec SolveOpts []solver.SolveOption SessionOpts []llbutil.SessionOption Platform specs.Platform }
type FollowSymlinks ¶
type FollowSymlinks struct{}
type FrontendInput ¶
type FrontendInput struct{}
type FrontendOpt ¶
type FrontendOpt struct{}
type IgnoreCache ¶
type IgnoreCache struct{}
type IgnoreError ¶
type IgnoreError struct{}
type IncludePatterns ¶
type IncludePatterns struct{}
type IncludeStderr ¶
type IncludeStderr struct{}
type KeepGitDir ¶
type KeepGitDir struct{}
type LocalPaths ¶
type LocalPaths struct{}
type LocalRunOption ¶
type MountTarget ¶
type MountTarget struct{}
type OnlyStderr ¶
type OnlyStderr struct{}
type ReadonlyRootfs ¶
type ReadonlyRootfs struct{}
type Register ¶
type Register interface { Value() Value Set(interface{}) error SetAsync(func(Value) (Value, error)) }
func NewRegister ¶
type Resolver ¶
type Resolver interface { // Resolve returns a reader for the HLB module and its compiled LLB. Resolve(ctx context.Context, id *ast.ImportDecl, fs Filesystem) (ast.Directory, error) }
Resolver resolves imports into a reader ready for parsing and checking.
type SetBreakpoint ¶
type SetBreakpoint struct{}
type SourcePath ¶
type SourcePath struct{}
type State ¶
type State struct { Ctx context.Context Scope *ast.Scope Node ast.Node Value Value Options Option StopReason string Err error }
State is a snapshot of the application state when the debugger has halted for any reason.
type StopSignal ¶
type StopSignal struct{}
type StringField ¶
type StringField struct{}
type TemplateField ¶
type TemplateField struct { Name string Value interface{} }
type UtilCreatedTime ¶
type UtilCreatedTime struct{}