delivery

package
v1.3.0-rc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2026 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandFunc

func CommandFunc(
	driverCmd func(
		ctx context.Context,
		workspaceID, user, command string,
		stdin io.Reader, stdout io.Writer, stderr io.Writer,
	) error,
	workspaceID string,
) inject.ExecFunc

CommandFunc adapts a driver's command function to inject.ExecFunc.

func Deliver

func Deliver(
	ctx context.Context,
	strategy AgentDelivery,
	preOpts *PreStartOptions,
	postOpts *PostStartOptions,
) error

Deliver calls the appropriate delivery method based on the strategy's phase.

func ExecFuncFromDriver deprecated

func ExecFuncFromDriver(
	cmdFn func(ctx context.Context, user, command string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error,
	user string,
) inject.ExecFunc

ExecFuncFromDriver creates an inject.ExecFunc that routes commands through the provided driver command function. This adapts the driver's CommandDevContainer signature for use with the legacy injection path.

Deprecated: Platform-native AgentDelivery implementations (LocalDockerDelivery, RemoteDockerDelivery, KubernetesDelivery) are the replacements.

Types

type AgentDelivery

type AgentDelivery interface {
	Phase() DeliveryPhase
	DeliverPreStart(ctx context.Context, opts PreStartOptions) error
	DeliverPostStart(ctx context.Context, opts PostStartOptions) error
	Cleanup(ctx context.Context, workspaceID string) error
}

func NewAgentDelivery

func NewAgentDelivery(opts FactoryOptions) AgentDelivery

type BinarySourceFunc

type BinarySourceFunc func(ctx context.Context, arch string) (io.ReadCloser, error)

type DeliveryPhase

type DeliveryPhase int
const (
	PhasePreStart DeliveryPhase = iota
	PhasePostStart
)

func (DeliveryPhase) String

func (p DeliveryPhase) String() string

type FactoryOptions

type FactoryOptions struct {
	WorkspaceConfig *provider.AgentWorkspaceInfo
	WorkspaceID     string
	DockerCommand   string
	DockerEnv       []string
	HelperImage     string
	IsRemoteDocker  bool
	ContainerID     string
	ExecFunc        inject.ExecFunc //nolint:staticcheck // legacy delivery strategies require this type
}

type KubernetesDelivery

type KubernetesDelivery struct {
	ExecFunc inject.ExecFunc //nolint:staticcheck // K8s exec routing requires this type
}

func (*KubernetesDelivery) Cleanup

func (d *KubernetesDelivery) Cleanup(_ context.Context, _ string) error

func (*KubernetesDelivery) DeliverPostStart

func (d *KubernetesDelivery) DeliverPostStart(ctx context.Context, opts PostStartOptions) error

func (*KubernetesDelivery) DeliverPreStart

func (d *KubernetesDelivery) DeliverPreStart(_ context.Context, _ PreStartOptions) error

func (*KubernetesDelivery) Phase

func (d *KubernetesDelivery) Phase() DeliveryPhase

type LegacyShellDelivery deprecated

type LegacyShellDelivery struct {
	ExecFunc    inject.ExecFunc //nolint:staticcheck // deprecated injection path
	DownloadURL string
	Timeout     func() *agent.InjectOptions
}

Deprecated: LegacyShellDelivery is deprecated. Platform-native AgentDelivery implementations (LocalDockerDelivery, RemoteDockerDelivery, KubernetesDelivery) are the replacements.

func (*LegacyShellDelivery) Cleanup deprecated

func (d *LegacyShellDelivery) Cleanup(_ context.Context, _ string) error

Deprecated: Cleanup is part of LegacyShellDelivery which is deprecated.

func (*LegacyShellDelivery) DeliverPostStart deprecated

func (d *LegacyShellDelivery) DeliverPostStart(ctx context.Context, opts PostStartOptions) error

Deprecated: DeliverPostStart is part of LegacyShellDelivery which is deprecated.

func (*LegacyShellDelivery) DeliverPreStart deprecated

func (d *LegacyShellDelivery) DeliverPreStart(_ context.Context, _ PreStartOptions) error

Deprecated: DeliverPreStart is part of LegacyShellDelivery which is deprecated.

func (*LegacyShellDelivery) Phase deprecated

Deprecated: Phase is part of LegacyShellDelivery which is deprecated.

type LocalDockerDelivery

type LocalDockerDelivery struct {
	DockerCommand string
	Environment   []string
	HelperImage   string
}

func (*LocalDockerDelivery) Cleanup

func (d *LocalDockerDelivery) Cleanup(ctx context.Context, workspaceID string) error

func (*LocalDockerDelivery) DeliverPostStart

func (d *LocalDockerDelivery) DeliverPostStart(_ context.Context, _ PostStartOptions) error

func (*LocalDockerDelivery) DeliverPreStart

func (d *LocalDockerDelivery) DeliverPreStart(ctx context.Context, opts PreStartOptions) error

func (*LocalDockerDelivery) Phase

type PostStartOptions

type PostStartOptions struct {
	WorkspaceID      string
	ContainerDetails *config.ContainerDetails
	BinarySource     BinarySourceFunc
	Arch             string
}

type PreStartOptions

type PreStartOptions struct {
	WorkspaceID  string
	RunOptions   *driver.RunOptions
	BinarySource BinarySourceFunc
	Arch         string
}

type RemoteDockerDelivery

type RemoteDockerDelivery struct {
	DockerCommand string
	Environment   []string
	ContainerID   string
}

func (*RemoteDockerDelivery) Cleanup

func (d *RemoteDockerDelivery) Cleanup(_ context.Context, _ string) error

func (*RemoteDockerDelivery) DeliverPostStart

func (d *RemoteDockerDelivery) DeliverPostStart(ctx context.Context, opts PostStartOptions) error

func (*RemoteDockerDelivery) DeliverPreStart

func (d *RemoteDockerDelivery) DeliverPreStart(_ context.Context, _ PreStartOptions) error

func (*RemoteDockerDelivery) Phase

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL