status

package
v1.13.0-beta.2 Latest Latest
Warning

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

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

Documentation

Overview

Package status defines the structured progress events emitted by long-running commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enter

func Enter(r Reporter, phase Phase, step string)

func Fail

func Fail(r Reporter, phase Phase, err error)

func Leave

func Leave(r Reporter, phase Phase, step string)

Types

type Event

type Event struct {
	Pipeline Pipeline `json:"pipeline,omitempty"`
	Phase    Phase    `json:"phase"`
	Step     string   `json:"step,omitempty"`
	Started  bool     `json:"started"`
	Err      string   `json:"error,omitempty"`
}

Event is one phase transition.

type Phase

type Phase string

Phase identifies a step in a pipeline. PhaseReady and PhaseFailed are shared terminal phases.

const (
	PhaseCloningRepository    Phase = "cloning_repository"
	PhaseResolvingConfig      Phase = "resolving_config"
	PhaseInitializeCommand    Phase = "initialize_command"
	PhaseBuildingImage        Phase = "building_image"
	PhaseStartingContainer    Phase = "starting_container"
	PhaseInjectingAgent       Phase = "injecting_agent"
	PhaseRunningLifecycleHook Phase = "running_lifecycle_hook"
	PhaseWaitingFor           Phase = "waiting_for"
	PhaseReady                Phase = "ready"
	PhaseFailed               Phase = "failed"
)

Workspace up phases.

const (
	PhaseInstallingProvider Phase = "installing_provider"
	PhaseResolvingOptions   Phase = "resolving_options"
	PhaseRunningInit        Phase = "running_init"
)

Provider phases. Installing covers source resolution and binary download; ResolvingOptions and RunningInit are the two halves of provider init, split because only the latter executes provider-supplied code.

type Pipeline

type Pipeline string

Pipeline identifies which command's progress an Event describes.

const (
	PipelineWorkspaceUp Pipeline = "workspace_up"
	PipelineProvider    Pipeline = "provider"
)

type Reporter

type Reporter interface {
	Report(Event)
}

Reporter receives status events as they occur. Implementations must be safe to call from goroutines.

func ForPipeline

func ForPipeline(r Reporter, pipeline Pipeline) Reporter

ForPipeline stamps every event a reporter receives with pipeline, so the Enter/Leave/Fail helpers stay pipeline-agnostic and each producer declares its pipeline once where it builds its reporter.

func NewLogReporter

func NewLogReporter() Reporter

NewLogReporter returns a Reporter that logs each event at debug level.

func Nop

func Nop() Reporter

func Tee

func Tee(reporters ...Reporter) Reporter

Tee forwards every event to each reporter.

Jump to

Keyboard shortcuts

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