setup

package
v1.3.0-rc.21 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultWaitFor = PhaseUpdateContent

DefaultWaitFor is the spec-defined default for the waitFor property.

Variables

This section is empty.

Functions

func RunDotfiles added in v1.1.0

func RunDotfiles(ctx context.Context, cfg DotfilesConfig) error

RunDotfiles clones the dotfiles repository and runs the install script inside the container. It is a no-op when repo is empty. The caller is responsible for marker-file checks.

func RunPostAttachHooks

func RunPostAttachHooks(
	ctx context.Context,
	setupInfo *config.Result,
	secretsEnv []string,
	skipPostAttach ...bool,
) error

RunPostAttachHooks runs postAttachCommand only. These run after the IDE has been opened and can be long-running.

func SetupContainerPostAttach

func SetupContainerPostAttach(ctx context.Context, cfg *ContainerSetupConfig) error

SetupContainerPostAttach runs postAttachCommand only. Called after the IDE has been opened.

Types

type ContainerSetupConfig

type ContainerSetupConfig struct {
	SetupInfo         *config.Result
	ExtraWorkspaceEnv []string
	SecretsEnv        []string
	ChownProjects     bool
	Prebuild          bool
	PlatformOptions   *devsy.PlatformOptions
	TunnelClient      tunnel.TunnelClient
	Dotfiles          DotfilesConfig
	SkipPostCreate    bool
	SkipPostStart     bool
	SkipPostAttach    bool
}

type DeferredHooks added in v1.1.0

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

DeferredHooks holds lifecycle hooks that should run in the background after the foreground (waitFor) hooks have completed.

func RunPreAttachHooks

func RunPreAttachHooks(
	ctx context.Context,
	setupInfo *config.Result,
	prebuild bool,
	dotfiles DotfilesConfig,
	secretsEnv []string,
	skip SkipPhases,
) (DeferredHooks, error)

RunPreAttachHooks runs lifecycle hooks up to and including the waitFor phase synchronously and returns a slice of deferred phases that should run in the background. Dotfiles are installed between postCreateCommand and postStartCommand per the devcontainer spec.

When prebuild is true, only onCreateCommand and updateContentCommand are executed and waitFor is ignored.

func SetupContainerPreAttach

func SetupContainerPreAttach(
	ctx context.Context,
	cfg *ContainerSetupConfig,
) (DeferredHooks, error)

SetupContainerPreAttach runs container setup up to and including the waitFor lifecycle phase. Hooks after waitFor are returned as DeferredHooks for the caller to launch in the background.

func (DeferredHooks) Empty added in v1.1.0

func (d DeferredHooks) Empty() bool

Empty returns true when there are no deferred hooks with work to run.

func (DeferredHooks) Run added in v1.1.0

func (d DeferredHooks) Run() error

Run executes all deferred hooks sequentially.

type DotfilesConfig added in v1.1.0

type DotfilesConfig struct {
	Repository    string
	InstallScript string
	RemoteUser    string
}

DotfilesConfig holds the parameters needed to install dotfiles inside the container as part of the lifecycle.

type LifecyclePhase added in v1.1.0

type LifecyclePhase string

LifecyclePhase identifies a devcontainer lifecycle command.

const (
	PhaseInitializeCommand LifecyclePhase = "initializeCommand"
	PhaseOnCreate          LifecyclePhase = "onCreateCommand"
	PhaseUpdateContent     LifecyclePhase = "updateContentCommand"
	PhasePostCreate        LifecyclePhase = "postCreateCommand"
	PhasePostStart         LifecyclePhase = "postStartCommand"
	PhasePostAttach        LifecyclePhase = "postAttachCommand"
)
const PhaseDotfiles LifecyclePhase = "dotfilesInstall"

PhaseDotfiles is a synthetic lifecycle phase for dotfiles installation. Per the devcontainer spec, dotfiles run after postCreateCommand and before postStartCommand.

type SkipPhases added in v1.1.0

type SkipPhases struct {
	PostCreate bool
	PostStart  bool
	PostAttach bool
}

SkipPhases controls which lifecycle phases should be skipped.

Jump to

Keyboard shortcuts

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