Documentation
¶
Index ¶
- Constants
- func ConfigExists(startPath string) (bool, string, error)
- func GetCacheDir() (string, error)
- func GetToolPath(name, version string) (string, error)
- func GetToolVersions(config *Config) map[string]string
- func GetYAMLAPIVersion(path string) (string, error)
- func IsCached(name, version string) (bool, error)
- func IsNonInteractive() bool
- func VerifyHelmChecksum(data []byte, archiveURL string) error
- func VerifyTroubleshootChecksum(data []byte, version, filename string) error
- func WriteConfigFile(config *Config, path string) error
- type ChartConfig
- type Config
- type ConfigParser
- func (p *ConfigParser) ApplyDefaults(config *Config)
- func (p *ConfigParser) DefaultConfig() *Config
- func (p *ConfigParser) FindAndParseConfig(startPath string) (*Config, error)
- func (p *ConfigParser) ParseConfig(data []byte) (*Config, error)
- func (p *ConfigParser) ParseConfigFile(path string) (*Config, error)
- type DetectedResources
- type Downloader
- type LinterConfig
- type LintersConfig
- type PreflightConfig
- type ReplLintConfig
- type Resolver
Constants ¶
const ( DefaultHelmVersion = "3.14.4" // Deprecated: Use "latest" instead DefaultPreflightVersion = "latest" DefaultSupportBundleVersion = "latest" )
Default tool versions - kept for backward compatibility in tests In production, "latest" is used to fetch the most recent stable version from GitHub
const ( ToolHelm = "helm" ToolPreflight = "preflight" ToolSupportBundle = "support-bundle" )
Supported tool names
Variables ¶
This section is empty.
Functions ¶
func ConfigExists ¶
ConfigExists checks if a .replicated config file exists in the current directory or parents
func GetCacheDir ¶
GetCacheDir returns the cache directory for tools Location: ~/.replicated/tools
func GetToolPath ¶
GetToolPath returns the cached path for a specific tool version Example: ~/.replicated/tools/helm/3.14.4/darwin-arm64/helm
func GetToolVersions ¶
GetToolVersions extracts the tool versions from a config
func GetYAMLAPIVersion ¶
GetYAMLAPIVersion reads a YAML file and returns its apiVersion field
func IsNonInteractive ¶
func IsNonInteractive() bool
IsNonInteractive checks if we're running in a non-interactive environment
func VerifyHelmChecksum ¶
VerifyHelmChecksum verifies a Helm binary against its .sha256sum file
func VerifyTroubleshootChecksum ¶
VerifyTroubleshootChecksum verifies preflight or support-bundle against checksums.txt
func WriteConfigFile ¶
WriteConfigFile writes a config to a file using flow-style format
Types ¶
type ChartConfig ¶
type ChartConfig struct {
Path string `yaml:"path"`
ChartVersion string `yaml:"chartVersion,omitempty"`
AppVersion string `yaml:"appVersion,omitempty"`
}
ChartConfig represents a chart entry in the config
type Config ¶
type Config struct {
AppId string `yaml:"appId,omitempty"`
AppSlug string `yaml:"appSlug,omitempty"`
PromoteToChannelIds []string `yaml:"promoteToChannelIds,omitempty"`
PromoteToChannelNames []string `yaml:"promoteToChannelNames,omitempty"`
Charts []ChartConfig `yaml:"charts,omitempty"`
Preflights []PreflightConfig `yaml:"preflights,omitempty"`
ReleaseLabel string `yaml:"releaseLabel,omitempty"`
Manifests []string `yaml:"manifests,omitempty"`
ReplLint *ReplLintConfig `yaml:"repl-lint,omitempty"`
}
Config represents the parsed .replicated configuration file
type ConfigParser ¶
type ConfigParser struct{}
ConfigParser handles parsing of .replicated config files
func NewConfigParser ¶
func NewConfigParser() *ConfigParser
NewConfigParser creates a new config parser
func (*ConfigParser) ApplyDefaults ¶
func (p *ConfigParser) ApplyDefaults(config *Config)
ApplyDefaults fills in default values for missing fields
func (*ConfigParser) DefaultConfig ¶
func (p *ConfigParser) DefaultConfig() *Config
DefaultConfig returns a config with default values
func (*ConfigParser) FindAndParseConfig ¶
func (p *ConfigParser) FindAndParseConfig(startPath string) (*Config, error)
FindAndParseConfig searches for a .replicated config file starting from the given path and walking up the directory tree. If path is empty, starts from current directory. Returns the parsed config or a default config if not found.
func (*ConfigParser) ParseConfig ¶
func (p *ConfigParser) ParseConfig(data []byte) (*Config, error)
ParseConfig parses config data from YAML Does NOT apply defaults - caller should do that after merging
func (*ConfigParser) ParseConfigFile ¶
func (p *ConfigParser) ParseConfigFile(path string) (*Config, error)
ParseConfigFile parses a .replicated config file (supports YAML)
type DetectedResources ¶
type DetectedResources struct {
Charts []string
Preflights []string
SupportBundles []string
Manifests []string
ValuesFiles []string
}
DetectedResources holds resources found during auto-detection
func AutoDetectResources ¶
func AutoDetectResources(startPath string) (*DetectedResources, error)
AutoDetectResources searches the directory tree for Helm charts and preflight specs
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
Downloader handles downloading tool binaries
func NewDownloader ¶
func NewDownloader() *Downloader
NewDownloader creates a new downloader with timeout
func (*Downloader) Download ¶
Download downloads a tool to the cache directory with checksum verification If the requested version fails, it will automatically fallback to latest stable Returns the actual version that was downloaded (may differ from requested version due to fallback)
func (*Downloader) DownloadWithFallback ¶
func (d *Downloader) DownloadWithFallback(ctx context.Context, name, version string) (string, error)
DownloadWithFallback attempts to download the specified version, falling back to latest stable if it fails
type LinterConfig ¶
type LinterConfig struct {
Disabled *bool `yaml:"disabled,omitempty"` // pointer allows nil = not set
}
LinterConfig represents the configuration for a single linter
func (LinterConfig) IsEnabled ¶
func (c LinterConfig) IsEnabled() bool
IsEnabled returns true if the linter is not disabled nil Disabled means not set, defaults to enabled (false = not disabled)
type LintersConfig ¶
type LintersConfig struct {
Helm LinterConfig `yaml:"helm"`
Preflight LinterConfig `yaml:"preflight"`
SupportBundle LinterConfig `yaml:"support-bundle"`
EmbeddedCluster LinterConfig `yaml:"embedded-cluster"`
Kots LinterConfig `yaml:"kots"`
}
LintersConfig contains configuration for each linter
type PreflightConfig ¶
type PreflightConfig struct {
Path string `yaml:"path"`
ChartName string `yaml:"chartName,omitempty"` // Optional: explicit chart reference (must provide chartVersion if set)
ChartVersion string `yaml:"chartVersion,omitempty"` // Optional: explicit chart version (must provide chartName if set)
}
PreflightConfig represents a preflight entry in the config Path is required. ChartName and ChartVersion are optional but must be provided together.
type ReplLintConfig ¶
type ReplLintConfig struct {
Version int `yaml:"version"`
Linters LintersConfig `yaml:"linters"`
Tools map[string]string `yaml:"tools,omitempty"`
}
ReplLintConfig is the lint configuration section