Movatterモバイル変換


[0]ホーム

URL:


agentcontainers

package
v2.23.0Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License:AGPL-3.0Imports:34Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

View Source
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

funcExpandAllDevcontainerPathsadded 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.

funcExtractAndInitializeDevcontainerScriptsadded 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

typeAPIadded 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.

funcNewAPIadded inv2.22.0

func NewAPI(loggerslog.Logger, options ...Option) *API

NewAPI returns a new API with the given options applied.

func (*API)Closeadded inv2.22.0

func (api *API) Close()error

func (*API)Routesadded inv2.22.0

func (api *API) Routes()http.Handler

Routes returns the HTTP handler for container-related routes.

typeDevcontainerCLIadded inv2.22.0

type DevcontainerCLI interface {Up(ctxcontext.Context, workspaceFolder, configPathstring, opts ...DevcontainerCLIUpOptions) (idstring, errerror)}

DevcontainerCLI is an interface for the devcontainer CLI.

funcNewDevcontainerCLIadded inv2.22.0

func NewDevcontainerCLI(loggerslog.Logger, execeragentexec.Execer)DevcontainerCLI

typeDevcontainerCLIUpOptionsadded inv2.22.0

type DevcontainerCLIUpOptions func(*devcontainerCLIUpConfig)

DevcontainerCLIUpOptions are options for the devcontainer CLI upcommand.

funcWithOutputadded inv2.23.0

func WithOutput(stdout, stderrio.Writer)DevcontainerCLIUpOptions

WithOutput sets stdout and stderr writers for Up command logs.

funcWithRemoveExistingContaineradded 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

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)

func (*DockerEnvInfoer)Shelladded inv2.21.0

func (dei *DockerEnvInfoer) Shell(string) (string,error)

func (*DockerEnvInfoer)Useradded inv2.21.0

func (dei *DockerEnvInfoer) User() (*user.User,error)

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.

funcNewDocker

func NewDocker(execeragentexec.Execer)Lister

typeNoopLister

type NoopLister struct{}

NoopLister is a Lister interface that never returns any containers.

typeOption

type Option func(*API)

Option is a functional option for API.

funcWithClockadded inv2.22.0

func WithClock(clockquartz.Clock)Option

WithClock sets the quartz.Clock implementation to use.This is primarily used for testing to control time.

funcWithDevcontainerCLIadded 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.

funcWithDevcontainersadded 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.

funcWithExeceradded inv2.22.0

func WithExecer(execeragentexec.Execer)Option

WithExecer sets the agentexec.Execer implementation to use.

funcWithLister

func WithLister(clLister)Option

WithLister sets the agentcontainers.Lister implementation to use.The default implementation uses the Docker CLI to list containers.

funcWithScriptLoggeradded inv2.23.0

func WithScriptLogger(scriptLogger func(logSourceIDuuid.UUID)ScriptLogger)Option

WithScriptLogger sets the script logger provider for devcontainer operations.

funcWithWatcheradded inv2.22.0

func WithWatcher(wwatcher.Watcher)Option

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).

typeScriptLoggeradded inv2.23.0

type ScriptLogger interface {Send(ctxcontext.Context, log ...agentsdk.Log)errorFlush(ctxcontext.Context)error}

ScriptLogger is an interface for sending devcontainer logs to thecontrolplane.

Source Files

View all Source files

Directories

PathSynopsis
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp