Help us shape the future of Go! Take the 2026 Go Developer Survey

deployment

package
v0.4.15 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigVersion = 1
View Source
const DeploymentRecordVersion = 1
View Source
const RuntimeProfileEnvKey = "BASEHARBOR_RUNTIME_PROFILE"
View Source
const RuntimeProviderEnvKey = "BASEHARBOR_RUNTIME_PROVIDER"

Variables

This section is empty.

Functions

func ApplyRuntimeProviderState

func ApplyRuntimeProviderState(values map[string]string, state RuntimeProviderState) error

ApplyRuntimeProviderState writes normalized deployment metadata into the supplied state map while preserving unrelated deployment-owned values. Provider-only legacy writers also materialize the standard runtime profile when no profile has been persisted yet, so protected deployment state is a complete provider+profile selection without requiring a migration step.

func ApplyRuntimeSelection

func ApplyRuntimeSelection(values map[string]string, selection RuntimeSelection) error

ApplyRuntimeSelection writes normalized deployment-owned selection while preserving unrelated state such as hostname, TLS, and environment metadata.

func ConfigPath added in v0.4.15

func ConfigPath() (string, error)

func DataRoot added in v0.4.15

func DataRoot() (string, error)

func DeleteDeploymentRecord added in v0.4.15

func DeleteDeploymentRecord(id DeploymentIdentity) error

func DeploymentRoot added in v0.4.15

func DeploymentRoot(id DeploymentIdentity) (string, error)

func SaveDeploymentRecord added in v0.4.15

func SaveDeploymentRecord(record DeploymentRecord) error

func SourceAvailable added in v0.4.15

func SourceAvailable(source DeploymentSource) bool

func TargetStateRoot added in v0.4.15

func TargetStateRoot(name string) (string, error)

func ValidateTargetName added in v0.4.15

func ValidateTargetName(name string) error

Types

type AccessDefinition added in v0.4.15

type AccessDefinition struct {
	Provider      string `yaml:"provider" json:"provider"`
	Reference     string `yaml:"reference" json:"reference"`
	NativeContext string `yaml:"native-context,omitempty" json:"native_context,omitempty"`
}

type AppliedDeployment added in v0.4.15

type AppliedDeployment struct {
	Intent          json.RawMessage   `json:"intent,omitempty"`
	RuntimeProvider string            `json:"runtime_provider"`
	GeneratedState  map[string]string `json:"generated_state,omitempty"`
	LastAppliedRef  string            `json:"last_applied_ref,omitempty"`
}

type Config added in v0.4.15

type Config struct {
	Version       int                         `yaml:"version" json:"version"`
	DefaultTarget string                      `yaml:"default-target,omitempty" json:"default_target,omitempty"`
	Access        map[string]AccessDefinition `yaml:"access,omitempty" json:"access,omitempty"`
	Targets       map[string]TargetDefinition `yaml:"targets,omitempty" json:"targets,omitempty"`
	Prompt        PromptConfig                `yaml:"prompt,omitempty" json:"prompt,omitempty"`
}

func LoadConfig added in v0.4.15

func LoadConfig() (Config, error)

func (Config) ResolveTarget added in v0.4.15

func (c Config) ResolveTarget(explicit, activated string) (ResolvedTarget, error)

func (Config) Save added in v0.4.15

func (c Config) Save() error

func (Config) TargetNames added in v0.4.15

func (c Config) TargetNames() []string

func (Config) Validate added in v0.4.15

func (c Config) Validate() error

type DeploymentIdentity added in v0.4.15

type DeploymentIdentity struct {
	Target      string `json:"target"`
	Application string `json:"application"`
	Environment string `json:"environment"`
}

func (DeploymentIdentity) Validate added in v0.4.15

func (id DeploymentIdentity) Validate() error

type DeploymentRecord added in v0.4.15

type DeploymentRecord struct {
	Version  int                `json:"version"`
	Identity DeploymentIdentity `json:"identity"`
	Source   DeploymentSource   `json:"source"`
	Applied  AppliedDeployment  `json:"applied"`
	Observed ObservedDeployment `json:"observed,omitempty"`
}

func ListAllDeployments added in v0.4.15

func ListAllDeployments() ([]DeploymentRecord, error)

func ListDeployments added in v0.4.15

func ListDeployments(target string) ([]DeploymentRecord, error)

func LoadDeploymentRecord added in v0.4.15

func LoadDeploymentRecord(id DeploymentIdentity) (DeploymentRecord, error)

type DeploymentSource added in v0.4.15

type DeploymentSource struct {
	Kind       string `json:"kind"`
	Repository string `json:"repository,omitempty"`
	Manifest   string `json:"manifest,omitempty"`
	Revision   string `json:"revision,omitempty"`
	Digest     string `json:"digest,omitempty"`
}

type ObservedDeployment added in v0.4.15

type ObservedDeployment struct {
	State      string    `json:"state,omitempty"`
	Ready      bool      `json:"ready,omitempty"`
	VerifiedAt time.Time `json:"verified_at,omitempty"`
}

type PromptConfig added in v0.4.15

type PromptConfig struct {
	Enabled         bool              `yaml:"enabled" json:"enabled"`
	Preset          string            `yaml:"preset,omitempty" json:"preset,omitempty"`
	Position        string            `yaml:"position,omitempty" json:"position,omitempty"`
	Environment     string            `yaml:"environment,omitempty" json:"environment,omitempty"`
	ShowApplication bool              `yaml:"show-application,omitempty" json:"show_application,omitempty"`
	TextOnly        bool              `yaml:"text-only,omitempty" json:"text_only,omitempty"`
	ProdIndicator   string            `yaml:"prod-indicator,omitempty" json:"prod_indicator,omitempty"`
	Labels          map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"`
	Colors          map[string]string `yaml:"colors,omitempty" json:"colors,omitempty"`
}

type ResolvedTarget added in v0.4.15

type ResolvedTarget struct {
	Name            string `json:"name"`
	RuntimeProvider string `json:"runtime_provider"`
	AccessReference string `json:"access_reference"`
	Scope           string `json:"scope,omitempty"`
}

type RuntimeDefinition added in v0.4.15

type RuntimeDefinition struct {
	Provider string `yaml:"provider" json:"provider"`
}

type RuntimeProfile

type RuntimeProfile string
const (
	RuntimeProfileStandard RuntimeProfile = "standard"
)

func ParseRuntimeProfile

func ParseRuntimeProfile(value string) (RuntimeProfile, error)

type RuntimeProviderState

type RuntimeProviderState struct {
	Provider bhruntime.ProviderKind
}

RuntimeProviderState is deployment-owned provider selection. It is not part of the portable application contract and may differ between deployments of the same logical application.

func RuntimeProviderStateFromValues

func RuntimeProviderStateFromValues(values map[string]string) (RuntimeProviderState, error)

RuntimeProviderStateFromValues reads protected deployment state. Missing provider metadata from v0.3 deployments intentionally defaults to Compose so existing installations remain compatible without a migration.

type RuntimeSelection

type RuntimeSelection struct {
	Provider bhruntime.ProviderKind
	Profile  RuntimeProfile
}

RuntimeSelection is deployment-owned runtime intent. The same portable application contract may use a different selection in each environment.

func RuntimeSelectionFromValues

func RuntimeSelectionFromValues(values map[string]string) (RuntimeSelection, error)

RuntimeSelectionFromValues reads explicit deployment state. Environment names do not imply a provider or profile; selection stays explicit and independently configurable for development, staging, production, or future environments.

type TargetAccess added in v0.4.15

type TargetAccess struct {
	Reference string `yaml:"reference" json:"reference"`
}

type TargetDefinition added in v0.4.15

type TargetDefinition struct {
	Runtime RuntimeDefinition `yaml:"runtime" json:"runtime"`
	Access  TargetAccess      `yaml:"access" json:"access"`
	Scope   string            `yaml:"scope,omitempty" json:"scope,omitempty"`
}

Jump to

Keyboard shortcuts

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