Documentation
¶
Overview ¶
Package optimizer provides pipeline optimization analysis.
Index ¶
Constants ¶
const ( SeverityLow = "low" SeverityMedium = "medium" SeverityHigh = "high" SeverityCritical = "critical" )
Severity levels for optimization suggestions
const ( CategoryParallelization = "parallelization" CategoryCache = "cache" CategoryTimeout = "timeout" CategoryArtifact = "artifact" CategoryReliability = "reliability" CategoryResource = "resource" )
Category types for optimization suggestions
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
Analyzer analyzes pipelines for optimization opportunities.
func (*Analyzer) Analyze ¶
Analyze analyzes a pipeline directory and returns optimization suggestions.
func (*Analyzer) DisableRule ¶
DisableRule disables a rule by ID.
func (*Analyzer) EnableRule ¶
EnableRule enables a rule by ID.
func (*Analyzer) IsRuleEnabled ¶
IsRuleEnabled returns whether a rule is enabled.
func (*Analyzer) SetCategoryFilter ¶
SetCategoryFilter sets a category filter to only analyze specific categories.
func (*Analyzer) SetExpectedTimeout ¶
SetExpectedTimeout sets the expected job duration for timeout recommendations.
type Context ¶
type Context struct {
Jobs []discover.DiscoveredJob
JobMap map[string]discover.DiscoveredJob
VarToName map[string]string
JobDetails map[string]*JobDetail
ExpectedTimeout string
}
Context provides shared context for rules during analysis.
type JobDetail ¶
type JobDetail struct {
VariableName string
HasCache bool
HasCacheFallback bool
HasArtifacts bool
HasTimeout bool
CacheKeys []string
ArtifactExpiry string
Timeout string
Interruptible bool
ScriptLength int
HasResourceGroup bool
}
JobDetail contains detailed information about a job extracted from source code.
type Result ¶
type Result struct {
Success bool `json:"success"`
Suggestions []Suggestion `json:"suggestions,omitempty"`
JobCount int `json:"job_count"`
Summary Summary `json:"summary"`
}
Result represents the result of an optimization analysis.
type Rule ¶
type Rule interface {
ID() string
Category() string
Analyze(ctx *Context) []Suggestion
}
Rule represents an optimization rule.
type Suggestion ¶
type Suggestion struct {
Category string `json:"category"`
Severity string `json:"severity"`
Job string `json:"job,omitempty"`
Message string `json:"message"`
Explanation string `json:"explanation,omitempty"`
Suggestion string `json:"suggestion"`
}
Suggestion represents a single optimization suggestion.