Documentation
¶
Index ¶
- Constants
- Variables
- func ContainerKey(resolved devcontainer.ResolvedConfig, imageIdentity string, bridgeEnabled bool, ...) (string, error)
- func DotfilesNeedsInstall(state storefs.WorkspaceState, cfg capdot.Config) bool
- func EnsureContainerHasSSHAgent(inspect *backend.ContainerInspect) error
- func LifecycleKey(resolved devcontainer.ResolvedConfig, containerKey string, ...) (string, error)
- func LifecycleStateApplied(state storefs.WorkspaceState, desiredKey string) bool
- func ManagedImageKey(resolved devcontainer.ResolvedConfig, targetImage string) (string, error)
- func NormalizeLifecyclePhase(requested string) (string, error)
- func RedactSensitiveMap(values map[string]string) map[string]string
- func ShouldAllocateTTY(stdin io.Reader, stdout io.Writer) bool
- type BridgeDoctorOptions
- type BuildOptions
- type BuildResult
- type CapabilityState
- type CommandStreams
- type ContainerAction
- type ContainerPlan
- type ControlState
- type DesiredContainer
- type DesiredImage
- type DesiredLifecycle
- type DotfilesConfig
- type DotfilesStatus
- type ExecOptions
- type Executor
- func (e *Executor) BridgeDoctor(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, ...) (bridge.Report, error)
- func (e *Executor) Build(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, ...) (BuildResult, error)
- func (e *Executor) EnrichMergedConfig(ctx context.Context, resolved *devcontainer.ResolvedConfig, image string) error
- func (e *Executor) EnsureUpdatedUIDContainer(ctx context.Context, resolved devcontainer.ResolvedConfig, image string, ...) error
- func (e *Executor) Exec(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, ...) (int, error)
- func (e *Executor) ExecRequest(ctx context.Context, observed ObservedState, stdin bool, tty bool, ...) (backend.ExecRequest, error)
- func (e *Executor) InspectImageArchitecture(ctx context.Context, image string) (string, error)
- func (e *Executor) InspectImageUser(ctx context.Context, image string) (string, error)
- func (e *Executor) Materialize(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, debug bool, ...) (devcontainer.ResolvedConfig, error)
- func (e *Executor) PrepareObservedSession(ctx context.Context, opts ObservedSessionOptions) (*Session, error)
- func (e *Executor) ReadConfig(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, ...) (ReadConfigResult, error)
- func (e *Executor) ReconcileContainer(ctx context.Context, observed ObservedState, ...) (string, string, bool, error)
- func (e *Executor) ReconcileImage(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, ...) (string, ImagePlan, error)
- func (e *Executor) RunLifecycle(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, ...) (RunLifecycleResult, error)
- func (e *Executor) RunLifecyclePlan(ctx context.Context, observed ObservedState, state storefs.WorkspaceState, ...) error
- func (e *Executor) SetTrustedSigners(signers []security.TrustedSigner)
- func (e *Executor) Up(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, opts UpOptions) (UpResult, error)
- func (e *Executor) VerificationCheck() func(context.Context, string) security.VerificationResult
- func (e *Executor) VerifyResolvedFeatures(resolved devcontainer.ResolvedConfig, events ui.Sink) error
- func (e *Executor) WithTrustedSigners(signers []security.TrustedSigner) *Executor
- type ExitError
- type ImageAction
- type ImageBuildMode
- type ImagePlan
- type LifecyclePhase
- type LifecyclePlan
- type ManagedContainer
- type ObserveRequest
- type ObservedSessionOptions
- type ObservedState
- type Observer
- type ReadConfigOptions
- type ReadConfigResult
- type ReadToken
- type RunLifecycleOptions
- type RunLifecycleResult
- type RuntimeTarget
- type Session
- func (s *Session) ContainerID() string
- func (s *Session) ContainerInspect() *backend.ContainerInspect
- func (s *Session) EffectiveRemoteUser(ctx context.Context) (string, error)
- func (s *Session) Image() string
- func (s *Session) ManagedContainer(ctx context.Context) (*ManagedContainer, error)
- func (s *Session) Observed() ObservedState
- func (s *Session) Resolved() devcontainer.ResolvedConfig
- func (s *Session) RevalidateReadTarget(ctx context.Context) error
- func (s *Session) SetContainerID(containerID string)
- func (s *Session) SetContainerInspect(inspect *backend.ContainerInspect)
- func (s *Session) SetResolved(resolved devcontainer.ResolvedConfig)
- func (s *Session) SetState(state storefs.WorkspaceState)
- func (s *Session) State() storefs.WorkspaceState
- type StateTracker
- func (t *StateTracker) ApplyContainer(containerID string, containerKey string, created bool)
- func (t *StateTracker) BeginBridge(kind string, key string)
- func (t *StateTracker) BeginContainer(containerID string, containerKey string)
- func (t *StateTracker) BeginDotfiles(kind string, key string)
- func (t *StateTracker) BeginLifecycle(kind LifecyclePhase, key string)
- func (t *StateTracker) BeginPlannedLifecycle(plan LifecyclePlan, installDotfiles bool)
- func (t *StateTracker) CompleteDotfiles(dotfiles DotfilesConfig)
- func (t *StateTracker) CompleteLifecycle(key string, dotfiles DotfilesConfig)
- func (t *StateTracker) CompletePlannedLifecycle(plan LifecyclePlan, dotfiles DotfilesConfig, installDotfiles bool)
- func (t *StateTracker) DisableBridge()
- func (t *StateTracker) EnableBridge(sessionID string)
- func (t *StateTracker) Persist() error
- func (t *StateTracker) SetBridge(enabled bool, sessionID string)
- func (t *StateTracker) SetContainer(containerID string, containerKey string)
- func (t *StateTracker) SetTrustedRefs(refs []string)
- func (t *StateTracker) State() storefs.WorkspaceState
- type TargetKind
- type UpOptions
- type UpResult
Constants ¶
View Source
const ( ImageKeyLabel = "hatchctl.reconcile.image-key" ContainerKeyLabel = "hatchctl.reconcile.container-key" )
Variables ¶
View Source
var ( ErrObservedTargetNotFound = errors.New("observed runtime target not found") ErrObservedStateStale = errors.New("observed runtime target changed before action") )
View Source
var ErrContainerObservationMissing = errors.New("container observation is required for reconcile")
View Source
var ErrInvalidLifecyclePhase = errors.New("invalid lifecycle phase")
Functions ¶
func ContainerKey ¶
func ContainerKey(resolved devcontainer.ResolvedConfig, imageIdentity string, bridgeEnabled bool, sshAgent bool) (string, error)
func DotfilesNeedsInstall ¶
func DotfilesNeedsInstall(state storefs.WorkspaceState, cfg capdot.Config) bool
func EnsureContainerHasSSHAgent ¶
func EnsureContainerHasSSHAgent(inspect *backend.ContainerInspect) error
func LifecycleKey ¶
func LifecycleKey(resolved devcontainer.ResolvedConfig, containerKey string, dotfiles DotfilesConfig) (string, error)
func LifecycleStateApplied ¶
func LifecycleStateApplied(state storefs.WorkspaceState, desiredKey string) bool
func ManagedImageKey ¶
func ManagedImageKey(resolved devcontainer.ResolvedConfig, targetImage string) (string, error)
func NormalizeLifecyclePhase ¶
Types ¶
type BridgeDoctorOptions ¶
type BridgeDoctorOptions struct {
Debug bool
IO CommandStreams
}
type BuildOptions ¶
type BuildOptions struct {
Debug bool
IO CommandStreams
}
type BuildResult ¶
type BuildResult struct {
Image string `json:"image"`
}
type CapabilityState ¶
type CommandStreams ¶
type ContainerAction ¶
type ContainerAction string
const ( ContainerActionReuse ContainerAction = "reuse" ContainerActionStart ContainerAction = "start" ContainerActionCreate ContainerAction = "create" ContainerActionReplace ContainerAction = "replace" )
type ContainerPlan ¶
type ContainerPlan struct {
Action ContainerAction
ContainerID string
Observed *backend.ContainerInspect
DesiredKey string
Reused bool
NeedsCleanup bool
}
func PlanContainer ¶
func PlanContainer(observed ObservedState, desired DesiredContainer) (ContainerPlan, error)
type ControlState ¶
type ControlState struct {
WorkspaceState storefs.WorkspaceState
Coordination storefs.CoordinationRecord
PlanCachePath string
PlanCacheExists bool
}
type DesiredContainer ¶
type DesiredImage ¶
type DesiredImage struct {
TargetImage string
BuildMode ImageBuildMode
ReuseKey string
Verify bool
}
type DesiredLifecycle ¶
type DesiredLifecycle struct {
Key string
Requested string
Dotfiles DotfilesConfig
Created bool
}
type DotfilesConfig ¶
type DotfilesConfig = capability.Dotfiles
type DotfilesStatus ¶
type DotfilesStatus struct {
Configured bool `json:"configured"`
Applied bool `json:"applied"`
NeedsInstall bool `json:"needsInstall"`
Repository string `json:"repository,omitempty"`
InstallCommand string `json:"installCommand,omitempty"`
TargetPath string `json:"targetPath,omitempty"`
}
func DotfilesStatusFromState ¶
func DotfilesStatusFromState(state storefs.WorkspaceState, cfg capdot.Config) *DotfilesStatus
type ExecOptions ¶
type ExecOptions struct {
Args []string
RemoteEnv map[string]string
Debug bool
IO CommandStreams
}
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
func NewExecutor ¶
func NewExecutorWithIO ¶
func (*Executor) BridgeDoctor ¶
func (e *Executor) BridgeDoctor(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, opts BridgeDoctorOptions) (bridge.Report, error)
func (*Executor) Build ¶
func (e *Executor) Build(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, opts BuildOptions) (BuildResult, error)
func (*Executor) EnrichMergedConfig ¶
func (e *Executor) EnrichMergedConfig(ctx context.Context, resolved *devcontainer.ResolvedConfig, image string) error
func (*Executor) EnsureUpdatedUIDContainer ¶
func (e *Executor) EnsureUpdatedUIDContainer(ctx context.Context, resolved devcontainer.ResolvedConfig, image string, containerID string, events ui.Sink) error
func (*Executor) Exec ¶
func (e *Executor) Exec(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, opts ExecOptions) (int, error)
func (*Executor) ExecRequest ¶ added in v0.7.0
func (*Executor) InspectImageArchitecture ¶
func (*Executor) InspectImageUser ¶
func (*Executor) Materialize ¶
func (e *Executor) Materialize(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, debug bool, events ui.Sink, phase string, label string) (devcontainer.ResolvedConfig, error)
func (*Executor) PrepareObservedSession ¶
func (*Executor) ReadConfig ¶
func (e *Executor) ReadConfig(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, opts ReadConfigOptions) (ReadConfigResult, error)
func (*Executor) ReconcileContainer ¶
func (*Executor) ReconcileImage ¶
func (e *Executor) ReconcileImage(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, resolved devcontainer.ResolvedConfig, events ui.Sink) (string, ImagePlan, error)
func (*Executor) RunLifecycle ¶
func (e *Executor) RunLifecycle(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, opts RunLifecycleOptions) (RunLifecycleResult, error)
func (*Executor) RunLifecyclePlan ¶
func (e *Executor) RunLifecyclePlan(ctx context.Context, observed ObservedState, state storefs.WorkspaceState, dotfiles capdot.Config, allowHostLifecycle bool, events ui.Sink, plan LifecyclePlan) error
func (*Executor) SetTrustedSigners ¶ added in v0.6.13
func (e *Executor) SetTrustedSigners(signers []security.TrustedSigner)
func (*Executor) Up ¶
func (e *Executor) Up(ctx context.Context, workspacePlan workspaceplan.WorkspacePlan, opts UpOptions) (UpResult, error)
func (*Executor) VerificationCheck ¶
func (*Executor) VerifyResolvedFeatures ¶
func (e *Executor) VerifyResolvedFeatures(resolved devcontainer.ResolvedConfig, events ui.Sink) error
func (*Executor) WithTrustedSigners ¶ added in v0.6.16
func (e *Executor) WithTrustedSigners(signers []security.TrustedSigner) *Executor
type ImageAction ¶
type ImageAction string
const ( ImageActionUseTarget ImageAction = "use-target" ImageActionReuseTarget ImageAction = "reuse-target" ImageActionBuildTarget ImageAction = "build-target" )
type ImageBuildMode ¶
type ImageBuildMode string
const ( ImageBuildModeNone ImageBuildMode = "none" ImageBuildModeBuild ImageBuildMode = "build" ImageBuildModeFeatures ImageBuildMode = "features" ImageBuildModeProject ImageBuildMode = "project" )
type ImagePlan ¶
type ImagePlan struct {
Action ImageAction
TargetImage string
BuildMode ImageBuildMode
ReuseKey string
Verify bool
}
func PlanImage ¶
func PlanImage(desired DesiredImage, observed *backend.ImageInspect) ImagePlan
type LifecyclePhase ¶
type LifecyclePhase string
const ( LifecyclePhaseNone LifecyclePhase = "" LifecyclePhaseCreate LifecyclePhase = "create" LifecyclePhaseAll LifecyclePhase = "all" )
type LifecyclePlan ¶
type LifecyclePlan struct {
RunCreate bool
RunStart bool
RunAttach bool
Key string
TransitionKind LifecyclePhase
NeedsRecovery bool
}
func PlanLifecycleCommand ¶
func PlanLifecycleCommand(observed ObservedState, desired DesiredLifecycle) (LifecyclePlan, error)
func PlanUpLifecycle ¶
func PlanUpLifecycle(observed ObservedState, desired DesiredLifecycle) LifecyclePlan
type ManagedContainer ¶
type ManagedContainer struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Image string `json:"image,omitempty"`
Status string `json:"status,omitempty"`
Running bool `json:"running"`
RemoteUser string `json:"remoteUser,omitempty"`
ContainerEnv map[string]string `json:"containerEnv,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
ForwardPorts []string `json:"forwardPorts,omitempty"`
MetadataCount int `json:"metadataCount"`
BridgeEnabled bool `json:"bridgeEnabled,omitempty"`
}
type ObserveRequest ¶
type ObserveRequest struct {
Plan workspaceplan.WorkspacePlan
Resolved devcontainer.ResolvedConfig
ImageRef string
LoadControlState bool
ObserveTarget bool
InspectTarget bool
ObserveImage bool
AllowMissingTarget bool
}
type ObservedSessionOptions ¶
type ObservedSessionOptions struct {
Plan workspaceplan.WorkspacePlan
Resolved devcontainer.ResolvedConfig
Debug bool
Events ui.Sink
Enrich bool
LoadState bool
FindContainer bool
AllowMissingContainer bool
InspectContainer bool
}
type ObservedState ¶
type ObservedState struct {
Plan workspaceplan.WorkspacePlan
Resolved devcontainer.ResolvedConfig
Target RuntimeTarget
Control ControlState
Capability CapabilityState
Container *backend.ContainerInspect
Image *backend.ImageInspect
ImageRef string
ReadTarget ReadToken
}
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
func NewObserver ¶
func NewObserver(runtime observerBackend) *Observer
func (*Observer) Observe ¶
func (o *Observer) Observe(ctx context.Context, req ObserveRequest) (ObservedState, error)
func (*Observer) RevalidateReadToken ¶
func (o *Observer) RevalidateReadToken(ctx context.Context, observed ObservedState) error
type ReadConfigOptions ¶
type ReadConfigOptions struct {
Debug bool
IO CommandStreams
}
type ReadConfigResult ¶
type ReadConfigResult struct {
WorkspaceFolder string `json:"workspaceFolder"`
ConfigPath string `json:"configPath"`
WorkspaceMount string `json:"workspaceMount"`
SourceKind string `json:"sourceKind"`
HasInitializeCommand bool `json:"hasInitializeCommand"`
HasCreateCommand bool `json:"hasCreateCommand"`
HasStartCommand bool `json:"hasStartCommand"`
HasAttachCommand bool `json:"hasAttachCommand"`
Image string `json:"image"`
ImageUser string `json:"imageUser,omitempty"`
ContainerName string `json:"containerName"`
StateDir string `json:"stateDir"`
CacheDir string `json:"cacheDir"`
RemoteUser string `json:"remoteUser,omitempty"`
ContainerUser string `json:"containerUser,omitempty"`
RemoteEnv map[string]string `json:"remoteEnv,omitempty"`
ContainerEnv map[string]string `json:"containerEnv,omitempty"`
Mounts []string `json:"mounts,omitempty"`
ForwardPorts []string `json:"forwardPorts,omitempty"`
Bridge *bridge.Report `json:"bridge,omitempty"`
Dotfiles *DotfilesStatus `json:"dotfiles,omitempty"`
MetadataCount int `json:"metadataCount"`
ManagedContainer *ManagedContainer `json:"managedContainer,omitempty"`
}
type RunLifecycleOptions ¶
type RunLifecycleOptions struct {
Phase string
Debug bool
IO CommandStreams
}
type RunLifecycleResult ¶
type RuntimeTarget ¶
type RuntimeTarget struct {
Kind TargetKind
Image string
ContainerName string
ComposeProject string
ComposeService string
PrimaryContainer string
Containers []backend.ContainerInspect
}
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) ContainerID ¶
func (*Session) ContainerInspect ¶
func (s *Session) ContainerInspect() *backend.ContainerInspect
func (*Session) EffectiveRemoteUser ¶
func (*Session) ManagedContainer ¶
func (s *Session) ManagedContainer(ctx context.Context) (*ManagedContainer, error)
func (*Session) Observed ¶
func (s *Session) Observed() ObservedState
func (*Session) Resolved ¶
func (s *Session) Resolved() devcontainer.ResolvedConfig
func (*Session) RevalidateReadTarget ¶
func (*Session) SetContainerID ¶
func (*Session) SetContainerInspect ¶
func (s *Session) SetContainerInspect(inspect *backend.ContainerInspect)
func (*Session) SetResolved ¶
func (s *Session) SetResolved(resolved devcontainer.ResolvedConfig)
func (*Session) SetState ¶
func (s *Session) SetState(state storefs.WorkspaceState)
func (*Session) State ¶
func (s *Session) State() storefs.WorkspaceState
type StateTracker ¶
type StateTracker struct {
// contains filtered or unexported fields
}
func LoadStateTracker ¶ added in v0.8.1
func LoadStateTracker(stateDir string) (*StateTracker, error)
func NewStateTracker ¶
func NewStateTracker(stateDir string, state storefs.WorkspaceState) *StateTracker
func (*StateTracker) ApplyContainer ¶
func (t *StateTracker) ApplyContainer(containerID string, containerKey string, created bool)
func (*StateTracker) BeginBridge ¶
func (t *StateTracker) BeginBridge(kind string, key string)
func (*StateTracker) BeginContainer ¶
func (t *StateTracker) BeginContainer(containerID string, containerKey string)
func (*StateTracker) BeginDotfiles ¶
func (t *StateTracker) BeginDotfiles(kind string, key string)
func (*StateTracker) BeginLifecycle ¶
func (t *StateTracker) BeginLifecycle(kind LifecyclePhase, key string)
func (*StateTracker) BeginPlannedLifecycle ¶
func (t *StateTracker) BeginPlannedLifecycle(plan LifecyclePlan, installDotfiles bool)
func (*StateTracker) CompleteDotfiles ¶
func (t *StateTracker) CompleteDotfiles(dotfiles DotfilesConfig)
func (*StateTracker) CompleteLifecycle ¶
func (t *StateTracker) CompleteLifecycle(key string, dotfiles DotfilesConfig)
func (*StateTracker) CompletePlannedLifecycle ¶
func (t *StateTracker) CompletePlannedLifecycle(plan LifecyclePlan, dotfiles DotfilesConfig, installDotfiles bool)
func (*StateTracker) DisableBridge ¶
func (t *StateTracker) DisableBridge()
func (*StateTracker) EnableBridge ¶
func (t *StateTracker) EnableBridge(sessionID string)
func (*StateTracker) Persist ¶
func (t *StateTracker) Persist() error
func (*StateTracker) SetBridge ¶
func (t *StateTracker) SetBridge(enabled bool, sessionID string)
func (*StateTracker) SetContainer ¶
func (t *StateTracker) SetContainer(containerID string, containerKey string)
func (*StateTracker) SetTrustedRefs ¶ added in v0.6.8
func (t *StateTracker) SetTrustedRefs(refs []string)
func (*StateTracker) State ¶
func (t *StateTracker) State() storefs.WorkspaceState
type TargetKind ¶
type TargetKind string
const ( TargetKindManagedContainer TargetKind = "managed-container" TargetKindComposeService TargetKind = "compose-service" )
type UpOptions ¶
type UpOptions struct {
Recreate bool
Debug bool
IO CommandStreams
}
Click to show internal directories.
Click to hide internal directories.