agentcontainers
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Constants
- func ExpandAllDevcontainerPaths(logger slog.Logger, expandPath func(string) (string, error), ...) []codersdk.WorkspaceAgentDevcontainer
- func ExtractAndInitializeDevcontainerScripts(devcontainers []codersdk.WorkspaceAgentDevcontainer, ...) (filteredScripts []codersdk.WorkspaceAgentScript, ...)
- type API
- type DevcontainerCLI
- type DevcontainerCLIUpOptions
- type DockerCLILister
- type DockerEnvInfoer
- type Lister
- type NoopLister
- type Option
- func WithClock(clock quartz.Clock) Option
- func WithDevcontainerCLI(dccli DevcontainerCLI) Option
- func WithDevcontainers(devcontainers []codersdk.WorkspaceAgentDevcontainer, ...) Option
- func WithExecer(execer agentexec.Execer) Option
- func WithLister(cl Lister) Option
- func WithScriptLogger(scriptLogger func(logSourceID uuid.UUID) ScriptLogger) Option
- func WithWatcher(w watcher.Watcher) Option
- type ScriptLogger
Constants¶
const (// DevcontainerLocalFolderLabel is the label that contains the path to// the local workspace folder for a devcontainer.DevcontainerLocalFolderLabel = "devcontainer.local_folder"// DevcontainerConfigFileLabel is the label that contains the path to// the devcontainer.json configuration file.DevcontainerConfigFileLabel = "devcontainer.config_file")
Variables¶
This section is empty.
Functions¶
funcExpandAllDevcontainerPaths¶added inv2.23.0
func ExpandAllDevcontainerPaths(loggerslog.Logger, expandPath func(string) (string,error), devcontainers []codersdk.WorkspaceAgentDevcontainer) []codersdk.WorkspaceAgentDevcontainer
ExpandAllDevcontainerPaths expands all devcontainer paths in the givendevcontainers. This is required by the devcontainer CLI, which requiresabsolute paths for the workspace folder and config path.
funcExtractAndInitializeDevcontainerScripts¶added inv2.21.0
func ExtractAndInitializeDevcontainerScripts(devcontainers []codersdk.WorkspaceAgentDevcontainer,scripts []codersdk.WorkspaceAgentScript,) (filteredScripts []codersdk.WorkspaceAgentScript, devcontainerScripts []codersdk.WorkspaceAgentScript)
ExtractAndInitializeDevcontainerScripts extracts devcontainer scripts fromthe given scripts and devcontainers. The devcontainer scripts are removedfrom the returned scripts so that they can be run separately.
Dev Containers have an inherent dependency on start scripts, since theyinitialize the workspace (e.g. git clone, npm install, etc). This isimportant if e.g. a Coder module to install @devcontainer/cli is used.
Types¶
typeAPI¶added inv2.22.0
type API struct {// contains filtered or unexported fields}
API is responsible for container-related operations in the agent.It provides methods to list and manage containers.
typeDevcontainerCLI¶added inv2.22.0
type DevcontainerCLI interface {Up(ctxcontext.Context, workspaceFolder, configPathstring, opts ...DevcontainerCLIUpOptions) (idstring, errerror)}
DevcontainerCLI is an interface for the devcontainer CLI.
funcNewDevcontainerCLI¶added inv2.22.0
func NewDevcontainerCLI(loggerslog.Logger, execeragentexec.Execer)DevcontainerCLI
typeDevcontainerCLIUpOptions¶added inv2.22.0
type DevcontainerCLIUpOptions func(*devcontainerCLIUpConfig)
DevcontainerCLIUpOptions are options for the devcontainer CLI upcommand.
funcWithOutput¶added inv2.23.0
func WithOutput(stdout, stderrio.Writer)DevcontainerCLIUpOptions
WithOutput sets stdout and stderr writers for Up command logs.
funcWithRemoveExistingContainer¶added inv2.22.0
func WithRemoveExistingContainer()DevcontainerCLIUpOptions
WithRemoveExistingContainer is an option to remove the existingcontainer.
typeDockerCLILister¶
type DockerCLILister struct {// contains filtered or unexported fields}
DockerCLILister is a ContainerLister that lists containers using the docker CLI
func (*DockerCLILister)List¶
func (dcl *DockerCLILister) List(ctxcontext.Context) (codersdk.WorkspaceAgentListContainersResponse,error)
typeDockerEnvInfoer¶
type DockerEnvInfoer struct {usershell.SystemEnvInfo// contains filtered or unexported fields}
DockerEnvInfoer is an implementation of agentssh.EnvInfoer that returnsinformation about a container.
funcEnvInfo¶
func EnvInfo(ctxcontext.Context, execeragentexec.Execer, container, containerUserstring) (*DockerEnvInfoer,error)
EnvInfo returns information about the environment of a container.
func (*DockerEnvInfoer)ModifyCommand¶
func (dei *DockerEnvInfoer) ModifyCommand(cmdstring, args ...string) (string, []string)
typeLister¶
type Lister interface {// List returns a list of containers visible to the workspace agent.// This should include running and stopped containers.List(ctxcontext.Context) (codersdk.WorkspaceAgentListContainersResponse,error)}
Lister is an interface for listing containers visible to theworkspace agent.
typeNoopLister¶
type NoopLister struct{}
NoopLister is a Lister interface that never returns any containers.
func (NoopLister)List¶
func (NoopLister) List(_context.Context) (codersdk.WorkspaceAgentListContainersResponse,error)
typeOption¶
type Option func(*API)
Option is a functional option for API.
funcWithClock¶added inv2.22.0
WithClock sets the quartz.Clock implementation to use.This is primarily used for testing to control time.
funcWithDevcontainerCLI¶added inv2.22.0
func WithDevcontainerCLI(dccliDevcontainerCLI)Option
WithDevcontainerCLI sets the DevcontainerCLI implementation to use.This can be used in tests to modify @devcontainer/cli behavior.
funcWithDevcontainers¶added inv2.22.0
func WithDevcontainers(devcontainers []codersdk.WorkspaceAgentDevcontainer, scripts []codersdk.WorkspaceAgentScript)Option
WithDevcontainers sets the known devcontainers for the API. Thisallows the API to be aware of devcontainers defined in the workspaceagent manifest.
funcWithExecer¶added inv2.22.0
WithExecer sets the agentexec.Execer implementation to use.
funcWithLister¶
WithLister sets the agentcontainers.Lister implementation to use.The default implementation uses the Docker CLI to list containers.
funcWithScriptLogger¶added inv2.23.0
func WithScriptLogger(scriptLogger func(logSourceIDuuid.UUID)ScriptLogger)Option
WithScriptLogger sets the script logger provider for devcontainer operations.
funcWithWatcher¶added inv2.22.0
WithWatcher sets the file watcher implementation to use. By default anoop watcher is used. This can be used in tests to modify the watcherbehavior or to use an actual file watcher (e.g. fsnotify).
Source Files¶
Directories¶
Path | Synopsis |
---|---|
Package acmock is a generated GoMock package. | Package acmock is a generated GoMock package. |
Package dcspec contains an automatically generated Devcontainer specification. | Package dcspec contains an automatically generated Devcontainer specification. |
Package watcher provides file system watching capabilities for the agent. | Package watcher provides file system watching capabilities for the agent. |