Documentation
¶
Index ¶
- Constants
- Variables
- func Bool(b bool) *bool
- func CloneRepositoryForWorkspace(ctx context.Context, source *provider2.WorkspaceSource, ...) error
- func CreateAgentWorkspaceDir(agentFolder, context, workspaceID string) (string, error)
- func CreateWorkspaceBusyFile(folder string)
- func DecodeContainerWorkspaceInfo(workspaceInfoRaw string) (*provider2.ContainerWorkspaceInfo, string, error)
- func DecodeWorkspaceInfo(workspaceInfoRaw string) (*provider2.AgentWorkspaceInfo, string, error)
- func DefaultAgentDownloadURL() string
- func DeleteWorkspaceBusyFile(folder string)
- func FindAgentHomeFolder(agentFolder string) (string, error)
- func GetAgentBinariesDir(agentFolder, context, workspaceID string) (string, error)
- func GetAgentBinariesDirFromWorkspaceDir(workspaceDir string) (string, error)
- func GetAgentDaemonLogFolder(agentFolder string) (string, error)
- func GetAgentWorkspaceContentDir(workspaceDir string) string
- func GetAgentWorkspaceDir(agentFolder, context, workspaceID string) (string, error)
- func HasWorkspaceBusyFile(folder string) bool
- func InjectAgent(opts *InjectOptions) error
- func ParseAgentWorkspaceInfo(workspaceConfigFile string) (*provider2.AgentWorkspaceInfo, error)
- func PrepareAgentHomeFolder(agentFolder string) (string, error)
- func ReadAgentWorkspaceInfo(agentFolder, context, id string, log log.Logger) (bool, *provider2.AgentWorkspaceInfo, error)
- func RetryWithDeadline(ctx context.Context, log log.Logger, cfg RetryConfig, fn RetryFunc) error
- func Tunnel(ctx context.Context, exec Exec, user string, stdin io.Reader, stdout io.Writer, ...) error
- func WorkspaceInfo(workspaceInfoEncoded string, log log.Logger) (bool, *provider2.AgentWorkspaceInfo, error)
- func WriteWorkspaceInfo(workspaceInfoEncoded string, log log.Logger) (bool, *provider2.AgentWorkspaceInfo, error)
- func WriteWorkspaceInfoAndDeleteOld(workspaceInfoEncoded string, ...) (bool, *provider2.AgentWorkspaceInfo, error)
- type BinaryCache
- type BinaryManager
- type BinarySource
- type Exec
- type FileCacheSource
- type HTTPDownloadSource
- type InjectError
- type InjectOptions
- type InjectSource
- type InjectionMetrics
- type LogMetricsCollector
- type MetricsCollector
- type RetryConfig
- type RetryFunc
Constants ¶
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 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 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 FindAgentHomeFolder ¶
func GetAgentBinariesDir ¶
func GetAgentDaemonLogFolder ¶
func GetAgentWorkspaceDir ¶
func HasWorkspaceBusyFile ¶
func InjectAgent ¶
func InjectAgent(opts *InjectOptions) error
func ParseAgentWorkspaceInfo ¶
func ParseAgentWorkspaceInfo(workspaceConfigFile string) (*provider2.AgentWorkspaceInfo, error)
func PrepareAgentHomeFolder ¶
func ReadAgentWorkspaceInfo ¶
func RetryWithDeadline ¶ added in v0.9.1
func WorkspaceInfo ¶
func WriteWorkspaceInfo ¶
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)
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, string, error)
type BinarySource ¶ added in v0.9.1
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
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
// MetricsCollector handles the recording of injection metrics. Defaults to LogMetricsCollector.
MetricsCollector MetricsCollector
}
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 InjectionMetrics ¶ added in v0.9.1
type LogMetricsCollector ¶ added in v0.9.1
func (*LogMetricsCollector) RecordInjection ¶ added in v0.9.1
func (c *LogMetricsCollector) RecordInjection(metrics *InjectionMetrics)
type MetricsCollector ¶ added in v0.9.1
type MetricsCollector interface {
RecordInjection(metrics *InjectionMetrics)
}
type RetryConfig ¶ added in v0.9.1
Click to show internal directories.
Click to hide internal directories.