Documentation
¶
Index ¶
- Constants
- func FilterPlanOutput(rawOutput string) string
- func FormatCostCell(p *ci.ModulePlan) string
- func FormatCostDiff(diff float64) string
- func FormatMonthlyCost(cost float64) string
- func FormatPlanDetails(p *plan.ParsedPlan) string
- func FormatPlanSummary(p *plan.ParsedPlan) string
- func HasReportableChanges(plans []ci.ModulePlan, policySummary *ci.PolicySummary) bool
- func ParseModulePathComponents(modulePath string, segments []string) map[string]string
- func ScanPlanResults(rootDir string, segments []string) (*ci.PlanResultCollection, error)
- func Truncate(s string, maxLen int) string
- type CommentData
- type CommentRenderer
Constants ¶
const CommentMarker = ci.CommentMarker
CommentMarker is used to identify terraci comments for updates
Variables ¶
This section is empty.
Functions ¶
func FilterPlanOutput ¶
FilterPlanOutput extracts only the diff portion from terraform plan output
func FormatCostCell ¶
func FormatCostCell(p *ci.ModulePlan) string
FormatCostCell formats the cost cell for a module plan
func FormatCostDiff ¶
FormatCostDiff formats a cost difference with sign
func FormatMonthlyCost ¶
FormatMonthlyCost formats a monthly cost value
func FormatPlanDetails ¶
func FormatPlanDetails(p *plan.ParsedPlan) string
FormatPlanDetails formats a parsed plan as structured resource list grouped by action
func FormatPlanSummary ¶
func FormatPlanSummary(p *plan.ParsedPlan) string
FormatPlanSummary formats a parsed plan as a compact summary line
func HasReportableChanges ¶
func HasReportableChanges(plans []ci.ModulePlan, policySummary *ci.PolicySummary) bool
HasReportableChanges returns true if there are plan changes, failures, or policy violations that warrant posting a comment.
func ParseModulePathComponents ¶
ParseModulePathComponents parses a module path using the given segment names and returns a map of component name to value. Extra path parts beyond the defined segments are joined as "submodule".
func ScanPlanResults ¶
func ScanPlanResults(rootDir string, segments []string) (*ci.PlanResultCollection, error)
ScanPlanResults scans for plan.json files in module directories and builds a collection of plan results from their contents. If segments is nil or empty, default segments (service/environment/region/module) are used.
Types ¶
type CommentData ¶
type CommentData struct {
Plans []ci.ModulePlan
PolicySummary *ci.PolicySummary
PipelineURL string
PipelineID string
CommitSHA string
GeneratedAt time.Time
TotalModules int
}
CommentData contains all data needed to render a PR/MR comment
type CommentRenderer ¶
type CommentRenderer struct{}
CommentRenderer renders PR/MR comments
func NewCommentRenderer ¶
func NewCommentRenderer() *CommentRenderer
NewCommentRenderer creates a new comment renderer
func (*CommentRenderer) Render ¶
func (r *CommentRenderer) Render(data *CommentData) string
Render generates the comment body