Documentation
¶
Index ¶
- Constants
- func RunDotfiles(ctx context.Context, cfg DotfilesConfig) error
- func RunPostAttachHooks(ctx context.Context, setupInfo *config.Result, secretsEnv []string, ...) error
- func SetupContainerPostAttach(ctx context.Context, cfg *ContainerSetupConfig) error
- type ContainerSetupConfig
- type DeferredHooks
- type DotfilesConfig
- type LifecyclePhase
- type SkipPhases
Constants ¶
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
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
SkipPhases controls which lifecycle phases should be skipped.