Documentation
¶
Index ¶
- Constants
- Variables
- func AddFactories(b bus.Bus, sr *static.Resolver)
- type Config
- func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Config) CloneVT() *Config
- func (this *Config) EqualMessageVT(thatMsg any) bool
- func (this *Config) EqualVT(that *Config) bool
- func (c *Config) EqualsConfig(other config.Config) bool
- func (x *Config) GetCommand() []string
- func (c *Config) GetConfigID() string
- func (x *Config) GetDockerEnv() map[string]string
- func (x *Config) GetDockerPath() string
- func (x *Config) GetEnv() map[string]string
- func (x *Config) GetImage() string
- func (x *Config) GetMounts() []*Mount
- func (x *Config) GetStopTimeoutSeconds() uint32
- func (x *Config) GetWorkdir() string
- func (c *Config) MarshalBlock() ([]byte, error)
- func (x *Config) MarshalJSON() ([]byte, error)
- func (x *Config) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config) MarshalProtoText() string
- func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Config) MarshalToVT(dAtA []byte) (int, error)
- func (m *Config) MarshalVT() (dAtA []byte, err error)
- func (*Config) ProtoMessage()
- func (x *Config) Reset()
- func (m *Config) SizeVT() (n int)
- func (x *Config) String() string
- func (c *Config) UnmarshalBlock(data []byte) error
- func (x *Config) UnmarshalJSON(b []byte) error
- func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Config) UnmarshalVT(dAtA []byte) error
- func (c *Config) Validate() error
- type Config_DockerEnvEntry
- func (x *Config_DockerEnvEntry) GetKey() string
- func (x *Config_DockerEnvEntry) GetValue() string
- func (x *Config_DockerEnvEntry) MarshalJSON() ([]byte, error)
- func (x *Config_DockerEnvEntry) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config_DockerEnvEntry) MarshalProtoText() string
- func (*Config_DockerEnvEntry) ProtoMessage()
- func (x *Config_DockerEnvEntry) Reset()
- func (x *Config_DockerEnvEntry) String() string
- func (x *Config_DockerEnvEntry) UnmarshalJSON(b []byte) error
- func (x *Config_DockerEnvEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
- type Config_EnvEntry
- func (x *Config_EnvEntry) GetKey() string
- func (x *Config_EnvEntry) GetValue() string
- func (x *Config_EnvEntry) MarshalJSON() ([]byte, error)
- func (x *Config_EnvEntry) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config_EnvEntry) MarshalProtoText() string
- func (*Config_EnvEntry) ProtoMessage()
- func (x *Config_EnvEntry) Reset()
- func (x *Config_EnvEntry) String() string
- func (x *Config_EnvEntry) UnmarshalJSON(b []byte) error
- func (x *Config_EnvEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
- type Controller
- func (c *Controller) Close() error
- func (c *Controller) Execute(ctx context.Context) error
- func (c *Controller) GetControllerInfo() *controller.Info
- func (c *Controller) HandleDirective(ctx context.Context, inst directive.Instance) ([]directive.Resolver, error)
- func (c *Controller) InitForgeExecController(ctx context.Context, inputVals forge_target.InputMap, ...) error
- type DockerRunner
- type ExecDockerRunner
- type Factory
- func (t *Factory) Construct(ctx context.Context, conf config.Config, opts controller.ConstructOpts) (controller.Controller, error)
- func (t *Factory) ConstructConfig() config.Config
- func (t *Factory) GetConfigID() string
- func (t *Factory) GetControllerID() string
- func (t *Factory) GetVersion() controller.Version
- type Mount
- func (m *Mount) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Mount) CloneVT() *Mount
- func (this *Mount) EqualMessageVT(thatMsg any) bool
- func (this *Mount) EqualVT(that *Mount) bool
- func (x *Mount) GetContainerPath() string
- func (x *Mount) GetHostPath() string
- func (x *Mount) GetReadOnly() bool
- func (x *Mount) MarshalJSON() ([]byte, error)
- func (x *Mount) MarshalProtoJSON(s *json.MarshalState)
- func (x *Mount) MarshalProtoText() string
- func (m *Mount) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Mount) MarshalToVT(dAtA []byte) (int, error)
- func (m *Mount) MarshalVT() (dAtA []byte, err error)
- func (*Mount) ProtoMessage()
- func (x *Mount) Reset()
- func (m *Mount) SizeVT() (n int)
- func (x *Mount) String() string
- func (x *Mount) UnmarshalJSON(b []byte) error
- func (x *Mount) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Mount) UnmarshalVT(dAtA []byte) error
Constants ¶
const ConfigID = ControllerID
ConfigID is the string used to identify this config object.
const ControllerID = "forge/lib/docker"
ControllerID is the ID of the controller.
Variables ¶
var Version = controller.MustParseVersion("0.0.1")
Version is the version of the controller implementation.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// DockerPath is the docker CLI executable path.
// Defaults to "docker" when empty.
DockerPath string `protobuf:"bytes,1,opt,name=docker_path,json=dockerPath,proto3" json:"dockerPath,omitempty"`
// DockerEnv is the explicit environment for the docker CLI subprocess.
// No host environment is inherited unless configured here.
DockerEnv map[string]string `` /* 175-byte string literal not displayed */
// Image is the container image to create.
Image string `protobuf:"bytes,3,opt,name=image,proto3" json:"image,omitempty"`
// Workdir is the container working directory.
Workdir string `protobuf:"bytes,4,opt,name=workdir,proto3" json:"workdir,omitempty"`
// Env is the explicit environment passed to the container.
// No host environment is inherited.
Env map[string]string `` /* 147-byte string literal not displayed */
// Mounts is the ordered list of bind mounts passed to docker create.
Mounts []*Mount `protobuf:"bytes,6,rep,name=mounts,proto3" json:"mounts,omitempty"`
// Command is appended after the image as the container command.
Command []string `protobuf:"bytes,7,rep,name=command,proto3" json:"command,omitempty"`
// StopTimeoutSeconds is passed to docker stop when cancellation stops a
// container. Docker's default stop timeout is used when zero.
StopTimeoutSeconds uint32 `protobuf:"varint,8,opt,name=stop_timeout_seconds,json=stopTimeoutSeconds,proto3" json:"stopTimeoutSeconds,omitempty"`
// contains filtered or unexported fields
}
Config configures the docker CLI exec controller. Creates one container, starts it, waits for completion, and stops it on execution cancellation.
func (*Config) CloneMessageVT ¶
func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Config) EqualMessageVT ¶
func (*Config) EqualsConfig ¶
EqualsConfig checks if the other config is equal.
func (*Config) GetCommand ¶
func (*Config) GetConfigID ¶
GetConfigID returns the unique string for this configuration type.
func (*Config) GetDockerEnv ¶
func (*Config) GetDockerPath ¶
func (*Config) GetStopTimeoutSeconds ¶
func (*Config) GetWorkdir ¶
func (*Config) MarshalBlock ¶
MarshalBlock marshals the block to binary.
func (*Config) MarshalJSON ¶
MarshalJSON marshals the Config to JSON.
func (*Config) MarshalProtoJSON ¶
func (x *Config) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config message to JSON.
func (*Config) MarshalProtoText ¶
func (*Config) MarshalToSizedBufferVT ¶
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) UnmarshalBlock ¶
UnmarshalBlock unmarshals the block to the object.
func (*Config) UnmarshalJSON ¶
UnmarshalJSON unmarshals the Config from JSON.
func (*Config) UnmarshalProtoJSON ¶
func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config message from JSON.
func (*Config) UnmarshalVT ¶
type Config_DockerEnvEntry ¶
type Config_DockerEnvEntry struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// contains filtered or unexported fields
}
func (*Config_DockerEnvEntry) GetKey ¶
func (x *Config_DockerEnvEntry) GetKey() string
func (*Config_DockerEnvEntry) GetValue ¶
func (x *Config_DockerEnvEntry) GetValue() string
func (*Config_DockerEnvEntry) MarshalJSON ¶
func (x *Config_DockerEnvEntry) MarshalJSON() ([]byte, error)
MarshalJSON marshals the Config_DockerEnvEntry to JSON.
func (*Config_DockerEnvEntry) MarshalProtoJSON ¶
func (x *Config_DockerEnvEntry) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config_DockerEnvEntry message to JSON.
func (*Config_DockerEnvEntry) MarshalProtoText ¶
func (x *Config_DockerEnvEntry) MarshalProtoText() string
func (*Config_DockerEnvEntry) ProtoMessage ¶
func (*Config_DockerEnvEntry) ProtoMessage()
func (*Config_DockerEnvEntry) Reset ¶
func (x *Config_DockerEnvEntry) Reset()
func (*Config_DockerEnvEntry) String ¶
func (x *Config_DockerEnvEntry) String() string
func (*Config_DockerEnvEntry) UnmarshalJSON ¶
func (x *Config_DockerEnvEntry) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the Config_DockerEnvEntry from JSON.
func (*Config_DockerEnvEntry) UnmarshalProtoJSON ¶
func (x *Config_DockerEnvEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config_DockerEnvEntry message from JSON.
type Config_EnvEntry ¶
type Config_EnvEntry struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// contains filtered or unexported fields
}
func (*Config_EnvEntry) GetKey ¶
func (x *Config_EnvEntry) GetKey() string
func (*Config_EnvEntry) GetValue ¶
func (x *Config_EnvEntry) GetValue() string
func (*Config_EnvEntry) MarshalJSON ¶
func (x *Config_EnvEntry) MarshalJSON() ([]byte, error)
MarshalJSON marshals the Config_EnvEntry to JSON.
func (*Config_EnvEntry) MarshalProtoJSON ¶
func (x *Config_EnvEntry) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config_EnvEntry message to JSON.
func (*Config_EnvEntry) MarshalProtoText ¶
func (x *Config_EnvEntry) MarshalProtoText() string
func (*Config_EnvEntry) ProtoMessage ¶
func (*Config_EnvEntry) ProtoMessage()
func (*Config_EnvEntry) Reset ¶
func (x *Config_EnvEntry) Reset()
func (*Config_EnvEntry) String ¶
func (x *Config_EnvEntry) String() string
func (*Config_EnvEntry) UnmarshalJSON ¶
func (x *Config_EnvEntry) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the Config_EnvEntry from JSON.
func (*Config_EnvEntry) UnmarshalProtoJSON ¶
func (x *Config_EnvEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config_EnvEntry message from JSON.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements the docker CLI execution controller.
func NewController ¶
NewController constructs a docker controller.
func (*Controller) Close ¶
func (c *Controller) Close() error
Close releases any resources used by the controller.
func (*Controller) Execute ¶
func (c *Controller) Execute(ctx context.Context) error
Execute executes the docker container lifecycle.
func (*Controller) GetControllerInfo ¶
func (c *Controller) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*Controller) HandleDirective ¶
func (c *Controller) HandleDirective(ctx context.Context, inst directive.Instance) ([]directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive.
func (*Controller) InitForgeExecController ¶
func (c *Controller) InitForgeExecController( ctx context.Context, inputVals forge_target.InputMap, handle forge_target.ExecControllerHandle, ) error
InitForgeExecController initializes the Forge execution controller.
type DockerRunner ¶
type DockerRunner interface {
// Run executes the named binary with args and env, returning stdout.
Run(ctx context.Context, name string, args []string, env []string) ([]byte, error)
}
DockerRunner executes one docker CLI command and returns its stdout. The env parameter is the complete subprocess environment; implementations must not inherit the host environment.
type ExecDockerRunner ¶
type ExecDockerRunner struct{}
ExecDockerRunner runs docker CLI commands as subprocesses with an explicitly constructed environment. Stdout is returned for parsing; stderr appears only in failure errors so docker warnings cannot corrupt parsed values such as container ids.
func NewExecDockerRunner ¶
func NewExecDockerRunner() *ExecDockerRunner
NewExecDockerRunner constructs a subprocess docker runner.
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory constructs a docker controller.
func (*Factory) Construct ¶
func (t *Factory) Construct( ctx context.Context, conf config.Config, opts controller.ConstructOpts, ) (controller.Controller, error)
Construct constructs the associated controller given configuration.
func (*Factory) ConstructConfig ¶
ConstructConfig constructs an instance of the controller configuration.
func (*Factory) GetConfigID ¶
GetConfigID returns the configuration ID for the controller.
func (*Factory) GetControllerID ¶
GetControllerID returns the unique ID for the controller.
func (*Factory) GetVersion ¶
func (t *Factory) GetVersion() controller.Version
GetVersion returns the version of this controller.
type Mount ¶
type Mount struct {
// HostPath is the host source path.
HostPath string `protobuf:"bytes,1,opt,name=host_path,json=hostPath,proto3" json:"hostPath,omitempty"`
// ContainerPath is the target path inside the container.
ContainerPath string `protobuf:"bytes,2,opt,name=container_path,json=containerPath,proto3" json:"containerPath,omitempty"`
// ReadOnly marks the bind mount read-only.
ReadOnly bool `protobuf:"varint,3,opt,name=read_only,json=readOnly,proto3" json:"readOnly,omitempty"`
// contains filtered or unexported fields
}
Mount configures one docker bind mount.
func (*Mount) CloneMessageVT ¶
func (m *Mount) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Mount) EqualMessageVT ¶
func (*Mount) GetContainerPath ¶
func (*Mount) GetHostPath ¶
func (*Mount) GetReadOnly ¶
func (*Mount) MarshalJSON ¶
MarshalJSON marshals the Mount to JSON.
func (*Mount) MarshalProtoJSON ¶
func (x *Mount) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Mount message to JSON.
func (*Mount) MarshalProtoText ¶
func (*Mount) MarshalToSizedBufferVT ¶
func (*Mount) ProtoMessage ¶
func (*Mount) ProtoMessage()
func (*Mount) UnmarshalJSON ¶
UnmarshalJSON unmarshals the Mount from JSON.
func (*Mount) UnmarshalProtoJSON ¶
func (x *Mount) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Mount message from JSON.