Thanks to visit codestin.com
Credit goes to pkg.go.dev

agentcontainers

package
v2.21.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAndInitializeDevcontainerScripts added in v2.21.0

func ExtractAndInitializeDevcontainerScripts(
	logger slog.Logger,
	expandPath func(string) (string, error),
	devcontainers []codersdk.WorkspaceAgentDevcontainer,
	scripts []codersdk.WorkspaceAgentScript,
) (filteredScripts []codersdk.WorkspaceAgentScript, devcontainerScripts []codersdk.WorkspaceAgentScript)

ExtractAndInitializeDevcontainerScripts extracts devcontainer scripts from the given scripts and devcontainers. The devcontainer scripts are removed from the returned scripts so that they can be run separately.

Dev Containers have an inherent dependency on start scripts, since they initialize the workspace (e.g. git clone, npm install, etc). This is important if e.g. a Coder module to install @devcontainer/cli is used.

func New

func New(options ...Option) http.Handler

New returns a new devcontainersHandler with the given options applied.

Types

type DockerCLILister

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

DockerCLILister is a ContainerLister that lists containers using the docker CLI

func (*DockerCLILister) List

type DockerEnvInfoer

type DockerEnvInfoer struct {
	usershell.SystemEnvInfo
	// contains filtered or unexported fields
}

DockerEnvInfoer is an implementation of agentssh.EnvInfoer that returns information about a container.

func EnvInfo

func EnvInfo(ctx context.Context, execer agentexec.Execer, container, containerUser string) (*DockerEnvInfoer, error)

EnvInfo returns information about the environment of a container.

func (*DockerEnvInfoer) ModifyCommand

func (dei *DockerEnvInfoer) ModifyCommand(cmd string, args ...string) (string, []string)

func (*DockerEnvInfoer) Shell added in v2.21.0

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

func (*DockerEnvInfoer) User added in v2.21.0

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

type Lister

type Lister interface {
	// List returns a list of containers visible to the workspace agent.
	// This should include running and stopped containers.
	List(ctx context.Context) (codersdk.WorkspaceAgentListContainersResponse, error)
}

Lister is an interface for listing containers visible to the workspace agent.

func NewDocker

func NewDocker(execer agentexec.Execer) Lister

type NoopLister

type NoopLister struct{}

NoopLister is a Lister interface that never returns any containers.

type Option

type Option func(*devcontainersHandler)

Option is a functional option for devcontainersHandler.

func WithLister

func WithLister(cl Lister) Option

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

Directories

Path Synopsis
Package acmock is a generated GoMock package.
Package acmock is a generated GoMock package.
Code generated by dcspec/gen.sh.
Code generated by dcspec/gen.sh.

Jump to

Keyboard shortcuts

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