From 41fe1bae463b32861fb14e967372da7e318bc6e1 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 26 Jul 2023 15:38:07 +0200 Subject: dashboard: display fix candidate info on the bug page --- dashboard/app/bug.html | 4 +++- dashboard/app/jobs.go | 19 +++++++++++++++++++ dashboard/app/main.go | 19 +++++++++++++++++++ dashboard/app/templates.html | 22 ++++++++++++++++------ dashboard/dashapi/dashapi.go | 1 + pkg/html/pages/style.css | 5 +++++ 6 files changed, 63 insertions(+), 7 deletions(-) diff --git a/dashboard/app/bug.html b/dashboard/app/bug.html index 4d499bebf..d21af6548 100644 --- a/dashboard/app/bug.html +++ b/dashboard/app/bug.html @@ -35,7 +35,9 @@ Page with details about a single bug. {{end}} {{end}} First crash: {{formatLateness $.Now $.Bug.FirstTime}}, last: {{formatLateness $.Now $.Bug.LastTime}}
- + {{if .FixCandidate}} +
{{template "bisect_results" .FixCandidate}}
+ {{end}}
{{if .BisectCause}}
{{template "bisect_results" .BisectCause}}
{{end}} {{if .BisectFix}}
{{template "bisect_results" .BisectFix}}
{{end}} diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go index cf5698e99..f575d4dd2 100644 --- a/dashboard/app/jobs.go +++ b/dashboard/app/jobs.go @@ -1539,6 +1539,7 @@ func makeJobInfo(c context.Context, job *Job, jobKey *db.Key, bug *Bug, build *B KernelRepo: job.KernelRepo, KernelBranch: job.KernelBranch, KernelAlias: kernelRepoInfoRaw(c, job.Namespace, job.KernelRepo, job.KernelBranch).Alias, + KernelLink: vcs.CommitLink(job.KernelRepo, job.KernelBranch), KernelCommit: kernelCommit, KernelCommitLink: vcs.CommitLink(kernelRepo, kernelCommit), PatchLink: textLink(textPatch, job.Patch), @@ -1674,6 +1675,24 @@ func (b *bugJobs) bestBisection() *bugJob { return nil } +// Find the most representative fix candidate bisection result. +func (b *bugJobs) bestFixCandidate() *bugJob { + // Let's take the most recent finished one. + for _, j := range b.list { + if !j.job.IsFinished() { + continue + } + if j.job.InvalidatedBy != "" { + continue + } + if !j.job.IsCrossTree() { + continue + } + return j + } + return nil +} + func (b *bugJobs) all() []*bugJob { return b.list } diff --git a/dashboard/app/main.go b/dashboard/app/main.go index efbfd8ea4..7849d0ee5 100644 --- a/dashboard/app/main.go +++ b/dashboard/app/main.go @@ -240,6 +240,7 @@ type uiBugPage struct { Bug *uiBug BisectCause *uiJob BisectFix *uiJob + FixCandidate *uiJob Sections []*uiCollapsible SampleReport template.HTML Crashes *uiCrashTable @@ -367,6 +368,7 @@ type uiJob struct { *dashapi.JobInfo Crash *uiCrash InvalidateJobLink string + FixCandidate bool } type userBugFilter struct { @@ -838,6 +840,13 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error return err } } + var fixCandidate *uiJob + if bug.FixCandidateJob != "" { + fixCandidate, err = fixBisections.uiBestFixCandidate(c) + if err != nil { + return err + } + } testPatchJobs, err := loadTestPatchJobs(c, bug) if err != nil { return err @@ -858,6 +867,7 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error Bug: uiBug, BisectCause: bisectCause, BisectFix: bisectFix, + FixCandidate: fixCandidate, Sections: sections, SampleReport: sampleReport, Crashes: crashesTable, @@ -2012,6 +2022,7 @@ func makeUIJob(c context.Context, job *Job, jobKey *db.Key, bug *Bug, crash *Cra ui := &uiJob{ JobInfo: makeJobInfo(c, job, jobKey, bug, build, crash), InvalidateJobLink: invalidateJobLink(c, job, jobKey), + FixCandidate: job.IsCrossTree(), } if crash != nil { ui.Crash = makeUICrash(c, crash, build) @@ -2142,6 +2153,14 @@ func (b *bugJobs) uiBestBisection(c context.Context) (*uiJob, error) { return j.ui(c) } +func (b *bugJobs) uiBestFixCandidate(c context.Context) (*uiJob, error) { + j := b.bestFixCandidate() + if j == nil { + return nil, nil + } + return j.ui(c) +} + // bugExtLink should be preferred to bugLink since it provides a URL that's more consistent with // links from email addresses. func bugExtLink(bug *Bug) string { diff --git a/dashboard/app/templates.html b/dashboard/app/templates.html index b00de9fdc..4c17a8deb 100644 --- a/dashboard/app/templates.html +++ b/dashboard/app/templates.html @@ -313,24 +313,32 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the {{/* Show bisection results */}} {{define "bisect_results"}} {{if .}} -
{{$causeJob := 1}} {{$fixJob := 2}} {{if .ErrorLink}} {{if eq .Type $causeJob}} Cause bisection: failed {{else if eq .Type $fixJob}} - Fix bisection: failed + {{if .FixCandidate}} + Fix candidate bisection: failed + {{else}} + Fix bisection: failed + {{end}} {{end}} ({{link .ErrorLink "error log"}}{{if .LogLink}}, {{link .LogLink "bisect log"}}{{end}})
{{else if .Commit}} {{if eq .Type $causeJob}} Cause bisection: introduced by {{else if eq .Type $fixJob}} - Fix bisection: fixed by + {{if .FixCandidate}} + Fix commit to backport + {{else}} + Fix bisection: fixed by + {{end}} {{end}} ({{link .LogLink "bisect log"}}) {{print .Flags}}:
+ {{if .FixCandidate}}tree: {{link .KernelLink .KernelAlias}}
{{end}} commit {{.Commit.Hash}}
Author: {{.Commit.Author}}
Date: {{formatKernelTime .Commit.Date}}
@@ -341,8 +349,9 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the {{if eq .Type $causeJob}} Cause bisection: the cause commit could be any of {{else if eq .Type $fixJob}} - Fix bisection: the fix commit could be any of - {{end}} + {{if .FixCandidate}}Fix candidate detection{{else}}Fix bisection{{end}} + the fix commit could be any of + {{end}} ({{link .LogLink "bisect log"}}):
{{range $com := .Commits}} @@ -353,7 +362,8 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the {{if eq .Type $causeJob}} Cause bisection: the issue happens on the oldest tested release {{else if eq .Type $fixJob}} - Fix bisection: the issue occurs on the latest tested release + {{if .FixCandidate}}Fix candidate detection:{{else}}Fix bisection:{{end}} + the issue occurs on the latest tested release {{end}} ({{link .LogLink "bisect log"}})
{{end}} diff --git a/dashboard/dashapi/dashapi.go b/dashboard/dashapi/dashapi.go index 28a805edd..4513c8477 100644 --- a/dashboard/dashapi/dashapi.go +++ b/dashboard/dashapi/dashapi.go @@ -891,6 +891,7 @@ type JobInfo struct { KernelAlias string KernelCommit string KernelCommitLink string + KernelLink string PatchLink string Attempts int Started time.Time diff --git a/pkg/html/pages/style.css b/pkg/html/pages/style.css index 5aed046e6..9dd1bca7f 100644 --- a/pkg/html/pages/style.css +++ b/pkg/html/pages/style.css @@ -364,6 +364,11 @@ aside { width: 20pt; } +.fix-candidate-block { + background: lightgreen; + padding: 5pt; +} + .bug-bisection-info { float:left; margin-right: 15px; -- cgit mrf-deployment