Documentation
¶
Overview ¶
Package source provides just-in-time (JIT) vendoring of component sources from source configuration in stack manifests.
Index ¶
- Constants
- func AutoProvisionSource(ctx context.Context, atmosConfig *schema.AtmosConfiguration, ...) error
- func DetermineTargetDirectory(atmosConfig *schema.AtmosConfiguration, componentType string, component string, ...) (string, error)
- func ExtractSource(componentConfig map[string]any) (*schema.VendorComponentSource, error)
- func HasSource(componentConfig map[string]any) bool
- func Provision(ctx context.Context, params *ProvisionParams) error
- func VendorSource(_ context.Context, atmosConfig *schema.AtmosConfiguration, ...) error
- type ProvisionParams
Constants ¶
const ( // DefaultVendorTimeout is the default timeout for vendor operations. DefaultVendorTimeout = 5 * time.Minute // TargetDirPermissions is the permissions for created target directories. TargetDirPermissions = 0o755 )
const DirPermissions = 0o755
DirPermissions is the default permission mode for directories.
const HookEventBeforeTerraformInit = provisioner.HookEvent("before.terraform.init")
HookEventBeforeTerraformInit is the hook event for before terraform init.
const WorkdirPath = ".workdir"
WorkdirPath is the standard workdir directory name.
Variables ¶
This section is empty.
Functions ¶
func AutoProvisionSource ¶
func AutoProvisionSource( ctx context.Context, atmosConfig *schema.AtmosConfiguration, componentType string, componentConfig map[string]any, authContext *schema.AuthContext, ) error
AutoProvisionSource automatically vendors component source on first use. This enables JIT (Just-in-Time) vendoring - sources are fetched automatically when running terraform/helmfile/packer commands if the target directory doesn't exist.
Parameters: - componentType: the type of component ("terraform", "helmfile", or "packer").
Behavior: - If component has no source configured: skip (not an error). - If target directory already exists: skip (use CRUD commands for updates). - If workdir is enabled: download source directly to workdir path. - If workdir is NOT enabled: download source to component path.
func DetermineTargetDirectory ¶
func DetermineTargetDirectory( atmosConfig *schema.AtmosConfiguration, componentType string, component string, componentConfig map[string]any, ) (string, error)
DetermineTargetDirectory determines where to vendor the component source. Priority: 1. Working_directory if specified in component config (metadata or settings). 2. Workdir path if provision.workdir.enabled is true: .workdir/<type>/<stack>-<component>/. 3. Default component path: <base_path>/<component>.
func ExtractSource ¶
func ExtractSource(componentConfig map[string]any) (*schema.VendorComponentSource, error)
ExtractSource extracts the source specification from component config. Supports both string form (go-getter URI) and map form (VendorComponentSource). Returns nil, nil if no source is configured (not an error).
func HasSource ¶
HasSource checks if component config has a valid source defined. Returns true only if the source has a valid URI.
func Provision ¶
func Provision(ctx context.Context, params *ProvisionParams) error
Provision vendors a component source based on source configuration. It extracts the source spec from component config, resolves it, and vendors to the appropriate target directory.
func VendorSource ¶
func VendorSource( _ context.Context, atmosConfig *schema.AtmosConfiguration, sourceSpec *schema.VendorComponentSource, targetDir string, ) error
VendorSource vendors a component source to the target directory. It uses go-getter via the existing downloader infrastructure. Note: Authentication is not yet supported - credentials must be configured via environment variables or cloud provider credential chains. Note: The context parameter is currently unused but kept for API compatibility with future cancellation support when the downloader is updated.
Types ¶
type ProvisionParams ¶
type ProvisionParams struct {
AtmosConfig *schema.AtmosConfiguration
ComponentType string // "terraform", "helmfile", etc.
Component string
Stack string
ComponentConfig map[string]any
AuthContext *schema.AuthContext
Force bool // Force re-vendor even if already exists.
}
ProvisionParams contains parameters for source provisioning.