Documentation
¶
Index ¶
- func BuildToolchainPATH(atmosConfig *schema.AtmosConfiguration, dependencies map[string]string) (string, error)
- func LoadToolVersionsDependencies(atmosConfig *schema.AtmosConfiguration) (map[string]string, error)
- func MergeDependencies(parent map[string]string, child map[string]string) (map[string]string, error)
- func UpdatePathForTools(atmosConfig *schema.AtmosConfiguration, dependencies map[string]string) error
- func ValidateConstraint(version string, constraint string) error
- type BatchInstallFunc
- type BinaryPathFinder
- type InstallFunc
- type Installer
- type InstallerOption
- func WithBatchInstallFunc(fn BatchInstallFunc) InstallerOption
- func WithBinaryPathFinder(finder BinaryPathFinder) InstallerOption
- func WithFileExistsFunc(fn func(path string) bool) InstallerOption
- func WithInstallFunc(fn InstallFunc) InstallerOption
- func WithResolver(resolver toolchain.ToolResolver) InstallerOption
- type Resolver
- func (r *Resolver) ResolveCommandDependencies(command *schema.Command) (map[string]string, error)
- func (r *Resolver) ResolveComponentDependencies(componentType string, stackConfig map[string]any, ...) (map[string]string, error)
- func (r *Resolver) ResolveWorkflowDependencies(workflowDef *schema.WorkflowDefinition) (map[string]string, error)
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 ¶
ValidateConstraint validates that a specific version satisfies a constraint.
Types ¶
type BatchInstallFunc ¶ added in v1.204.0
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.
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 ¶
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):
- Global scope: top-level dependencies
- Component type scope: terraform.dependencies / helmfile.dependencies / packer.dependencies
- 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.