Documentation ¶
Index ¶
- Constants
- Variables
- func CombineOptions(workspace *Workspace, machine *Machine, options map[string]config.OptionValue) map[string]config.OptionValue
- func GetBaseEnvironment(context, provider string) map[string]string
- func GetLocksDir(context string) (string, error)
- func GetMachineDir(context, machineID string) (string, error)
- func GetMachinesDir(context string) (string, error)
- func GetProInstanceDir(context, proInstanceHost string) (string, error)
- func GetProInstancesDir(context string) (string, error)
- func GetProviderBinariesDir(context, providerName string) (string, error)
- func GetProviderDir(context, providerName string) (string, error)
- func GetProviderOptions(workspace *Workspace, server *Machine, devConfig *config.Config) map[string]config.OptionValue
- func GetProvidersDir(context string) (string, error)
- func GetWorkspaceDir(context, workspaceID string) (string, error)
- func GetWorkspacesDir(context string) (string, error)
- func LoadWorkspaceResult(context, workspaceID string) (*config2.Result, error)
- func MachineExists(context, machineID string) bool
- func Merge(m1 map[string]string, m2 map[string]string) map[string]string
- func ParseOptions(options []string) (map[string]string, error)
- func ProInstanceExists(context, proInstanceID string) bool
- func ProviderExists(context, provider string) bool
- func SaveMachineConfig(machine *Machine) error
- func SaveProInstanceConfig(context string, proInstance *ProInstance) error
- func SaveProviderConfig(context string, provider *ProviderConfig) error
- func SaveWorkspaceConfig(workspace *Workspace) error
- func SaveWorkspaceResult(workspace *Workspace, result *config2.Result) error
- func ToEnvironment(workspace *Workspace, machine *Machine, options map[string]config.OptionValue, ...) []string
- func ToOptions(workspace *Workspace, machine *Machine, options map[string]config.OptionValue) map[string]string
- func ToOptionsMachine(machine *Machine) map[string]string
- func ToOptionsWorkspace(workspace *Workspace) map[string]string
- func ToProInstanceID(url string) string
- func WorkspaceExists(context, workspaceID string) bool
- type AgentWorkspaceInfo
- type BuildOptions
- type CLIOptions
- type ContainerWorkspaceInfo
- type ExportConfig
- type ExportMachineConfig
- type ExportProviderConfig
- type ExportWorkspaceConfig
- type Machine
- type MachineProviderConfig
- type ProInstance
- type ProviderAgentConfig
- type ProviderAgentConfigExec
- type ProviderBinary
- type ProviderCommands
- type ProviderConfig
- type ProviderCustomDriverConfig
- type ProviderDockerDriverConfig
- type ProviderDockerlessOptions
- type ProviderOptionGroup
- type ProviderSource
- type ProxyCommands
- type SubOptions
- type Workspace
- type WorkspaceIDEConfig
- type WorkspaceMachineConfig
- type WorkspaceProviderConfig
- type WorkspaceSource
Constants ¶
View Source
const ( WorkspaceConfigFile = "workspace.json" WorkspaceResultFile = "workspace_result.json" MachineConfigFile = "machine.json" ProInstanceConfigFile = "pro.json" ProviderConfigFile = "provider.json" )
View Source
const ( DEVPOD = "DEVPOD" DEVPOD_OS = "DEVPOD_OS" DEVPOD_ARCH = "DEVPOD_ARCH" WORKSPACE_ID = "WORKSPACE_ID" WORKSPACE_UID = "WORKSPACE_UID" WORKSPACE_PICTURE = "WORKSPACE_PICTURE" WORKSPACE_FOLDER = "WORKSPACE_FOLDER" WORKSPACE_CONTEXT = "WORKSPACE_CONTEXT" WORKSPACE_ORIGIN = "WORKSPACE_ORIGIN" WORKSPACE_SOURCE = "WORKSPACE_SOURCE" WORKSPACE_PROVIDER = "WORKSPACE_PROVIDER" MACHINE_ID = "MACHINE_ID" MACHINE_CONTEXT = "MACHINE_CONTEXT" MACHINE_FOLDER = "MACHINE_FOLDER" MACHINE_PROVIDER = "MACHINE_PROVIDER" PROVIDER_ID = "PROVIDER_ID" PROVIDER_CONTEXT = "PROVIDER_CONTEXT" PROVIDER_FOLDER = "PROVIDER_FOLDER" )
View Source
const ( DockerDriver = "docker" CustomDriver = "custom" )
View Source
const (
CommandEnv = "COMMAND"
)
View Source
const (
DEVCONTAINER_ID = "DEVCONTAINER_ID"
)
Variables ¶
View Source
var ( WorkspaceSourceGit = "git:" WorkspaceSourceLocal = "local:" WorkspaceSourceImage = "image:" WorkspaceSourceContainer = "container:" )
View Source
var ProviderNameRegEx = regexp.MustCompile(`[^a-z0-9\-]+`)
Functions ¶
func CombineOptions ¶
func CombineOptions(workspace *Workspace, machine *Machine, options map[string]config.OptionValue) map[string]config.OptionValue
func GetBaseEnvironment ¶
func GetLocksDir ¶ added in v0.1.10
func GetMachineDir ¶
func GetMachinesDir ¶
func GetProInstanceDir ¶ added in v0.3.5
func GetProInstancesDir ¶ added in v0.3.5
func GetProviderBinariesDir ¶
func GetProviderDir ¶
func GetProviderOptions ¶
func GetProvidersDir ¶
func GetWorkspaceDir ¶
func GetWorkspacesDir ¶
func LoadWorkspaceResult ¶ added in v0.5.0
func MachineExists ¶
func ProInstanceExists ¶ added in v0.3.5
func ProviderExists ¶ added in v0.5.0
func SaveMachineConfig ¶
func SaveProInstanceConfig ¶ added in v0.3.5
func SaveProInstanceConfig(context string, proInstance *ProInstance) error
func SaveProviderConfig ¶
func SaveProviderConfig(context string, provider *ProviderConfig) error
func SaveWorkspaceConfig ¶
func SaveWorkspaceResult ¶ added in v0.5.0
func ToEnvironment ¶
func ToOptionsMachine ¶
func ToOptionsWorkspace ¶
func ToProInstanceID ¶ added in v0.3.5
func WorkspaceExists ¶
Types ¶
type AgentWorkspaceInfo ¶
type AgentWorkspaceInfo struct { // WorkspaceOrigin is the path where this workspace config originated from WorkspaceOrigin string `json:"workspaceOrigin,omitempty"` // Workspace holds the workspace info Workspace *Workspace `json:"workspace,omitempty"` // LastDevContainerConfig can be used as a fallback if the workspace was already started // and we lost track of the devcontainer.json LastDevContainerConfig *devcontainerconfig.DevContainerConfigWithPath `json:"lastDevContainerConfig,omitempty"` // Machine holds the machine info Machine *Machine `json:"machine,omitempty"` // Agent holds the agent info Agent ProviderAgentConfig `json:"agent,omitempty"` // CLIOptions holds the cli options CLIOptions CLIOptions `json:"cliOptions,omitempty"` // Options holds the filled provider options for this workspace Options map[string]config.OptionValue `json:"options,omitempty"` // ContentFolder holds the folder where the content is stored ContentFolder string `json:"contentFolder,omitempty"` // Origin holds the folder where this config was loaded from Origin string `json:"-"` }
func CloneAgentWorkspaceInfo ¶ added in v0.3.0
func CloneAgentWorkspaceInfo(agentWorkspaceInfo *AgentWorkspaceInfo) *AgentWorkspaceInfo
type BuildOptions ¶ added in v0.5.0
type BuildOptions struct { CLIOptions Platform string NoBuild bool }
type CLIOptions ¶ added in v0.3.0
type CLIOptions struct { // up options ID string `json:"id,omitempty"` Source string `json:"source,omitempty"` IDE string `json:"ide,omitempty"` IDEOptions []string `json:"ideOptions,omitempty"` PrebuildRepositories []string `json:"prebuildRepositories,omitempty"` DevContainerImage string `json:"devContainerImage,omitempty"` DevContainerPath string `json:"devContainerPath,omitempty"` WorkspaceEnv []string `json:"workspaceEnv,omitempty"` WorkspaceEnvFile []string `json:"workspaceEnvFile,omitempty"` InitEnv []string `json:"initEnv,omitempty"` Recreate bool `json:"recreate,omitempty"` Reset bool `json:"reset,omitempty"` Proxy bool `json:"proxy,omitempty"` DisableDaemon bool `json:"disableDaemon,omitempty"` DaemonInterval string `json:"daemonInterval,omitempty"` ForceCredentials bool `json:"forceCredentials,omitempty"` GitBranch string `json:"gitBranch,omitempty"` GitCommit string `json:"gitCommit,omitempty"` GitCloneStrategy git.CloneStrategy `json:"gitCloneStrategy,omitempty"` FallbackImage string `json:"fallbackImage,omitempty"` // build options Repository string `json:"repository,omitempty"` SkipPush bool `json:"skipPush,omitempty"` Platform []string `json:"platform,omitempty"` ForceBuild bool `json:"forceBuild,omitempty"` ForceDockerless bool `json:"forceDockerless,omitempty"` ForceInternalBuildKit bool `json:"forceInternalBuildKit,omitempty"` SSHKey string `json:"sshkey,omitempty"` }
type ContainerWorkspaceInfo ¶ added in v0.4.0
type ContainerWorkspaceInfo struct { // IDE holds the ide config options IDE WorkspaceIDEConfig `json:"ide,omitempty"` // CLIOptions holds the cli options CLIOptions CLIOptions `json:"cliOptions,omitempty"` // Dockerless holds custom dockerless configuration Dockerless ProviderDockerlessOptions `json:"dockerless,omitempty"` // ContainerTimeout is the timeout in minutes to wait until the agent tries // to delete the container. ContainerTimeout string `json:"containerInactivityTimeout,omitempty"` }
type ExportConfig ¶ added in v0.5.0
type ExportConfig struct { // Workspace is the workspace that was exported Workspace *ExportWorkspaceConfig `json:"workspace,omitempty"` // Machine is the machine that was exported Machine *ExportMachineConfig `json:"machine,omitempty"` // Provider is the provider that was exported Provider *ExportProviderConfig `json:"provider,omitempty"` }
type ExportMachineConfig ¶ added in v0.5.0
type ExportMachineConfig struct { // ID is the machine id ID string `json:"id,omitempty"` // Context is the machine context Context string `json:"context,omitempty"` // Data is the machine folder data Data string `json:"data,omitempty"` }
func ExportMachine ¶ added in v0.5.0
func ExportMachine(context, machineID string) (*ExportMachineConfig, error)
type ExportProviderConfig ¶ added in v0.5.0
type ExportProviderConfig struct { // ID is the provider id ID string `json:"id,omitempty"` // Context is the provider context Context string `json:"context,omitempty"` // Data is the provider folder data Data string `json:"data,omitempty"` // Config is the provider config within the config.yaml Config *config.ProviderConfig `json:"config,omitempty"` }
func ExportProvider ¶ added in v0.5.0
func ExportProvider(devPodConfig *config.Config, context, providerID string) (*ExportProviderConfig, error)
type ExportWorkspaceConfig ¶ added in v0.5.0
type ExportWorkspaceConfig struct { // ID is the workspace id ID string `json:"id,omitempty"` // Context is the workspace context Context string `json:"context,omitempty"` // UID is used to identify this specific workspace UID string `json:"uid,omitempty"` // Data is the workspace folder data Data string `json:"data,omitempty"` }
func ExportWorkspace ¶ added in v0.5.0
func ExportWorkspace(context, workspaceID string) (*ExportWorkspaceConfig, error)
type Machine ¶
type Machine struct { // ID is the machine id to use ID string `json:"id,omitempty"` // Provider is the provider used to create this workspace Provider MachineProviderConfig `json:"provider,omitempty"` // CreationTimestamp is the timestamp when this workspace was created CreationTimestamp types.Time `json:"creationTimestamp,omitempty"` // Context is the context where this config file was loaded from Context string `json:"context,omitempty"` // Origin is the place where this config file was loaded from Origin string `json:"-"` }
func CloneMachine ¶
func LoadMachineConfig ¶
type MachineProviderConfig ¶
type MachineProviderConfig struct { // Name is the provider name used to deploy this machine Name string `json:"name,omitempty"` // Options are the local options that override the global ones Options map[string]config.OptionValue `json:"options,omitempty"` }
type ProInstance ¶ added in v0.3.5
type ProInstance struct { // Provider is the provider name this pro instance belongs to Provider string `json:"provider,omitempty"` // Host is the Loft DevPod Pro host to use Host string `json:"host,omitempty"` // CreationTimestamp is the timestamp when this pro instance was created CreationTimestamp types.Time `json:"creationTimestamp,omitempty"` }
func LoadProInstanceConfig ¶ added in v0.3.5
func LoadProInstanceConfig(context, proInstanceHost string) (*ProInstance, error)
type ProviderAgentConfig ¶
type ProviderAgentConfig struct { // Local defines if DevPod is running locally Local types.StrBool `json:"local,omitempty"` // Path is the binary path inside the server devpod will expect the agent binary Path string `json:"path,omitempty"` // DataPath is the agent path where data is stored DataPath string `json:"dataPath,omitempty"` // DownloadURL is the base url where to download the agent from DownloadURL string `json:"downloadURL,omitempty"` // Timeout is the timeout in minutes to wait until the agent tries // to turn of the server. Timeout string `json:"inactivityTimeout,omitempty"` // ContainerTimeout is the timeout in minutes to wait until the agent tries // to delete the container. ContainerTimeout string `json:"containerInactivityTimeout,omitempty"` // InjectGitCredentials signals DevPod if git credentials should get synced into // the remote machine for cloning the repository. InjectGitCredentials types.StrBool `json:"injectGitCredentials,omitempty"` // InjectDockerCredentials signals DevPod if docker credentials should get synced // into the remote machine for pulling and pushing images. InjectDockerCredentials types.StrBool `json:"injectDockerCredentials,omitempty"` // Exec commands that can be used on the remote Exec ProviderAgentConfigExec `json:"exec,omitempty"` // Binaries is an optional field to specify a binary to execute the commands Binaries map[string][]*ProviderBinary `json:"binaries,omitempty"` // Dockerless holds custom dockerless configuration Dockerless ProviderDockerlessOptions `json:"dockerless,omitempty"` // Driver is the driver to use for deploying the devcontainer. Currently supports // docker (default) or kubernetes (experimental) Driver string `json:"driver,omitempty"` // Docker holds docker specific configuration Docker ProviderDockerDriverConfig `json:"docker,omitempty"` // Custom holds custom driver specific configuration Custom ProviderCustomDriverConfig `json:"custom,omitempty"` }
func (ProviderAgentConfig) IsDockerDriver ¶ added in v0.4.0
func (a ProviderAgentConfig) IsDockerDriver() bool
type ProviderAgentConfigExec ¶
type ProviderBinary ¶
type ProviderBinary struct { // The current OS OS string `json:"os,omitempty"` // The current Arch Arch string `json:"arch,omitempty"` // Checksum is the sha256 hash of the binary Checksum string `json:"checksum,omitempty"` // Path is the binary url to download from or relative path to use Path string `json:"path,omitempty"` // ArchivePath is the path within the archive to extract ArchivePath string `json:"archivePath,omitempty"` // Name is the name of the binary to store locally Name string `json:"name,omitempty"` }
type ProviderCommands ¶
type ProviderCommands struct { // Init is run directly after `devpod provider use` Init types.StrArray `json:"init,omitempty"` // Command executes a command on the server Command types.StrArray `json:"command,omitempty"` // Create creates a new server Create types.StrArray `json:"create,omitempty"` // Delete destroys a server Delete types.StrArray `json:"delete,omitempty"` // Start starts a stopped server Start types.StrArray `json:"start,omitempty"` // Stop stops a running server Stop types.StrArray `json:"stop,omitempty"` // Status retrieves the server status Status types.StrArray `json:"status,omitempty"` // Proxy proxies commands Proxy *ProxyCommands `json:"proxy,omitempty"` }
type ProviderConfig ¶
type ProviderConfig struct { // Name is the name of the provider Name string `json:"name,omitempty"` // Version is the provider version Version string `json:"version,omitempty"` // Icon holds an image URL that will be displayed Icon string `json:"icon,omitempty"` // IconDark holds an image URL that will be displayed in dark mode IconDark string `json:"iconDark,omitempty"` // Home holds the provider home URL Home string `json:"home,omitempty"` // Source is the source the provider was loaded from Source ProviderSource `json:"source,omitempty"` // Description is the provider description Description string `json:"description,omitempty"` // OptionGroups holds information how to display options OptionGroups []ProviderOptionGroup `json:"optionGroups,omitempty"` // Options are the provider options. Options map[string]*types.Option `json:"options,omitempty"` // Agent allows you to override agent configuration Agent ProviderAgentConfig `json:"agent,omitempty"` // Exec holds the provider commands Exec ProviderCommands `json:"exec,omitempty"` // Binaries is an optional field to specify a binary to execute the commands Binaries map[string][]*ProviderBinary `json:"binaries,omitempty"` }
func LoadProviderConfig ¶
func LoadProviderConfig(context, provider string) (*ProviderConfig, error)
func ParseProvider ¶
func ParseProvider(reader io.Reader) (*ProviderConfig, error)
func (*ProviderConfig) IsMachineProvider ¶
func (c *ProviderConfig) IsMachineProvider() bool
func (*ProviderConfig) IsProxyProvider ¶ added in v0.2.0
func (c *ProviderConfig) IsProxyProvider() bool
type ProviderCustomDriverConfig ¶ added in v0.4.0
type ProviderCustomDriverConfig struct { // FindDevContainer is used to find an existing devcontainer FindDevContainer types.StrArray `json:"findDevContainer,omitempty"` // CommandDevContainer is used to execute a command in the devcontainer CommandDevContainer types.StrArray `json:"commandDevContainer,omitempty"` // TargetArchitecture is used to find out the target architecture TargetArchitecture types.StrArray `json:"targetArchitecture,omitempty"` // RunDevContainer is used to actually run the devcontainer RunDevContainer types.StrArray `json:"runDevContainer,omitempty"` // StartDevContainer is used to start the devcontainer StartDevContainer types.StrArray `json:"startDevContainer,omitempty"` // StopDevContainer is used to stop the devcontainer StopDevContainer types.StrArray `json:"stopDevContainer,omitempty"` // DeleteDevContainer is used to delete the devcontainer DeleteDevContainer types.StrArray `json:"deleteDevContainer,omitempty"` // CanReprovision returns true if the driver can reprovision the devcontainer CanReprovision types.StrBool `json:"canReprovision,omitempty"` // GetDevContainerLogs returns the logs of the devcontainer GetDevContainerLogs types.StrArray `json:"getDevContainerLogs,omitempty"` }
type ProviderDockerDriverConfig ¶
type ProviderDockerDriverConfig struct { // Path where to find the docker binary, defaults to 'docker' Path string `json:"path,omitempty"` // If false, DevPod will not try to install docker into the machine. Install types.StrBool `json:"install,omitempty"` // Builder to use with docker Builder string `json:"builder,omitempty"` // Environment variables to set when running docker commands Env map[string]string `json:"env,omitempty"` }
type ProviderDockerlessOptions ¶ added in v0.4.0
type ProviderDockerlessOptions struct { // Disabled signals if dockerless building is disabled Disabled types.StrBool `json:"disabled,omitempty"` // Image is the image of the dockerless container to start Image string `json:"image,omitempty"` // IgnorePaths are additional ignore paths that should be ignored during deletion IgnorePaths string `json:"ignorePaths,omitempty"` // DisableDockerCredentials prevents docker credentials from getting injected DisableDockerCredentials types.StrBool `json:"disableDockerCredentials,omitempty"` }
type ProviderOptionGroup ¶
type ProviderOptionGroup struct { // Name is the display name of the option group Name string `json:"name,omitempty"` // Options are the options that belong to this group Options []string `json:"options,omitempty"` // DefaultVisible defines if the option group should be visible by default DefaultVisible bool `json:"defaultVisible,omitempty"` }
type ProviderSource ¶
type ProviderSource struct { // Internal means provider was received internally Internal bool `json:"internal,omitempty"` // Github source for the provider Github string `json:"github,omitempty"` // File source for the provider File string `json:"file,omitempty"` // URL where the provider was downloaded from URL string `json:"url,omitempty"` // Raw is the exact string we used to load the provider Raw string `json:"raw,omitempty"` }
type ProxyCommands ¶ added in v0.2.0
type ProxyCommands struct { // Up proxies the up command Up types.StrArray `json:"up,omitempty"` // Stop proxies the stop command Stop types.StrArray `json:"stop,omitempty"` // Delete proxies the delete command Delete types.StrArray `json:"delete,omitempty"` // Ssh proxies the ssh command Ssh types.StrArray `json:"ssh,omitempty"` // Status proxies the status command Status types.StrArray `json:"status,omitempty"` }
type SubOptions ¶ added in v0.3.0
type Workspace ¶
type Workspace struct { // ID is the workspace id to use ID string `json:"id,omitempty"` // UID is used to identify this specific workspace UID string `json:"uid,omitempty"` // Picture is the project social media image Picture string `json:"picture,omitempty"` // Provider is the provider used to create this workspace Provider WorkspaceProviderConfig `json:"provider,omitempty"` // Machine is the machine to use for this workspace Machine WorkspaceMachineConfig `json:"machine,omitempty"` // IDE holds IDE specific settings IDE WorkspaceIDEConfig `json:"ide,omitempty"` // Source is the source where this workspace will be created from Source WorkspaceSource `json:"source,omitempty"` // DevContainerImage is the container image to use, overriding whatever is in the devcontainer.json DevContainerImage string `json:"devContainerImage,omitempty"` // DevContainerPath is the relative path where the devcontainer.json is located. DevContainerPath string `json:"devContainerPath,omitempty"` // DevContainerConfig holds the config for the devcontainer.json. DevContainerConfig *devcontainerconfig.DevContainerConfig `json:"devContainerConfig,omitempty"` // CreationTimestamp is the timestamp when this workspace was created CreationTimestamp types.Time `json:"creationTimestamp,omitempty"` // LastUsedTimestamp holds the timestamp when this workspace was last accessed LastUsedTimestamp types.Time `json:"lastUsed,omitempty"` // Context is the context where this config file was loaded from Context string `json:"context,omitempty"` // Imported signals that this workspace was imported Imported bool `json:"imported,omitempty"` // Origin is the place where this config file was loaded from Origin string `json:"-"` // Path to the file where the SSH config to access the workspace is stored SSHConfigPath string `json:"sshConfigPath,omitempty"` }
func CloneWorkspace ¶
func LoadWorkspaceConfig ¶
type WorkspaceIDEConfig ¶
type WorkspaceIDEConfig struct { // Name is the name of the IDE Name string `json:"name,omitempty"` // Options are the local options that override the global ones Options map[string]config.OptionValue `json:"options,omitempty"` }
type WorkspaceMachineConfig ¶
type WorkspaceProviderConfig ¶
type WorkspaceProviderConfig struct { // Name is the provider name Name string `json:"name,omitempty"` // Options are the local options that override the global ones Options map[string]config.OptionValue `json:"options,omitempty"` }
type WorkspaceSource ¶
type WorkspaceSource struct { // GitRepository is the repository to clone GitRepository string `json:"gitRepository,omitempty"` // GitBranch is the branch to use GitBranch string `json:"gitBranch,omitempty"` // GitCommit is the commit SHA to checkout GitCommit string `json:"gitCommit,omitempty"` // GitPRReference is the pull request reference to checkout GitPRReference string `json:"gitPRReference,omitempty"` // GitSubPath is the subpath in the repo to use GitSubPath string `json:"gitSubDir,omitempty"` // LocalFolder is the local folder to use LocalFolder string `json:"localFolder,omitempty"` // Image is the docker image to use Image string `json:"image,omitempty"` // Container is the container to use Container string `json:"container,omitempty"` }
func ParseWorkspaceSource ¶ added in v0.2.0
func ParseWorkspaceSource(source string) *WorkspaceSource
func (WorkspaceSource) String ¶
func (w WorkspaceSource) String() string
Click to show internal directories.
Click to hide internal directories.