Documentation
¶
Index ¶
- Constants
- func BuildSummarySections(snapshot SummarySnapshot) ([]ci.ReportSection, error)
- func BuildSummarySectionsWithOptions(snapshot SummarySnapshot, opts SummarySectionOptions) ([]ci.ReportSection, error)
- func ComposeComment(snapshot SummarySnapshot, metadata CommentMetadata) (string, error)
- func ComposeCommentWithOptions(snapshot SummarySnapshot, metadata CommentMetadata, opts CommentOptions) (string, error)
- func Truncate(s string, maxLen int) string
- type CommentMetadata
- type CommentOptions
- type Config
- type LabelRequest
- type LabelResult
- type LabelTemplate
- type PlanParser
- type PlanScanner
- type Provider
- type ProviderResolver
- type Request
- type Result
- type Runtime
- type SummarySectionOptions
- type SummarySnapshot
- type SummarySnapshotOptions
Constants ¶
const CommentMarker = ci.CommentMarker
CommentMarker is used to identify terraci comments for updates.
const ReportProducer = "summary"
ReportProducer is the producer name used by summary's own reports/comments.
Variables ¶
This section is empty.
Functions ¶
func BuildSummarySections ¶
func BuildSummarySections(snapshot SummarySnapshot) ([]ci.ReportSection, error)
BuildSummarySections builds the filtered summary view from a typed snapshot.
func BuildSummarySectionsWithOptions ¶
func BuildSummarySectionsWithOptions(snapshot SummarySnapshot, opts SummarySectionOptions) ([]ci.ReportSection, error)
BuildSummarySectionsWithOptions builds the filtered summary view with explicit rendering options.
func ComposeComment ¶
func ComposeComment(snapshot SummarySnapshot, metadata CommentMetadata) (string, error)
ComposeComment builds the final markdown comment from the typed summary snapshot.
func ComposeCommentWithOptions ¶
func ComposeCommentWithOptions(snapshot SummarySnapshot, metadata CommentMetadata, opts CommentOptions) (string, error)
ComposeCommentWithOptions builds the final markdown comment with explicit rendering options.
Types ¶
type CommentMetadata ¶ added in v0.10.8
CommentMetadata is the CI metadata rendered in the summary footer.
type CommentOptions ¶ added in v0.10.8
type CommentOptions struct {
IncludeDetails bool
}
CommentOptions controls generic summary comment rendering.
type Config ¶
type Config struct {
Enabled *bool `yaml:"enabled,omitempty" json:"enabled,omitempty"`
OnChangesOnly bool `yaml:"on_changes_only,omitempty" json:"on_changes_only,omitempty"`
IncludeDetails *bool `yaml:"include_details,omitempty" json:"include_details,omitempty"`
Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
}
Config holds summary plugin settings.
func (*Config) IncludeDetailsEnabled ¶
IncludeDetailsEnabled reports whether detailed report sections should be rendered.
func (*Config) Normalized ¶
Normalized returns a value copy with stable defaults and owned slices.
type LabelRequest ¶
type LabelRequest struct {
WorkDir string
Segments []string
PlanResults *ci.PlanResultCollection
Templates []string
Parser PlanParser
}
LabelRequest contains the data needed to resolve summary labels.
type LabelResult ¶
type LabelResult struct {
Labels []string
Diagnostics diagnostic.List
}
LabelResult is the deterministic output of label resolution.
func ResolveLabels ¶
func ResolveLabels(req LabelRequest) LabelResult
ResolveLabels resolves static, module-level, and resource-level label templates.
type LabelTemplate ¶
type LabelTemplate string
LabelTemplate is a configured summary label expression.
func (LabelTemplate) HasResourcePlaceholders ¶
func (t LabelTemplate) HasResourcePlaceholders() bool
HasResourcePlaceholders reports whether this template needs plan.json resources.
func (LabelTemplate) Placeholders ¶
func (t LabelTemplate) Placeholders() []string
Placeholders returns the unique placeholders used by the template.
type PlanParser ¶
type PlanParser interface {
ParsePlan(path string) (*tfplan.ParsedPlan, error)
}
PlanParser parses a terraform plan JSON file for resource-level labels.
type PlanScanner ¶
type PlanScanner interface {
ScanPlanResults(rootDir string, segments []string) (*ci.PlanResultCollection, error)
}
PlanScanner loads plan result artifacts.
type Provider ¶
type Provider interface {
CommitSHA() string
PipelineID() string
CommentService() (ci.CommentService, bool)
}
Provider is the CI-provider surface needed by the summary use case.
type ProviderResolver ¶
ProviderResolver resolves the active CI provider for the current command.
type Request ¶
type Request struct{}
Request is reserved for command-time options. The summary command currently has no flags; keeping the request explicit keeps the use case stable.
type Result ¶
type Result struct {
Snapshot SummarySnapshot
Body string
Labels []string
LabelDiagnostics diagnostic.List
ReportDiagnostics diagnostic.List
PostedComment bool
SyncedLabels bool
SkippedReason string
ProviderDetected bool
}
Result reports what the summary use case did.
type Runtime ¶
type Runtime struct {
Config Config
WorkDir string
ServiceDir string
Segments []string
ProviderResolver ProviderResolver
PlanScanner PlanScanner
ReportStore ci.ReportStore
LabelParser PlanParser
}
Runtime holds normalized summary configuration and command-independent dependencies.
type SummarySectionOptions ¶ added in v0.10.8
type SummarySectionOptions struct {
IncludeDetails bool
}
SummarySectionOptions controls generic summary section rendering.
type SummarySnapshot ¶ added in v0.10.8
type SummarySnapshot struct {
// contains filtered or unexported fields
}
SummarySnapshot is the immutable summary composition input for plan results and selected plugin reports.
func NewSummarySnapshot ¶ added in v0.10.8
func NewSummarySnapshot(opts SummarySnapshotOptions) SummarySnapshot
NewSummarySnapshot builds a defensive summary composition snapshot.
func (SummarySnapshot) HasReportableChanges ¶ added in v0.10.8
func (s SummarySnapshot) HasReportableChanges() bool
HasReportableChanges reports whether the snapshot has module or report signal worth posting.
func (SummarySnapshot) PlanResults ¶ added in v0.10.8
func (s SummarySnapshot) PlanResults() *ci.PlanResultCollection
PlanResults returns the plan result collection for this snapshot.
func (SummarySnapshot) Plans ¶ added in v0.10.8
func (s SummarySnapshot) Plans() []ci.PlanResult
Plans returns defensive plan result values for internal iteration.
func (SummarySnapshot) Reports ¶ added in v0.10.8
func (s SummarySnapshot) Reports() ci.ReportCollection
Reports returns the selected plugin reports for this snapshot.
type SummarySnapshotOptions ¶ added in v0.10.8
type SummarySnapshotOptions struct {
PlanResults *ci.PlanResultCollection
Reports ci.ReportCollection
}
SummarySnapshotOptions describes a summary composition snapshot.