From ebc0eda4c9ebdc244a33d061b052517dbf663a47 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 19 Aug 2022 15:13:44 +0000 Subject: dashboard: enabe per-namespace configuration of repro retesting --- dashboard/app/api.go | 11 ++++++++--- dashboard/app/app_test.go | 1 + dashboard/app/config.go | 2 ++ dashboard/app/jobs.go | 6 +++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/dashboard/app/api.go b/dashboard/app/api.go index 0683802ee..7beaa8d47 100644 --- a/dashboard/app/api.go +++ b/dashboard/app/api.go @@ -1452,8 +1452,13 @@ func checkClient(conf *GlobalConfig, name0, secretPassword, oauthSubject string) func handleRetestRepros(w http.ResponseWriter, r *http.Request) { c := appengine.NewContext(r) - err := updateRetestReproJobs(c) - if err != nil { - log.Errorf(c, "failed to update retest repro jobs: %v", err) + for ns, cfg := range config.Namespaces { + if !cfg.RetestRepros { + continue + } + err := updateRetestReproJobs(c, ns) + if err != nil { + log.Errorf(c, "failed to update retest repro jobs for %s: %v", ns, err) + } } } diff --git a/dashboard/app/app_test.go b/dashboard/app/app_test.go index 4c1fd32ad..7d49b1575 100644 --- a/dashboard/app/app_test.go +++ b/dashboard/app/app_test.go @@ -178,6 +178,7 @@ var testConfig = &GlobalConfig{ }, }, }, + RetestRepros: true, }, // Namespaces for access level testing. "access-admin": { diff --git a/dashboard/app/config.go b/dashboard/app/config.go index a82890547..52a98beb4 100644 --- a/dashboard/app/config.go +++ b/dashboard/app/config.go @@ -82,6 +82,8 @@ type Config struct { WaitForRepro time.Duration // If set, successful fix bisections will auto-close the bug. FixBisectionAutoClose bool + // If set, dashboard will periodically request repros and revoke no longer working ones. + RetestRepros bool // Managers contains some special additional info about syz-manager instances. Managers map[string]ConfigManager // Reporting config. diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go index d67b3cc55..2a2a241f0 100644 --- a/dashboard/app/jobs.go +++ b/dashboard/app/jobs.go @@ -248,7 +248,7 @@ func getNextJob(c context.Context, managers map[string]dashapi.ManagerJobs) (*Jo } // Ensure that for each manager there's one pending retest repro job. -func updateRetestReproJobs(c context.Context) error { +func updateRetestReproJobs(c context.Context, ns string) error { if config.Obsoleting.ReproRetestPeriod == 0 { return nil } @@ -270,6 +270,7 @@ func updateRetestReproJobs(c context.Context) error { maxLastTime := now.Add(-config.Obsoleting.ReproRetestPeriod) bugs, keys, err := loadAllBugs(c, func(query *db.Query) *db.Query { return query.Filter("Status=", BugStatusOpen). + Filter("Namespace=", ns). Filter("LastTime<", maxLastTime) }) if err != nil { @@ -590,6 +591,9 @@ func handleRetestedRepro(c context.Context, now time.Time, job *Job, jobKey *db. if err := db.Get(c, bugKey, bug); err != nil { return fmt.Errorf("failed to get bug: %v", bugKey) } + if !config.Namespaces[bug.Namespace].RetestRepros { + return nil + } // Update the crash. crash.LastReproRetest = now if len(allTitles) == 0 { -- cgit mrf-deployment