composition

package
v1.36.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPackageArchive

func BuildPackageArchive(rootDir, outputPath string) error

BuildPackageArchive validates a composition package directory and writes a .tgz archive to disk.

func FetchToDir added in v1.12.54

func FetchToDir(ociRef, destDir string) (string, error)

FetchToDir downloads an OCI composition package and extracts its compositions into destDir. Each exported composition becomes a subdirectory inside destDir, mirroring the compositions/ tree from the package (e.g. destDir/TerraformPlan/compositions.yaml). destDir must not already exist; the caller is responsible for pre-flight checks.

func LockFilePath

func LockFilePath(intentPath string) string

LockFilePath returns the default lock-file path for an intent file.

func LoginToRegistry

func LoginToRegistry(registry, username, password string, passwordStdin bool) error

LoginToRegistry shells out to `oras login` to store credentials.

func NormalizeOCIRef

func NormalizeOCIRef(ref string) string

NormalizeOCIRef expands short-form references in intent.yaml to a full <registry>/<repo>:<tag>. "sourceplane/devops-compositions" -> "ghcr.io/sourceplane/devops-compositions:latest" "ghcr.io/acme/x" -> "ghcr.io/acme/x:latest" "oci://ghcr.io/acme/x:v1" -> "ghcr.io/acme/x:v1"

func PushArchiveFile

func PushArchiveFile(archivePath, ociRef string) error

PushArchiveFile reads an existing .tgz archive from disk and pushes it to an OCI registry.

func StreamPublishPackage

func StreamPublishPackage(rootDir, ociRef string) error

StreamPublishPackage streams a composition package to an OCI registry in a single pass. When the package root contains a compositions/ subdirectory (new Stack format), two separate OCI layers are produced:

  • compositions layer (stack.yaml + compositions/ tree): media type compositionsLayerMediaType
  • examples layer (examples/ tree, if present): media type examplesLayerMediaType

Legacy packages (orun.yaml, flat layout) are pushed as a single layer. No temporary file is written to disk.

func WriteLockFile

func WriteLockFile(intentPath string, sources []model.ResolvedCompositionSource) error

WriteLockFile writes the resolved composition lock next to the intent.

Types

type Composition

type Composition struct {
	Key               string
	Name              string
	Description       string
	DefaultJobName    string
	DefaultProfile    string
	ExecutionProfiles map[string]model.ExecutionProfile
	ParameterSchema   map[string]interface{}
	Jobs              []model.JobSpec
	JobMap            map[string]*model.JobSpec
	Schema            *jsonschema.Schema
	JobRegistryName   string
	JobRegistryDesc   string
	SourceName        string
	SourceKind        string
	SourceRef         string
	SourcePath        string
	ExportPath        string
	ResolvedDigest    string
}

Composition is the resolved internal representation used by planning and validation.

type PublishPlan

type PublishPlan struct {
	PackageRoot       string
	PackageName       string
	Version           string
	OCIRef            string
	Registry          string
	Repository        string
	FileCount         int
	InferredFromGit   bool
	InferredFromStack bool
	InferredVersion   bool
	ManifestVersion   string
}

PublishPlan captures a fully-resolved publish target before any side-effecting work.

func ResolvePackPlan

func ResolvePackPlan(packageRoot, versionOverride string) (*PublishPlan, error)

ResolvePackPlan loads the manifest at packageRoot and resolves a version, with no OCI target.

func ResolvePublishPlan

func ResolvePublishPlan(packageRoot, targetRef, versionOverride string) (*PublishPlan, error)

ResolvePublishPlan inspects packageRoot, optional explicit target, and the local git repo to assemble a PublishPlan. targetRef may be empty (then inferred from stack.yaml registry or git remote), a registry-only host (ghcr.io), or a full <reg>/<repo>[:tag]. versionOverride wins when non-empty.

func (PublishPlan) FullRef

func (p PublishPlan) FullRef() string

FullRef returns the canonical <registry>/<repo>:<tag> form.

type Registry

type Registry struct {
	Types       map[string]*Composition
	ByKey       map[string]*Composition
	Jobs        *model.JobRegistry
	Bindings    map[string]*model.JobBinding
	Sources     []model.ResolvedCompositionSource
	SourceRoots map[string]string
}

Registry holds resolved compositions and the sources they came from.

func LoadFromDir

func LoadFromDir(configDir string) (*Registry, error)

LoadFromDir loads legacy folder-shaped compositions from a config dir.

func LoadRegistry

func LoadRegistry(intent *model.Intent, intentPath, legacyConfigDir string) (*Registry, error)

LoadRegistry resolves declared composition sources from intent and falls back to the legacy config dir when needed.

func (*Registry) ValidateAllComponents

func (reg *Registry) ValidateAllComponents(normalized *model.NormalizedIntent) error

ValidateAllComponents validates all normalized components against their resolved schemas.

func (*Registry) ValidateComponentAgainstComposition

func (reg *Registry) ValidateComponentAgainstComposition(component *model.Component) error

ValidateComponentAgainstComposition validates a component against the resolved schema selected for it.

type ResolvedProfile added in v1.21.0

type ResolvedProfile struct {
	Ref    string // e.g. "terraform.verify"
	Name   string // e.g. "verify"
	Source string // "subscription", "composition-default", or "legacy-none"
}

ResolvedProfile holds the result of profile resolution for a component/environment pair.

func ResolveProfileRef added in v1.21.0

func ResolveProfileRef(componentType string, composition *Composition, subscription *model.EnvironmentSubscription) (ResolvedProfile, error)

ResolveProfileRef resolves a profile reference for a component/environment subscription against the composition's execution profiles.

Jump to

Keyboard shortcuts

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