Skip to content

Commit

Permalink
cmd/coordinator: link to LUCI UI for non-top-level dashboard pages
Browse files Browse the repository at this point in the history
The build.golang.org dashboard gained support to display build results
from LUCI, in addition to legacy builder results (go.dev/issue/65913),
but only for the default top-level view.

When visiting more detailed pages, like page 2 of commits for the main
Go repo, or detailed views for golang.org/x repos, no LUCI build results
are shown, which can be confusing. So, when displaying LUCI results
(i.e., the 'legacyonly' query parameter isn't used to hide them),
change links to detailed views on the top-level view to point to the
LUCI UI where results can in fact be viewed.

For golang/go#28643.
For golang/go#65913.
For golang/go#70314.

Change-Id: I3ebfba5bc6d0cd2e37d8e5fc1386843c6e298ce7
Reviewed-on: https://go-review.googlesource.com/c/build/+/644156
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
  • Loading branch information
dmitshur authored and gopherbot committed Feb 3, 2025
1 parent 2a0314b commit e76a69f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
17 changes: 16 additions & 1 deletion cmd/coordinator/internal/legacydash/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,11 @@ func (tb *uiTemplateDataBuilder) buildTemplateData(ctx context.Context, datastor
// to do there in the case of LUCI.
}

if tb.showLUCI() {
data.Pagination = &Pagination{} // Disable pagination links because they don't have LUCI results now.
data.LinkToLUCI = true
}

return data, nil
}

Expand Down Expand Up @@ -875,7 +880,7 @@ var osPriority = map[string]int{

// TagState represents the state of all Packages at a branch.
type TagState struct {
Name string // Go branch name: "master", "release-branch.go1.4", etc
Name string // Go branch name: "master", "release-branch.go1.4", etc.
Tag *CommitInfo // current Go commit on the Name branch
Packages []*PackageState
Builders []string
Expand All @@ -890,6 +895,15 @@ func (ts *TagState) Branch() string {
return ts.Name
}

// LUCIBranch returns the short Go branch name as used in LUCI: "tip", "1.24", etc.
func (ts *TagState) LUCIBranch() string {
shortGoBranch := "tip"
if after, ok := strings.CutPrefix(ts.Name, "release-branch.go"); ok {
shortGoBranch = after
}
return shortGoBranch
}

// PackageState represents the state of a Package (x/foo repo) for given Go branch.
type PackageState struct {
Package *Package
Expand Down Expand Up @@ -944,6 +958,7 @@ type uiTemplateData struct {
Branches []string
Branch string
Repo string // the repo gerrit project name. "go" if unspecified in the request.
LinkToLUCI bool // whether to display links to LUCI UI
}

// getActiveBuilds returns the builds that coordinator is currently doing.
Expand Down
17 changes: 16 additions & 1 deletion cmd/coordinator/internal/legacydash/ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ <h1>
<a {{if .HasPrev}}href="?{{with $.Package.Path}}repo={{.}}&{{end}}page={{.Prev}}{{with $.Branch}}&branch={{.}}{{end}}"{{else}}class="inactive"{{end}}>newer</a>
<a {{if .Next}}href="?{{with $.Package.Path}}repo={{.}}&{{end}}page={{.Next}}{{with $.Branch}}&branch={{.}}{{end}}"{{else}}class="inactive"{{end}}>older</a>
<a {{if .HasPrev}}href=".{{with $.Branch}}?branch={{.}}{{end}}"{{else}}class="inactive"{{end}}>latest</a>
{{if $.LinkToLUCI}}<a href="https://ci.chromium.org/p/golang/g/go-gotip/console">more in LUCI UI</a>{{end}}
</nav>
</div>
{{end}}
Expand All @@ -200,6 +201,7 @@ <h1>
{{range $.TagState}}
{{$goHash := .Tag.Hash}}
{{$goBranch := .Branch}}
{{$goLUCI := .LUCIBranch}}
{{$builders := .Builders}}
{{if .Packages}}
<h2>
Expand Down Expand Up @@ -257,7 +259,20 @@ <h2>
</tr>
{{range $pkg := .Packages}}
<tr class="commit">
<td><a title="{{.Package.Path}}" href="?repo={{.Package.Path}}">{{.Package.Name}}</a></td>
<td>
<a title="{{.Package.Path}}"
{{if $.LinkToLUCI}}
href="https://ci.chromium.org/p/golang/g/x-{{.Package.Name}}-go{{$goLUCI}}/console"
{{else}}
href="?repo={{.Package.Path}}"
{{end}}
>{{.Package.Name}}</a>
{{if $.LinkToLUCI}}
<small>(<a title="View {{.Package.Path}} builds ordered by Go commit."
href="https://ci.chromium.org/p/golang/g/x-{{.Package.Name}}-go{{$goLUCI}}-by-go/console"
>by go</a>)</small>
{{end}}
</td>
<td class="hash">
{{$h := $pkg.Commit.Hash}}
<a href="https://go-review.googlesource.com/q/{{$h}}">{{shortHash $h}}</a>
Expand Down

0 comments on commit e76a69f

Please sign in to comment.