Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithExecutionInfo(ctx context.Context, execInfo *ExecutionInfo) context.Context
- func CreateEnv(key, value string) string
- func EnvSliceToString(env []string) string
- func SetEnvDumpCommand(cmd string)
- func SetWinsize(cmd Command, winsize *Winsize) (err error)
- type Command
- type CommandOptions
- type EnvDecryptor
- type EnvEncryptor
- type EnvProducer
- type ExecutionInfo
- type Factory
- type FactoryOption
- type ProgramConfig
- type ProgramResolver
- type ProgramResolverMode
- type ProgramResolverResult
- type ProgramResolverSource
- type ProgramResolverStatus
- type ProgramResolverVarResult
- type Runtime
- type Session
- type SessionList
- type Winsize
Constants ¶
const ( MaxEnvSizeInBytes = 128*1024 - 128 MaxEnvironSizeInBytes = MaxEnvSizeInBytes * 8 )
const SessionListCapacity = 1024
SessionListCapacity is a maximum number of sessions stored in a single SessionList.
const StoreStdoutEnvName = "__"
Variables ¶
var ErrEnvTooLarge = errors.New("env too large")
var ExecutionInfoKey = &runnerContextKey{}
Functions ¶
func ContextWithExecutionInfo ¶ added in v3.5.0
func ContextWithExecutionInfo(ctx context.Context, execInfo *ExecutionInfo) context.Context
func EnvSliceToString ¶ added in v3.5.0
func SetEnvDumpCommand ¶ added in v3.5.0
func SetEnvDumpCommand(cmd string)
func SetWinsize ¶
Types ¶
type CommandOptions ¶ added in v3.3.3
type CommandOptions struct { // EnableEcho enables the echo when typing in the terminal. // It's respected only by interactive commands, i.e. composed // with [virtualCommand]. EnableEcho bool // Session is used to share the state between commands. // If none is provided, an empty one will be used. Session *Session // StdinWriter is used by [terminalCommand]. StdinWriter io.Writer Stdin io.Reader Stdout io.Writer Stderr io.Writer }
type EnvDecryptor ¶ added in v3.5.0
type EnvDecryptor struct {
// contains filtered or unexported fields
}
func NewEnvDecryptor ¶ added in v3.5.0
type EnvEncryptor ¶ added in v3.5.0
type EnvEncryptor struct {
// contains filtered or unexported fields
}
func NewEnvEncryptor ¶ added in v3.5.0
type EnvProducer ¶ added in v3.5.0
type EnvProducer struct {
// contains filtered or unexported fields
}
func NewEnvProducerFromEnv ¶ added in v3.5.0
func NewEnvProducerFromEnv() (*EnvProducer, error)
type ExecutionInfo ¶ added in v3.5.0
type Factory ¶ added in v3.3.1
type Factory interface {
Build(*ProgramConfig, CommandOptions) (Command, error)
}
func NewFactory ¶ added in v3.3.1
func NewFactory(opts ...FactoryOption) Factory
type FactoryOption ¶ added in v3.3.3
type FactoryOption func(*commandFactory)
func WithDebug ¶ added in v3.5.0
func WithDebug() FactoryOption
WithDebug enables additional debug information. For example, for shell commands it prints out commands before execution.
func WithDocker ¶ added in v3.3.3
func WithDocker(docker *dockerexec.Docker) FactoryOption
WithDocker provides a docker client for docker commands.
func WithLogger ¶ added in v3.3.3
func WithLogger(logger *zap.Logger) FactoryOption
func WithProject ¶ added in v3.3.3
func WithProject(proj *project.Project) FactoryOption
func WithRuntime ¶ added in v3.7.1
func WithRuntime(r Runtime) FactoryOption
type ProgramConfig ¶ added in v3.3.1
type ProgramConfig = runnerv2.ProgramConfig
ProgramConfig contains a serializable configuration for a command. It's agnostic to the runtime or particular execution settings.
func NewProgramConfigFromCodeBlock ¶ added in v3.3.1
func NewProgramConfigFromCodeBlock(block *document.CodeBlock) (*ProgramConfig, error)
type ProgramResolver ¶
type ProgramResolver struct {
// contains filtered or unexported fields
}
ProgramResolver uses a list of ProgramResolverSource to resolve environment variables found in a shell program.
func NewProgramResolver ¶
func NewProgramResolver(mode ProgramResolverMode, sensitiveEnvNames []string, sources ...ProgramResolverSource) *ProgramResolver
func (*ProgramResolver) IsEnvSensitive ¶ added in v3.2.2
func (r *ProgramResolver) IsEnvSensitive(name string) bool
func (*ProgramResolver) Resolve ¶
func (r *ProgramResolver) Resolve(reader io.Reader, writer io.Writer) (*ProgramResolverResult, error)
Resolve resolves the environment variables found in a shell program. It might modify the program and write it provided writer.
type ProgramResolverMode ¶
type ProgramResolverMode uint8
const ( // ProgramResolverModeAuto is a default which prompts for all unresolved variables. ProgramResolverModeAuto ProgramResolverMode = iota // ProgramResolverModePromptAll always prompts even if variables are resolved. ProgramResolverModePromptAll // ProgramResolverModeSkipAll does not prompt even if variables are unresolved. // All variables will be marked as resolved. ProgramResolverModeSkipAll )
type ProgramResolverResult ¶
type ProgramResolverResult struct { Variables []ProgramResolverVarResult ModifiedProgram bool }
type ProgramResolverSource ¶
type ProgramResolverSource func() []string
func ProgramResolverSourceFunc ¶
func ProgramResolverSourceFunc(env []string) ProgramResolverSource
type ProgramResolverStatus ¶
type ProgramResolverStatus uint8
const ( // ProgramResolverStatusUnresolved indicates a variable is unresolved. ProgramResolverStatusUnresolved ProgramResolverStatus = iota // ProgramResolverStatusUnresolvedWithMessage indicates a variable is unresolved but it has a message. // It typically means that the variable is of form `export FOO=this is a message`. ProgramResolverStatusUnresolvedWithMessage // ProgramResolverStatusUnresolvedWithPlaceholder indicates a variable is unresolved but it has a placeholder. // It typically means that the variable is of form `export FOO="this is a placeholder"`. ProgramResolverStatusUnresolvedWithPlaceholder // ProgramResolverStatusUnresolvedWithSecret indicates a variable is unresolved and needs to be treated with sensitivity. // It typically means that the variable is a password, certificate, or access key. ProgramResolverStatusUnresolvedWithSecret // ProgramResolverStatusResolved indicates a variable is resolved. ProgramResolverStatusResolved )
type ProgramResolverVarResult ¶
type ProgramResolverVarResult struct { // Status indicates the status of the result. Status ProgramResolverStatus // Name is the name of the variable. // It is set always. Name string // OriginalValue is the original value of the variable. // It's either a placeholder (`export FOO="this is a placeholder"`) or // a message (`export FOO=this is a message`). OriginalValue string // Value is the resolved value of the variable. // It is set only if Status is ProgramResolverStatusResolved. Value string }
type Session ¶
type Session struct { ID string // contains filtered or unexported fields }
Session is an object which lifespan contains multiple executions. It's used to exchange information between executions. Currently, it only keeps track of environment variables.
func NewSession ¶
func NewSession() *Session
type SessionList ¶
type SessionList struct {
// contains filtered or unexported fields
}
func NewSessionList ¶
func NewSessionList() (*SessionList, error)
func (*SessionList) Add ¶
func (sl *SessionList) Add(session *Session)
func (*SessionList) Delete ¶
func (sl *SessionList) Delete(id string) bool
func (*SessionList) List ¶
func (sl *SessionList) List() []*Session
func (*SessionList) Newest ¶
func (sl *SessionList) Newest() (*Session, bool)
Source Files ¶
- bulk_writer.go
- command.go
- command_docker.go
- command_file.go
- command_inline.go
- command_inline_shell.go
- command_native.go
- command_terminal.go
- command_unix.go
- command_virtual.go
- config.go
- config_code_block.go
- env_collector.go
- env_collector_factory.go
- env_collector_fifo_unix.go
- env_collector_file.go
- env_crypto.go
- env_producer.go
- env_shell.go
- env_store.go
- exec_info.go
- factory.go
- program_resolver.go
- runtime.go
- session.go