Documentation
¶
Index ¶
- func BuildBaseImage(client LXDClient, cfg config.Config) error
- func ContainerExists(client LXDClient, name string) bool
- func ContainerRunning(client LXDClient, name string) bool
- func CreateContainer(client LXDClient, name, projectDir string, cfg config.Config) error
- func DeriveContainerName(dir string) string
- func DestroyContainer(client LXDClient, name string) error
- func ExecInteractive(client LXDClient, name string, cmd []string, opts *ExecOpts) error
- func ExecSimple(client LXDClient, name string, cmd []string) (string, int, error)
- func ForwardCredentialEnv(client LXDClient, name string, cfg config.Config)
- func LaunchInstance(client LXDClient, name, imageSpec string) error
- func ListLBContainers(client LXDClient) ([]api.Instance, error)
- func PushContent(client LXDClient, containerName, containerPath, content string, uid, gid int64, ...) error
- func PushFile(client LXDClient, containerName, hostPath, containerPath string, ...) error
- func RunUpdaters(client LXDClient, name string, cfg config.Config)
- func SetupGUI(client LXDClient, name string, cfg config.Config)
- func StartExisting(client LXDClient, name string, cfg config.Config) error
- func StopContainer(client LXDClient, name string) error
- func WaitCloudInit(client LXDClient, name string)
- func WaitFull(client LXDClient, name string) error
- func WaitNetwork(client LXDClient, name string)
- func WaitQuiet(client LXDClient, name string) bool
- func WaitReady(client LXDClient, name string, maxRetries int, quiet bool) bool
- type ExecOpts
- type LXDClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildBaseImage ¶
BuildBaseImage creates a temporary container, installs deps and agents, then publishes as the base image.
func ContainerExists ¶
ContainerExists checks if a container with the given name exists.
func ContainerRunning ¶
ContainerRunning checks if a container is in the Running state.
func CreateContainer ¶
CreateContainer creates a new project container from the base image.
func DeriveContainerName ¶
DeriveContainerName computes the container name from the given directory path. The result is a valid LXD instance name: starts with a letter, 1-63 chars, containing only [a-zA-Z0-9-].
func DestroyContainer ¶
DestroyContainer force-deletes a container.
func ExecInteractive ¶
ExecInteractive runs an interactive command with TTY in the container.
func ExecSimple ¶
ExecSimple runs a command in the container and returns combined output + exit code.
func ForwardCredentialEnv ¶
ForwardCredentialEnv sets credential environment variables on the container and writes them to a shell profile so they survive su -l.
func LaunchInstance ¶
LaunchInstance creates an instance from a local or remote image. Image spec can be "alias" (local) or "remote:alias" (e.g. "ubuntu:24.04").
func ListLBContainers ¶
ListLBContainers returns all instances created by lincubate.
func PushContent ¶
func PushContent(client LXDClient, containerName, containerPath, content string, uid, gid int64, mode int) error
PushContent writes content directly into a file in the container.
func PushFile ¶
func PushFile(client LXDClient, containerName, hostPath, containerPath string, uid, gid int64) error
PushFile copies a host file into the container.
func RunUpdaters ¶
RunUpdaters runs the updater commands on an existing container.
func StartExisting ¶
StartExisting starts an existing container and runs setup.
func StopContainer ¶
StopContainer force-stops a container.
func WaitCloudInit ¶
WaitCloudInit waits for cloud-init to finish if it exists in the container.
func WaitNetwork ¶
WaitNetwork polls for network connectivity.
Types ¶
type LXDClient ¶
type LXDClient interface {
GetInstance(name string) (*api.Instance, string, error)
GetInstances(args lxd.GetInstancesArgs) ([]api.Instance, error)
CreateInstance(instance api.InstancesPost) (lxd.Operation, error)
CreateInstanceFromImage(source lxd.ImageServer, image api.Image, req api.InstancesPost) (lxd.RemoteOperation, error)
UpdateInstance(name string, instance api.InstancePut, ETag string) (lxd.Operation, error)
DeleteInstance(name string, force bool) (lxd.Operation, error)
UpdateInstanceState(name string, state api.InstanceStatePut, ETag string) (lxd.Operation, error)
ExecInstance(name string, exec api.InstanceExecPost, args *lxd.InstanceExecArgs) (lxd.Operation, error)
CreateInstanceFile(name string, path string, args lxd.InstanceFileArgs) error
GetImageAlias(name string) (*api.ImageAliasesEntry, string, error)
CreateImage(image api.ImagesPost, args *lxd.ImageCreateArgs) (lxd.Operation, error)
DeleteImage(fingerprint string) (lxd.Operation, error)
}
LXDClient abstracts LXD operations for testing.