diff options
| author | Taras Madan <tarasmadan@google.com> | 2024-07-04 13:59:32 +0200 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2024-07-04 15:07:46 +0000 |
| commit | 7d7fe8807550c6e02def380d335ae0230f1e495c (patch) | |
| tree | 098b8004a1b20584ea34356440f3f866f553b63c | |
| parent | 87735313feed904c37a0650a70ade96294f3b997 (diff) | |
dashboard/app: introduce mainRepoBranch
| -rw-r--r-- | dashboard/app/config.go | 4 | ||||
| -rw-r--r-- | dashboard/app/email_test.go | 6 | ||||
| -rw-r--r-- | dashboard/app/main.go | 8 |
3 files changed, 10 insertions, 8 deletions
diff --git a/dashboard/app/config.go b/dashboard/app/config.go index 547a30779..fd57a153b 100644 --- a/dashboard/app/config.go +++ b/dashboard/app/config.go @@ -764,6 +764,10 @@ func (cfg *Config) lastActiveReporting() int { return last } +func (cfg *Config) mainRepoBranch() (repo, branch string) { + return cfg.Repos[0].URL, cfg.Repos[0].Branch +} + func (gCfg *GlobalConfig) marshalJSON() string { ret, err := json.MarshalIndent(gCfg, "", " ") if err != nil { diff --git a/dashboard/app/email_test.go b/dashboard/app/email_test.go index 0e82ee142..c059bcfc6 100644 --- a/dashboard/app/email_test.go +++ b/dashboard/app/email_test.go @@ -139,8 +139,7 @@ For more options, visit https://groups.google.com/d/optout. // Now report syz reproducer and check updated email. build2 := testBuild(10) build2.Arch = targets.I386 - build2.KernelRepo = testConfig.Namespaces["test2"].Repos[0].URL - build2.KernelBranch = testConfig.Namespaces["test2"].Repos[0].Branch + build2.KernelRepo, build2.KernelBranch = testConfig.Namespaces["test2"].mainRepoBranch() build2.KernelCommitTitle = "a really long title, longer than 80 chars, really long-long-long-long-long-long title" c.client2.UploadBuild(build2) crash.BuildID = build2.ID @@ -644,8 +643,7 @@ func TestEmailFailedBuild(t *testing.T) { c.client2.UploadBuild(build) failedBuild := testBuild(10) - failedBuild.KernelRepo = testConfig.Namespaces["test2"].Repos[0].URL - failedBuild.KernelBranch = testConfig.Namespaces["test2"].Repos[0].Branch + failedBuild.KernelRepo, failedBuild.KernelBranch = testConfig.Namespaces["test2"].mainRepoBranch() failedBuild.KernelCommit = "kern2" failedBuild.KernelCommitTitle = "failed build 1" failedBuild.SyzkallerCommit = "syz2" diff --git a/dashboard/app/main.go b/dashboard/app/main.go index 1e16525c8..e070992ac 100644 --- a/dashboard/app/main.go +++ b/dashboard/app/main.go @@ -1911,14 +1911,14 @@ func createUIBug(c context.Context, bug *Bug, state *ReportingState, managers [] updateBugBadness(c, uiBug) if len(bug.Commits) != 0 { for i, com := range bug.Commits { - cfg := getNsConfig(c, bug.Namespace) + mainNsRepo, mainNsBranch := getNsConfig(c, bug.Namespace).mainRepoBranch() info := bug.getCommitInfo(i) uiBug.Commits = append(uiBug.Commits, &uiCommit{ Hash: info.Hash, Title: com, - Link: vcs.CommitLink(cfg.Repos[0].URL, info.Hash), - Repo: cfg.Repos[0].URL, - Branch: cfg.Repos[0].Branch, + Link: vcs.CommitLink(mainNsRepo, info.Hash), + Repo: mainNsRepo, + Branch: mainNsBranch, }) } for _, mgr := range managers { |
