dependencies

package
v1.204.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildToolchainPATH

func BuildToolchainPATH(atmosConfig *schema.AtmosConfiguration, dependencies map[string]string) (string, error)

BuildToolchainPATH constructs a PATH string with toolchain binaries prepended. This function does NOT modify the global environment - it returns the PATH string which should be added to ComponentEnvList for subprocess execution.

func LoadToolVersionsDependencies added in v1.204.0

func LoadToolVersionsDependencies(atmosConfig *schema.AtmosConfiguration) (map[string]string, error)

LoadToolVersionsDependencies loads tools from .tool-versions as a dependency map. Returns an empty map if the file doesn't exist (no error). The first version listed for each tool is used as the default.

func MergeDependencies

func MergeDependencies(parent map[string]string, child map[string]string) (map[string]string, error)

MergeDependencies merges child dependencies into parent with constraint validation. Child values override parent values, but must satisfy parent constraints.

func UpdatePathForTools

func UpdatePathForTools(atmosConfig *schema.AtmosConfiguration, dependencies map[string]string) error

UpdatePathForTools updates PATH environment variable to include tool binaries. Deprecated: Use BuildToolchainPATH() instead and add to ComponentEnvList. This function is kept for backwards compatibility but should not be used.

func ValidateConstraint

func ValidateConstraint(version string, constraint string) error

ValidateConstraint validates that a specific version satisfies a constraint.

Types

type BatchInstallFunc added in v1.204.0

type BatchInstallFunc func(toolSpecs []string, reinstallFlag bool) error

BatchInstallFunc is the function signature for batch installing multiple tools. Shows status messages scrolling up with a single progress bar at bottom.

type BinaryPathFinder added in v1.204.0

type BinaryPathFinder interface {
	FindBinaryPath(owner, repo, version string, binaryName ...string) (string, error)
}

BinaryPathFinder finds installed tool binaries. This interface allows testing without the full toolchain installer.

type InstallFunc

type InstallFunc func(toolSpec string, setAsDefault, reinstallFlag, showHint, showProgressBar bool) error

InstallFunc is the function signature for installing a tool. The showHint parameter controls whether to show the PATH export hint message. The showProgressBar parameter controls whether to show spinner and success messages.

type Installer

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

Installer handles automatic tool installation.

func NewInstaller

func NewInstaller(atmosConfig *schema.AtmosConfiguration, opts ...InstallerOption) *Installer

NewInstaller creates a new tool installer.

func (*Installer) EnsureTools

func (i *Installer) EnsureTools(dependencies map[string]string) error

EnsureTools ensures all required tools are installed. Installs missing tools automatically using batch install with progress bar.

type InstallerOption

type InstallerOption func(*Installer)

InstallerOption is a functional option for configuring Installer.

func WithBatchInstallFunc added in v1.204.0

func WithBatchInstallFunc(fn BatchInstallFunc) InstallerOption

WithBatchInstallFunc sets a custom batch install function (for testing).

func WithBinaryPathFinder added in v1.204.0

func WithBinaryPathFinder(finder BinaryPathFinder) InstallerOption

WithBinaryPathFinder sets a custom binary path finder (for testing).

func WithFileExistsFunc

func WithFileExistsFunc(fn func(path string) bool) InstallerOption

WithFileExistsFunc sets a custom file exists function (for testing).

func WithInstallFunc

func WithInstallFunc(fn InstallFunc) InstallerOption

WithInstallFunc sets a custom install function (for testing).

func WithResolver

func WithResolver(resolver toolchain.ToolResolver) InstallerOption

WithResolver sets a custom ToolResolver (for testing).

type Resolver

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

Resolver resolves tool dependencies with inheritance and validation.

func NewResolver

func NewResolver(atmosConfig *schema.AtmosConfiguration) *Resolver

NewResolver creates a new dependency resolver.

func (*Resolver) ResolveCommandDependencies

func (r *Resolver) ResolveCommandDependencies(command *schema.Command) (map[string]string, error)

ResolveCommandDependencies resolves tool dependencies for a custom command.

func (*Resolver) ResolveComponentDependencies

func (r *Resolver) ResolveComponentDependencies(
	componentType string,
	stackConfig map[string]any,
	componentConfig map[string]any,
) (map[string]string, error)

ResolveComponentDependencies resolves tool dependencies for a component. Merges 3 scopes from stack configuration (lowest to highest priority):

  1. Global scope: top-level dependencies
  2. Component type scope: terraform.dependencies / helmfile.dependencies / packer.dependencies
  3. Component instance scope: components.terraform.vpc.dependencies

Parameters:

  • componentType: "terraform", "helmfile", or "packer"
  • stackConfig: Full merged stack configuration (includes all scopes)
  • componentConfig: Merged component configuration

func (*Resolver) ResolveWorkflowDependencies

func (r *Resolver) ResolveWorkflowDependencies(workflowDef *schema.WorkflowDefinition) (map[string]string, error)

ResolveWorkflowDependencies resolves tool dependencies for a workflow.

Jump to

Keyboard shortcuts

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