Documentation
¶
Overview ¶
Package runtimeexec shares invocation ownership across agent and command steps.
Index ¶
- Constants
- func BuildContainer(cmd *exec.Cmd, policy Policy, options ContainerOptions, ...) ([]string, error)
- func BuildRequest(o LaunchOptions, owner containerapi.Owner, lifetime string) (containerapi.CreateRequest, error)
- func CheckImage(ctx context.Context, policy Policy, bridge bool, ...) error
- func CheckPolicy(ctx context.Context, p Policy) error
- func DefaultGuardianDirectory() string
- func NewID() string
- func PrepareContainer(ctx context.Context, cmd *exec.Cmd, policy Policy, options ContainerOptions) (func(), error)
- func ProbeContext(ctx context.Context) (context.Context, context.CancelFunc)
- func RuntimePath(policy Policy) (string, error)
- func Supervise(ctx context.Context, cmd *exec.Cmd) (func(), error)
- func SupervisePolicy(ctx context.Context, cmd *exec.Cmd, p Policy) (func(), error)
- func WithBinding(ctx context.Context, b Binding) context.Context
- type Binding
- type ContainerOptions
- type ContainerSession
- func (s *ContainerSession) Close() error
- func (s *ContainerSession) Exec(ctx context.Context, q containerapi.ExecRequest, streams containerapi.Streams) (code int, returned error)
- func (s *ContainerSession) Run(ctx context.Context, streams containerapi.Streams) (int, error)
- func (s *ContainerSession) Start(ctx context.Context) (containerapi.Attachment, error)
- type GuardianAsset
- type Invocation
- type Journal
- type LaunchOptions
- type Policy
- type Record
- type StorageError
Constants ¶
const ContainerBridge = "/opt/agent-workflow/bridge/bridge.mjs"
const ContainerGuardian = "/usr/local/bin/agent-workflow-guardian"
const GuardianProtocol = "1"
const MountedGuardian = "/engine-guardian/guardian"
Variables ¶
This section is empty.
Functions ¶
func BuildContainer ¶
func BuildContainer(cmd *exec.Cmd, policy Policy, options ContainerOptions, owner containerapi.Owner, lifetimeDir string) ([]string, error)
BuildContainer contains no effects. It is shared by command and agent roles.
func BuildRequest ¶
func BuildRequest(o LaunchOptions, owner containerapi.Owner, lifetime string) (containerapi.CreateRequest, error)
func CheckImage ¶
func DefaultGuardianDirectory ¶
func DefaultGuardianDirectory() string
func PrepareContainer ¶
func ProbeContext ¶
Probe contexts bound runtime prerequisite checks independently of turn length.
func RuntimePath ¶
func SupervisePolicy ¶
Types ¶
type ContainerOptions ¶
type ContainerSession ¶
type ContainerSession struct {
Runtime containerapi.Runtime
Invocation *Invocation
Owner containerapi.Owner
// contains filtered or unexported fields
}
ContainerSession owns an inert-create/attach/start/wait/remove lifecycle. It is also used by resident job containers. Close verifies absence before returning.
func LaunchContainer ¶
func LaunchContainer(ctx context.Context, o LaunchOptions) (session *ContainerSession, returned error)
func (*ContainerSession) Close ¶
func (s *ContainerSession) Close() error
func (*ContainerSession) Exec ¶
func (s *ContainerSession) Exec(ctx context.Context, q containerapi.ExecRequest, streams containerapi.Streams) (code int, returned error)
Exec journals an identity before starting a command in the resident container. A per-command heartbeat is mounted below the parent's lifetime directory, so cancellation can stop descendants without ending the parent's lifetime.
func (*ContainerSession) Run ¶
func (s *ContainerSession) Run(ctx context.Context, streams containerapi.Streams) (int, error)
func (*ContainerSession) Start ¶
func (s *ContainerSession) Start(ctx context.Context) (containerapi.Attachment, error)
type GuardianAsset ¶
type GuardianAsset struct {
Path string `json:"path"`
SHA256 string `json:"sha256"`
Platform string `json:"platform"`
}
func GuardianFor ¶
func GuardianFor(directory string, image containerapi.Image) (GuardianAsset, error)
GuardianFor selects the Linux workload binary even when the host is macOS. The manifest is part of the release; no download or build occurs at runtime.
func (GuardianAsset) Verify ¶
func (g GuardianAsset) Verify() error
type Invocation ¶
type Invocation struct {
Record Record
// contains filtered or unexported fields
}
func (*Invocation) Directory ¶
func (i *Invocation) Directory() string
func (*Invocation) StartHeartbeat ¶
func (i *Invocation) StartHeartbeat() error
func (*Invocation) StopHeartbeat ¶
func (i *Invocation) StopHeartbeat()
type LaunchOptions ¶
type LaunchOptions struct {
Policy Policy
Selection containerapi.Selection
Image containerapi.Image
Guardian GuardianAsset
Workspace, State, Root string
Command, Env []string
WorkingDir string
Actions string
EngineState string
TaskStateDir string
}
type Policy ¶
type Policy struct {
NetworkRuntime string `yaml:"network-runtime"`
Network *network.Reference `yaml:"-" json:",omitempty"`
NetworkMode string `yaml:"network" json:",omitempty"`
Mode string `yaml:"mode"`
Image string `yaml:"image"`
Runtime string `yaml:"runtime"`
Writable bool `yaml:"writable"`
Cleanup string `yaml:"cleanup"`
UID *int `yaml:"uid"`
GID *int `yaml:"gid"`
}
func PinPolicy ¶
PinPolicy resolves a selection once at admission. A retained reference is checked, never silently refreshed after runtime replacement or resume.
func (Policy) ValidateFor ¶
type Record ¶
type Record struct {
ExecID string `json:"exec_id,omitempty"`
Network *network.Reference `json:"network_runtime,omitempty"`
ID string `json:"id"`
RunID string `json:"run_id"`
Generation int64 `json:"execution_generation"`
LogicalID string `json:"logical_invocation_id"`
Owner string `json:"-"`
Kind string `json:"kind"`
State string `json:"cleanup_state"`
Token string `json:"token"`
CompletionPath string `json:"completion_path"`
Container *containerapi.Owner `json:"container,omitempty"`
StartedAt time.Time `json:"started_at"`
UpdatedAt time.Time `json:"updated_at"`
Error string `json:"error,omitempty"`
}
type StorageError ¶
type StorageError struct {
Err error
}
StorageError identifies a runtime state persistence failure while retaining its diagnostic.
func (*StorageError) Error ¶
func (e *StorageError) Error() string
func (*StorageError) Unwrap ¶
func (e *StorageError) Unwrap() error