devcontainer

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MPL-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigFilesLabel                = pkgconfig.ComposeConfigFilesLabel
	FeaturesBuildOverrideFilePrefix = "docker-compose.devcontainer.build"
	FeaturesStartOverrideFilePrefix = "docker-compose.devcontainer.containerFeatures"
)
View Source
const (
	DevsyExtraEnvVar            = "DEVSY"
	RemoteContainersExtraEnvVar = "REMOTE_CONTAINERS"
)

Variables

View Source
var DefaultEntrypoint = joinShellStatements(
	`while ! command -v /usr/local/bin/devsy >/dev/null 2>&1; do echo "waiting for devsy agent to be available"`,
	"sleep 1",
	"done",
	"exec /usr/local/bin/devsy internal agent container daemon",
)

DefaultEntrypoint waits for the devsy agent binary to become available before handing off to the container daemon.

Functions

func CleanupImportedDevContainers added in v1.10.0

func CleanupImportedDevContainers(workspaceFolder string) error

func GetContainerEntrypointAndArgs

func GetContainerEntrypointAndArgs(
	mergedConfig *config.MergedDevContainerConfig,
	imageDetails *config.ImageDetails,
) (string, []string)

func GetRunnerIDFromWorkspace

func GetRunnerIDFromWorkspace(workspace *provider.Workspace) string

func GetStartScript

func GetStartScript(mergedConfig *config.MergedDevContainerConfig) string

func ResolveSourceSpec added in v1.10.0

func ResolveSourceSpec(opts *provider.CLIOptions) error

Types

type CommandParams added in v1.3.1

type CommandParams struct {
	User    string
	Command string
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
}

CommandParams groups the inputs for running a command inside the dev container.

type DeleteOptions added in v1.1.0

type DeleteOptions struct {
	RemoveVolumes bool
}

type GetWorkspaceConfigResult

type GetWorkspaceConfigResult struct {
	IsImage         bool     `json:"isImage"`
	IsGitRepository bool     `json:"isGitRepository"`
	IsLocal         bool     `json:"isLocal"`
	ConfigPaths     []string `json:"configPaths"`
}

func FindDevcontainerFiles

func FindDevcontainerFiles(
	ctx context.Context,
	rawSource, tmpDirPath string,
	maxDepth int,
	strictHostKeyChecking bool,
) (*GetWorkspaceConfigResult, error)

func FindFilesInLocalDir

func FindFilesInLocalDir(
	rawSource string,
	maxDepth int,
) (*GetWorkspaceConfigResult, error)

type Runner

type Runner interface {
	Up(
		ctx context.Context,
		options UpOptions,
		timeout time.Duration,
		reporter status.Reporter,
	) (*config.Result, error)
	Build(ctx context.Context, options provider.BuildOptions) (string, error)
	Find(ctx context.Context) (*config.ContainerDetails, error)
	Command(ctx context.Context, params CommandParams) error
	Stop(ctx context.Context) error
	Delete(ctx context.Context, options DeleteOptions) error
	Logs(ctx context.Context, writer io.Writer) error
}

Runner drives the lifecycle of a single workspace's dev container.

func NewRunner

func NewRunner(
	ctx context.Context,
	agentPath, agentDownloadURL string,
	workspaceConfig *provider.AgentWorkspaceInfo,
) (Runner, error)

type SourceKind added in v1.10.0

type SourceKind string
const (
	SourceNone  SourceKind = "none"
	SourceImage SourceKind = "image"
	SourceID    SourceKind = "id"
	SourcePath  SourceKind = "path"
)

type SourceSpec added in v1.10.0

type SourceSpec struct {
	Kind  SourceKind
	Image string
	ID    string
	Path  string
}

func ParseSourceSpec added in v1.10.0

func ParseSourceSpec(value string) (*SourceSpec, error)

type UpOptions

type UpOptions struct {
	provider.CLIOptions

	// NoBuild is set by the container tunnel to force pre-built images; it is
	// distinct from the embedded CLIOptions.NoBuild used by the build command.
	NoBuild bool
	// RegistryCache is sourced from AgentWorkspaceInfo.RegistryCache (a provider
	// context option), not from CLIOptions, so it is a separate field.
	RegistryCache string
}

UpOptions configures a single Up invocation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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