Documentation
¶
Index ¶
- Constants
- func ApplyConfigDefaults(repoCfg *RepoConfig, centralCfg *CentralConfig)
- func AsConfigMap(value interface{}) (map[string]interface{}, bool)
- func ExtractGitPlaceholders(value string) []string
- func IsReservedConfigName(name string) bool
- func RepoConfigExists(repoPath string) bool
- func ResolvedConfigValues(repoCfg *RepoConfig, centralCfg *CentralConfig) map[string]interface{}
- func TemplateModeOrDefault(mode string) string
- type CentralConfig
- type ConfigDefinition
- type FileRule
- type GitConfig
- type RepoConfig
- type RootConfig
- type TemplateRef
Constants ¶
const ( ConfigDir = "config" OutputsDir = "outputs" TemplatesDir = "templates" OutputFileSuffix = ".gitrepoforge" TemplateModeDoubleBracket = "DOUBLE_BRACKET" TemplateModeDoubleBracketStrict = "DOUBLE_BRACKET_STRICT" )
const ( // PullRequestNo disables pull request creation. PullRequestNo = "NO" // PullRequestGitHubCLI creates pull requests using the GitHub CLI. PullRequestGitHubCLI = "GITHUB_CLI" )
const RepoConfigFileName = ".gitrepoforge"
const RootConfigFileName = ".gitrepoforge-config"
Variables ¶
This section is empty.
Functions ¶
func ApplyConfigDefaults ¶
func ApplyConfigDefaults(repoCfg *RepoConfig, centralCfg *CentralConfig)
func AsConfigMap ¶
func ExtractGitPlaceholders ¶
func IsReservedConfigName ¶
func RepoConfigExists ¶
RepoConfigExists returns true if a .gitrepoforge file exists in the repo.
func ResolvedConfigValues ¶
func ResolvedConfigValues(repoCfg *RepoConfig, centralCfg *CentralConfig) map[string]interface{}
func TemplateModeOrDefault ¶
TemplateModeOrDefault returns the configured template mode, or the default mode when the field is omitted.
Types ¶
type CentralConfig ¶
type CentralConfig struct {
RootDir string
Definitions []ConfigDefinition
Files []FileRule
}
CentralConfig represents the desired-state configuration repository. Config definitions are loaded from individual files under config/. File rules are loaded from individual files under outputs/.
func LoadCentralConfig ¶
func LoadCentralConfig(configRepoPath string) (*CentralConfig, error)
LoadCentralConfig loads the central config from the config repo by scanning the config/ and outputs/ directories for individual definition files.
type ConfigDefinition ¶
type ConfigDefinition struct {
Name string `yaml:"-"`
Type string `yaml:"type"`
Required bool `yaml:"required"`
Enum []string `yaml:"enum"`
Default interface{} `yaml:"default"`
HasDefault bool `yaml:"-"`
Description string `yaml:"description"`
Pattern string `yaml:"pattern"`
CompiledPattern *regexp.Regexp `yaml:"-"`
PatternGroups []string `yaml:"-"`
Attributes []ConfigDefinition `yaml:"-"`
}
ConfigDefinition defines a valid config value for per-repo configs. Each definition is stored as its own file: config/<name>.yaml
func (*ConfigDefinition) UnmarshalYAML ¶
func (d *ConfigDefinition) UnmarshalYAML(node *yaml.Node) error
type FileRule ¶
type FileRule struct {
Path string `yaml:"-"`
Mode string `yaml:"mode"`
Templates []TemplateRef `yaml:"templates"`
}
FileRule defines how an output file is managed. Each rule is stored as its own file: outputs/<path>.gitrepoforge
type GitConfig ¶
type GitConfig struct {
CreateBranch bool `yaml:"create_branch"`
BranchName string `yaml:"branch_name"`
Commit bool `yaml:"commit"`
CommitMessage string `yaml:"commit_message"`
Push bool `yaml:"push"`
Remote string `yaml:"remote"`
PullRequest string `yaml:"pull_request"`
ReturnToOriginalBranch bool `yaml:"return_to_original_branch"`
DeleteBranch bool `yaml:"delete_branch"`
}
GitConfig controls the Git automation performed during apply. It mirrors the git configuration section from the repver tool.
func (*GitConfig) BuildBranchName ¶
func (*GitConfig) BuildCommitMessage ¶
func (*GitConfig) GitOptionsSpecified ¶
type RepoConfig ¶
type RepoConfig struct {
Name string `yaml:"name"`
DefaultBranch string `yaml:"default_branch"`
Config map[string]interface{} `yaml:"config"`
}
RepoConfig represents the per-repo config dotfile (.gitrepoforge).
func LoadRepoConfig ¶
func LoadRepoConfig(repoPath string) (*RepoConfig, error)
func (*RepoConfig) PlaceholderValues ¶
func (rc *RepoConfig) PlaceholderValues() map[string]string
type RootConfig ¶
type RootConfig struct {
ConfigRepo string `yaml:"config_repo"`
Excludes []string `yaml:"excludes"`
IgnoreMissing bool `yaml:"ignore_missing"`
Git GitConfig `yaml:"-"`
}
RootConfig represents the root config dotfile (.gitrepoforge-config) that lives in the checkout root (workspace directory).
func LoadRootConfig ¶
func LoadRootConfig(workspaceDir string) (*RootConfig, error)
func (*RootConfig) ResolveConfigRepoPath ¶
func (rc *RootConfig) ResolveConfigRepoPath(workspaceDir string) string
ResolveConfigRepoPath resolves the config repo path (relative to workspace or absolute).
type TemplateRef ¶
type TemplateRef struct {
Condition string `yaml:"condition"`
Template string `yaml:"template"`
Evaluate bool `yaml:"evaluate"`
TemplateMode string `yaml:"template_mode"`
Absent bool `yaml:"absent"`
ResolvedPath string `yaml:"-"`
}
TemplateRef selects a template file from templates/.