Skip to content

Commit 60e4f5a

Browse files
cagedmantisgopherbot
authored andcommitted
cmd/watchflakes: only open issues bots that have been dead for 24-hours
This change adds a 24-hour delay before an issue is created for a bot confirmed as dead. Bot maintainers have commented that there should be some grace period before an issue is created. Fixes golang/go#72857 Change-Id: I8372291aa2a713183052e66734d446f053472300 Reviewed-on: https://go-review.googlesource.com/c/build/+/659236 Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Carlos Amedee <[email protected]>
1 parent 36af4a7 commit 60e4f5a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

cmd/watchflakes/luci.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ type Bot struct {
152152
Goarch string
153153
Dead bool
154154
Quarantined bool
155+
LastSeen time.Time
155156
}
156157

157158
// ListCommits fetches the list of commits from Gerrit.
@@ -733,7 +734,13 @@ nextCursor:
733734
fmt.Printf("failed to determine platform for %s: %s\n", bot.GetBotId(), err)
734735
continue
735736
}
736-
brokenBots = append(brokenBots, Bot{ID: bot.BotId, Dead: bot.IsDead, Quarantined: bot.Quarantined, Goos: goos, Goarch: goarch})
737+
brokenBots = append(brokenBots, Bot{
738+
ID: bot.BotId,
739+
Dead: bot.IsDead,
740+
Quarantined: bot.Quarantined,
741+
Goos: goos,
742+
Goarch: goarch,
743+
LastSeen: bot.GetLastSeenTs().AsTime()})
737744
}
738745
}
739746
if resp.GetCursor() != "" {

cmd/watchflakes/main.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,18 @@ func reportBrokenBots(ctx context.Context, c *LUCIClient) {
356356
if err != nil {
357357
log.Printf("failed to query for platform owners: %s", err)
358358
}
359+
360+
// lastSeenThreshold is the minimum amount of time a dead bot has not been
361+
// seen in before an issue is created for it.
362+
lastSeenThreshold := 24 * time.Hour
363+
359364
// for each broken bot, is there an existing open issue?
360365
for _, bot := range brokenBots {
366+
// Do not open to an issue when a dead bot has not been dead for at least the lastSeenThreshold amount.
367+
if bot.Dead && bot.LastSeen.After(time.Now().Add(-lastSeenThreshold)) {
368+
fmt.Printf("broken bot %q has not been dead for %s. Skipping issue creation/updates.", bot.ID, lastSeenThreshold.String())
369+
continue
370+
}
361371
if issueID, ok := botIssues[bot.ID]; ok {
362372
fmt.Printf("issue #%d found for broken bot %s\n", issueID, bot.ID)
363373
continue

0 commit comments

Comments
 (0)