workspace

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package workspace owns the Deployah project source locations for one invocation and loads the spec and optional platform configuration from those sources.

A Workspace does not resolve Kubernetes destinations and does not construct Helm or Kubernetes clients.

Platform source precedence

Source selection is snapshotted in New:

  1. explicit Config.PlatformPath
  2. DEPLOYAH_PLATFORM_FILE
  3. deployah.platform.yaml next to the effective spec

An explicit or environment-selected path is required. The default adjacent file is optional: Workspace.Platform returns (nil, nil) when it is missing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// SpecPath is the Deployah spec file. Empty means [spec.DefaultSpecPath].
	SpecPath string
	// PlatformPath is an explicit platform file. Empty means
	// DEPLOYAH_PLATFORM_FILE, then the default file next to the spec.
	PlatformPath string
}

Config holds source-location inputs for a Workspace.

type Workspace

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

Workspace owns the Deployah project source locations for one invocation and loads the spec and optional platform configuration from those sources.

New snapshots the effective spec path and platform source selection, including whether the platform path is required. Later changes to DEPLOYAH_PLATFORM_FILE do not retarget an existing Workspace.

Concurrent calls to Workspace.SpecPath, Workspace.PlatformPath, Workspace.Platform, Workspace.ParseManifest, and Workspace.LoadSpec are safe.

func New

func New(config Config) *Workspace

New returns a Workspace that snapshots config and the current DEPLOYAH_PLATFORM_FILE value. It does not read the spec or platform files.

func (*Workspace) LoadSpec

func (w *Workspace) LoadSpec(ctx context.Context, environment string, opts ...spec.LoadOption) (*spec.Spec, spec.SubstitutionReport, error)

LoadSpec loads the spec for environment from Workspace.SpecPath using the Workspace platform and opts. Each call reads the spec from disk because envsubst depends on environment. The spec.SubstitutionReport is the report produced by that spec.Load call.

func (*Workspace) ParseManifest

func (w *Workspace) ParseManifest() (*spec.Spec, error)

ParseManifest reads the spec at Workspace.SpecPath without envsubst, defaults, or platform resolution.

func (*Workspace) Platform

func (w *Workspace) Platform() (*spec.PlatformConfig, error)

Platform loads and memoizes the platform configuration from the snapshotted source.

A successful load is memoized. A missing optional adjacent file returns (nil, nil). A missing or unreadable required source (explicit path or DEPLOYAH_PLATFORM_FILE) returns an error. Failed loads and the optional miss are not cached.

func (*Workspace) PlatformPath

func (w *Workspace) PlatformPath() string

PlatformPath returns the snapshotted platform file path.

func (*Workspace) SpecPath

func (w *Workspace) SpecPath() string

SpecPath returns the effective spec file path. It is never empty.

Jump to

Keyboard shortcuts

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