Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/agent/delivery/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ func NewAgentDelivery(opts FactoryOptions) AgentDelivery {
switch {
case driverType == provider.CustomDriver:
log.Debugf("using legacy shell delivery for custom driver")
log.Warnf(
"legacy shell delivery is deprecated; platform-native delivery will replace this in a future release",
)
return &LegacyShellDelivery{
ExecFunc: opts.ExecFunc,
DownloadURL: "",
}

case driverType == provider.KubernetesDriver:
log.Debugf("using legacy shell delivery for kubernetes driver")
log.Warnf(
"legacy shell delivery is deprecated; platform-native delivery will replace this in a future release",
)
return &LegacyShellDelivery{
ExecFunc: opts.ExecFunc,
DownloadURL: "",
Expand Down Expand Up @@ -66,6 +72,9 @@ func NewAgentDelivery(opts FactoryOptions) AgentDelivery {

default:
log.Debugf("using legacy shell delivery for driver: %s", driverType)
log.Warnf(
"legacy shell delivery is deprecated; platform-native delivery will replace this in a future release",
)
return &LegacyShellDelivery{
ExecFunc: opts.ExecFunc,
DownloadURL: "",
Expand Down
9 changes: 9 additions & 0 deletions pkg/agent/delivery/legacy_shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,25 @@ import (
"github.com/devsy-org/devsy/pkg/log"
)

// Deprecated: LegacyShellDelivery is deprecated. Platform-native AgentDelivery implementations
// (LocalDockerDelivery, RemoteDockerDelivery, KubernetesDelivery) are the replacements.
type LegacyShellDelivery struct {
ExecFunc inject.ExecFunc
DownloadURL string
Timeout func() *agent.InjectOptions
}

// Deprecated: Phase is part of LegacyShellDelivery which is deprecated.
func (d *LegacyShellDelivery) Phase() DeliveryPhase {
return PhasePostStart
}

// Deprecated: DeliverPreStart is part of LegacyShellDelivery which is deprecated.
func (d *LegacyShellDelivery) DeliverPreStart(_ context.Context, _ PreStartOptions) error {
return fmt.Errorf("LegacyShellDelivery does not support pre-start delivery")
}

// Deprecated: DeliverPostStart is part of LegacyShellDelivery which is deprecated.
func (d *LegacyShellDelivery) DeliverPostStart(ctx context.Context, opts PostStartOptions) error {
if d.ExecFunc == nil {
return fmt.Errorf("exec function is required for legacy shell delivery")
Expand Down Expand Up @@ -53,6 +58,7 @@ func (d *LegacyShellDelivery) DeliverPostStart(ctx context.Context, opts PostSta
return nil
}

// Deprecated: Cleanup is part of LegacyShellDelivery which is deprecated.
func (d *LegacyShellDelivery) Cleanup(_ context.Context, _ string) error {
return nil
}
Expand All @@ -67,6 +73,9 @@ func (d *LegacyShellDelivery) downloadURL() string {
// 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.
func ExecFuncFromDriver(
cmdFn func(ctx context.Context, user, command string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error,
user string,
Expand Down
11 changes: 11 additions & 0 deletions pkg/inject/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,27 @@ import (
"github.com/devsy-org/devsy/pkg/log"
)

// Deprecated: Script embeds inject.sh which is deprecated. Platform-native AgentDelivery
// implementations (LocalDockerDelivery, RemoteDockerDelivery, KubernetesDelivery) are the replacements.
//
//go:embed inject.sh
var Script string

// Deprecated: ExecFunc is part of the legacy shell injection path. Platform-native AgentDelivery
// implementations (LocalDockerDelivery, RemoteDockerDelivery, KubernetesDelivery) are the replacements.
type ExecFunc func(ctx context.Context, command string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error

// Deprecated: LocalFile is part of the legacy shell injection path. Platform-native AgentDelivery
// implementations (LocalDockerDelivery, RemoteDockerDelivery, KubernetesDelivery) are the replacements.
type LocalFile func(arm bool) (io.ReadCloser, error)

type injectResult struct {
wasExecuted bool
err error
}

// Deprecated: InjectOptions is part of the legacy shell injection path. Platform-native AgentDelivery
// implementations (LocalDockerDelivery, RemoteDockerDelivery, KubernetesDelivery) are the replacements.
type InjectOptions struct {
Ctx context.Context
Exec ExecFunc
Expand All @@ -39,6 +48,8 @@ type InjectOptions struct {
Timeout time.Duration
}

// Deprecated: Inject is part of the legacy shell injection path. Platform-native AgentDelivery
// implementations (LocalDockerDelivery, RemoteDockerDelivery, KubernetesDelivery) are the replacements.
func Inject(opts InjectOptions) (bool, error) {
if opts.Ctx == nil {
return false, fmt.Errorf("context is required")
Expand Down
2 changes: 2 additions & 0 deletions pkg/inject/inject.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/sh
# Deprecated: inject.sh is deprecated. Platform-native AgentDelivery implementations
# (LocalDockerDelivery, RemoteDockerDelivery, KubernetesDelivery) are the replacements.
set -e

INSTALL_DIR="{{ .InstallDir }}"
Expand Down
Loading