agent

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MPL-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DockerlessEnvVar          = "DOCKERLESS"
	DockerlessContextEnvVar   = "DOCKERLESS_CONTEXT"
	DefaultImageConfigPath    = "/.dockerless/image.json"
	DockerlessCredentialsPath = "/.dockerless/.docker" // #nosec G101 -- not a credential

)
View Source
const ContainerActivityFile = "/tmp/devpod.activity"
View Source
const ContainerDevPodHelperLocation = "/usr/local/bin/devpod"
View Source
const DefaultInactivityTimeout = time.Minute * 20
View Source
const EnvDevPodAgentPreferDownload = "DEVPOD_AGENT_PREFER_DOWNLOAD"
View Source
const EnvDevPodAgentURL = "DEVPOD_AGENT_URL"
View Source
const RemoteDevPodHelperLocation = "/tmp/devpod"
View Source
const WorkspaceBusyFile = "workspace.lock"

Variables

View Source
var (
	ErrBinaryNotFound = errors.New("agent binary not found")
	ErrInjectTimeout  = errors.New("injection timeout")
	ErrArchMismatch   = errors.New("architecture mismatch")
)
View Source
var ErrFindAgentHomeFolder = fmt.Errorf("couldn't find devpod home directory")

Functions

func Bool added in v0.9.1

func Bool(b bool) *bool

func CloneRepositoryForWorkspace

func CloneRepositoryForWorkspace(
	ctx context.Context,
	source *provider2.WorkspaceSource,
	agentConfig *provider2.ProviderAgentConfig,
	workspaceDir, helper string,
	options provider2.CLIOptions,
	overwriteContent bool,
	log log.Logger,
) error

func CreateAgentWorkspaceDir

func CreateAgentWorkspaceDir(agentFolder, context, workspaceID string) (string, error)

func CreateWorkspaceBusyFile

func CreateWorkspaceBusyFile(folder string)

func DecodeContainerWorkspaceInfo

func DecodeContainerWorkspaceInfo(workspaceInfoRaw string) (*provider2.ContainerWorkspaceInfo, string, error)

func DecodeWorkspaceInfo

func DecodeWorkspaceInfo(workspaceInfoRaw string) (*provider2.AgentWorkspaceInfo, string, error)

func DefaultAgentDownloadURL

func DefaultAgentDownloadURL() string

func DeleteWorkspaceBusyFile

func DeleteWorkspaceBusyFile(folder string)

func DockerlessBuild added in v0.12.1

func DockerlessBuild(opts DockerlessBuildOptions) error

func FindAgentHomeFolder

func FindAgentHomeFolder(agentFolder string) (string, error)

func GetAgentBinariesDir

func GetAgentBinariesDir(agentFolder, context, workspaceID string) (string, error)

func GetAgentBinariesDirFromWorkspaceDir

func GetAgentBinariesDirFromWorkspaceDir(workspaceDir string) (string, error)

func GetAgentDaemonLogFolder

func GetAgentDaemonLogFolder(agentFolder string) (string, error)

func GetAgentWorkspaceContentDir

func GetAgentWorkspaceContentDir(workspaceDir string) string

func GetAgentWorkspaceDir

func GetAgentWorkspaceDir(agentFolder, context, workspaceID string) (string, error)

func GetDockerlessBuildContext added in v0.12.1

func GetDockerlessBuildContext() string

func HasWorkspaceBusyFile

func HasWorkspaceBusyFile(folder string) bool

func ImageConfigExists added in v0.12.1

func ImageConfigExists(path string) bool

func InjectAgent

func InjectAgent(opts *InjectOptions) error

func IsDockerlessEnabled added in v0.12.1

func IsDockerlessEnabled() bool

func ParseAgentWorkspaceInfo

func ParseAgentWorkspaceInfo(workspaceConfigFile string) (*provider2.AgentWorkspaceInfo, error)

func PrepareAgentHomeFolder

func PrepareAgentHomeFolder(agentFolder string) (string, error)

func ReadAgentWorkspaceInfo

func ReadAgentWorkspaceInfo(agentFolder, context, id string, log log.Logger) (bool, *provider2.AgentWorkspaceInfo, error)

func Tunnel

func Tunnel(
	ctx context.Context,
	exec Exec,
	user string,
	stdin io.Reader,
	stdout io.Writer,
	stderr io.Writer,
	log log.Logger,
	timeout time.Duration,
) error

func WorkspaceInfo

func WorkspaceInfo(workspaceInfoEncoded string, log log.Logger) (bool, *provider2.AgentWorkspaceInfo, error)

func WriteWorkspaceInfo

func WriteWorkspaceInfo(workspaceInfoEncoded string, log log.Logger) (bool, *provider2.AgentWorkspaceInfo, error)

func WriteWorkspaceInfoAndDeleteOld

func WriteWorkspaceInfoAndDeleteOld(workspaceInfoEncoded string, deleteWorkspace func(workspaceInfo *provider2.AgentWorkspaceInfo, log log.Logger) error, log log.Logger) (bool, *provider2.AgentWorkspaceInfo, error)

Types

type BinaryCache added in v0.9.1

type BinaryCache struct {
	BaseDir string
}

func (*BinaryCache) Get added in v0.9.1

func (c *BinaryCache) Get(arch string) (io.ReadCloser, error)

func (*BinaryCache) Set added in v0.9.1

func (c *BinaryCache) Set(arch string, data io.Reader) error

type BinaryManager added in v0.9.1

type BinaryManager struct {
	// contains filtered or unexported fields
}

func NewBinaryManager added in v0.9.1

func NewBinaryManager(logger log.Logger, downloadURL string) *BinaryManager

func (*BinaryManager) AcquireBinary added in v0.9.1

func (m *BinaryManager) AcquireBinary(ctx context.Context, arch string) (io.ReadCloser, error)

type BinarySource added in v0.9.1

type BinarySource interface {
	GetBinary(ctx context.Context, arch string) (io.ReadCloser, error)
	SourceName() string
}

type ConfigureCredentialsFunc added in v0.12.1

type ConfigureCredentialsFunc func(context.Context) (string, error)

type DockerlessBuildOptions added in v0.12.1

type DockerlessBuildOptions struct {
	Context                  context.Context
	SetupInfo                *config.Result
	DockerlessOptions        *provider2.ProviderDockerlessOptions
	ImageConfigOutput        string
	Debug                    bool
	Log                      log.Logger
	ConfigureCredentialsFunc ConfigureCredentialsFunc
}

type Exec

type Exec func(ctx context.Context, user string, command string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error

type FileCacheSource added in v0.9.1

type FileCacheSource struct {
	Cache *BinaryCache
}

func (*FileCacheSource) GetBinary added in v0.9.1

func (s *FileCacheSource) GetBinary(ctx context.Context, arch string) (io.ReadCloser, error)

func (*FileCacheSource) SourceName added in v0.9.1

func (s *FileCacheSource) SourceName() string

type HTTPDownloadSource added in v0.9.1

type HTTPDownloadSource struct {
	BaseURL string
	Cache   *BinaryCache
}

func (*HTTPDownloadSource) GetBinary added in v0.9.1

func (s *HTTPDownloadSource) GetBinary(ctx context.Context, arch string) (io.ReadCloser, error)

func (*HTTPDownloadSource) SourceName added in v0.9.1

func (s *HTTPDownloadSource) SourceName() string

type InjectError added in v0.9.1

type InjectError struct {
	Stage InjectStage
	Cause error
}

func (*InjectError) Error added in v0.9.1

func (e *InjectError) Error() string

func (*InjectError) Unwrap added in v0.9.1

func (e *InjectError) Unwrap() error

type InjectOptions added in v0.9.1

type InjectOptions struct {
	// Ctx is the context for the injection operation. Required.
	Ctx context.Context
	// Exec is the function used to execute commands on the remote machine. Required.
	Exec inject.ExecFunc
	// Log is the logger for capturing injection output.
	// Required.
	Log log.Logger

	// IsLocal indicates if the injection target is the local machine.
	IsLocal bool
	// RemoteAgentPath is the path where the agent binary should be placed on the remote machine.
	// Defaults to RemoteDevPodHelperLocation.
	RemoteAgentPath string
	// DownloadURL is the base URL to download the agent binary from. Defaults to DefaultAgentDownloadURL().
	DownloadURL string
	// PreferDownloadFromRemoteUrl forces downloading the agent even if a local binary is available.
	// Defaults to true for release versions, false for dev versions.
	PreferDownloadFromRemoteUrl *bool
	// Timeout is the maximum duration to wait for the injection to complete. Defaults to 5 minutes.
	Timeout time.Duration

	// Command is the command to execute after successful injection.
	Command string

	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer

	// LocalVersion is the version of the local DevPod binary.
	// Defaults to version.GetVersion().
	LocalVersion string
	// RemoteVersion is the expected version of the remote agent.
	// Defaults to LocalVersion.
	RemoteVersion string
	// SkipVersionCheck disables the validation of the remote agent's version.
	// Defaults to false, unless DEVPOD_AGENT_URL is set.
	SkipVersionCheck bool
}

InjectOptions defines the parameters for injecting the DevPod agent into a remote environment.

func (*InjectOptions) ApplyDefaults added in v0.9.1

func (o *InjectOptions) ApplyDefaults()

func (*InjectOptions) Validate added in v0.9.1

func (o *InjectOptions) Validate() error

type InjectSource added in v0.9.1

type InjectSource struct{}

func (*InjectSource) GetBinary added in v0.9.1

func (s *InjectSource) GetBinary(ctx context.Context, arch string) (io.ReadCloser, error)

func (*InjectSource) SourceName added in v0.9.1

func (s *InjectSource) SourceName() string

type InjectStage added in v0.12.5

type InjectStage string
const (
	InjectStageInject           InjectStage = "inject"
	InjectStageCommandExecution InjectStage = "command execution"
	InjectStageVersionCheck     InjectStage = "version check"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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