Documentation
¶
Overview ¶
Package template provides pipeline YAML building with topological sorting for correct job dependency ordering.
Index ¶
- type Builder
- func (b *Builder) BuildOrder(jobs []JobDep) ([]string, error)
- func (b *Builder) GetDependencyGraph(jobs []JobDep) map[string][]string
- func (b *Builder) GetReverseDependencyGraph(jobs []JobDep) map[string][]string
- func (b *Builder) TopologicalSort(jobs []JobDep) ([]string, error)
- func (b *Builder) ValidateDependencies(jobs []JobDep) []string
- type JobDep
- type Registry
- func (r *Registry) Add(srcDir string) error
- func (r *Registry) Get(name string) (*TemplateMetadata, error)
- func (r *Registry) Init(name, outputDir string, vars map[string]string) error
- func (r *Registry) List() ([]TemplateMetadata, error)
- func (r *Registry) Remove(name string) error
- func (r *Registry) TemplatesDir() string
- type TemplateMetadata
- type TemplateVariable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct{}
Builder builds pipeline YAML with proper job ordering.
func (*Builder) BuildOrder ¶
BuildOrder returns jobs ordered by their dependencies. This is an alias for TopologicalSort for convenience.
func (*Builder) GetDependencyGraph ¶
GetDependencyGraph returns a map of job name to its direct dependencies.
func (*Builder) GetReverseDependencyGraph ¶
GetReverseDependencyGraph returns a map of job name to jobs that depend on it.
func (*Builder) TopologicalSort ¶
TopologicalSort orders jobs based on their dependencies using Kahn's algorithm. Returns an error if a cycle is detected.
func (*Builder) ValidateDependencies ¶
ValidateDependencies checks that all job dependencies exist. Returns a list of missing dependencies.
type JobDep ¶
type JobDep struct {
Name string `json:"name"`
Dependencies []string `json:"dependencies,omitempty"`
}
JobDep represents a job with its dependencies.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages pipeline templates stored in the .wetwire/templates directory.
func NewRegistry ¶
NewRegistry creates a new template registry rooted at the given directory.
func (*Registry) Get ¶
func (r *Registry) Get(name string) (*TemplateMetadata, error)
Get retrieves a template by name.
func (*Registry) List ¶
func (r *Registry) List() ([]TemplateMetadata, error)
List returns all available templates.
func (*Registry) TemplatesDir ¶
TemplatesDir returns the path to the templates directory.
type TemplateMetadata ¶
type TemplateMetadata struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Variables []TemplateVariable `yaml:"variables,omitempty" json:"variables,omitempty"`
Path string `yaml:"-" json:"path,omitempty"` // Path to the template directory
}
TemplateMetadata contains metadata about a pipeline template.
type TemplateVariable ¶
type TemplateVariable struct {
Name string `yaml:"name" json:"name"`
Default string `yaml:"default,omitempty" json:"default,omitempty"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
}
TemplateVariable represents a variable that can be customized in a template.
func (TemplateVariable) HasDefault ¶
func (v TemplateVariable) HasDefault() bool
HasDefault returns true if the variable has a default value.