Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AggregateCommand = cli.Command{ Name: "aggregate", Usage: "aggregate", Description: "Aggregates flakes", Flags: []cli.Flag{ cli.IntFlag{ Name: "max-age, m", Usage: "Lists builds that failed in the last n hours", Value: -1, }, }, Action: func(ctx *cli.Context) error { client := ctx.App.Metadata["client"].(fly.Client) searcher := hunter.NewSearcher(client) spec := hunter.SearchSpec{ Pattern: regexp.MustCompile("\\[Fail\\].*"), } if ctx.Int("max-age") > 0 { spec.MaxAge = ctx.Int("max-age") } builds := searcher.Search(spec) aggregator := NewAggregator() for build := range builds { for _, match := range build.Matches { aggregator.addFailure(&Failure{ Description: match, JobName: build.JobName, ConcourseURL: build.ConcourseURL, Date: build.StartTime, }) } } aggregator.printEntries() return nil }, }
View Source
var SearchCommand = cli.Command{ Name: "search", Usage: "search <arguments>", Description: "Searches for flakes", Flags: []cli.Flag{ cli.BoolFlag{ Name: "show-one-offs", Usage: "If set one off failures will be reported as well", }, cli.IntFlag{ Name: "max-age, m", Usage: "Lists builds that failed in the last n hours", Value: 0, }, }, Action: func(ctx *cli.Context) error { if ctx.Args().First() == "" { return cli.NewExitError("need to provide a pattern", 1) } client := ctx.App.Metadata["client"].(fly.Client) searcher := hunter.NewSearcher(client) spec := hunter.SearchSpec{ Pattern: regexp.MustCompile(ctx.Args().First()), } if ctx.Bool("show-one-offs") { spec.ShowOneOffs = true } if ctx.Int("max-age") > 0 { spec.MaxAge = ctx.Int("max-age") } builds := searcher.Search(spec) fmt.Printf("+-------+%-32s+%s\n", "----------------------------------", "-----------------------------------------------------") fmt.Printf("| %-5s | %-32s | %s\n", "Ended", "Job", "Url") fmt.Printf("+-------+%-32s+%s\n", "----------------------------------", "-----------------------------------------------------") for build := range builds { fmt.Printf("| %-5s | %-32s | %s\n", timeSince(build.EndTime), build.PipelineName+"/"+build.JobName, build.ConcourseURL) } fmt.Printf("+-------+%-32s+%s\n", "----------------------------------", "-----------------------------------------------------") return nil }, }
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Aggregator struct {
// contains filtered or unexported fields
}
func NewAggregator ¶
func NewAggregator() *Aggregator
type FailuresInfo ¶
Click to show internal directories.
Click to hide internal directories.