Skip to content

Commit e76a69f

Browse files
dmitshurgopherbot
authored andcommitted
cmd/coordinator: link to LUCI UI for non-top-level dashboard pages
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 <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 2a0314b commit e76a69f

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

cmd/coordinator/internal/legacydash/ui.go

+16-1
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,11 @@ func (tb *uiTemplateDataBuilder) buildTemplateData(ctx context.Context, datastor
551551
// to do there in the case of LUCI.
552552
}
553553

554+
if tb.showLUCI() {
555+
data.Pagination = &Pagination{} // Disable pagination links because they don't have LUCI results now.
556+
data.LinkToLUCI = true
557+
}
558+
554559
return data, nil
555560
}
556561

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

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

898+
// LUCIBranch returns the short Go branch name as used in LUCI: "tip", "1.24", etc.
899+
func (ts *TagState) LUCIBranch() string {
900+
shortGoBranch := "tip"
901+
if after, ok := strings.CutPrefix(ts.Name, "release-branch.go"); ok {
902+
shortGoBranch = after
903+
}
904+
return shortGoBranch
905+
}
906+
893907
// PackageState represents the state of a Package (x/foo repo) for given Go branch.
894908
type PackageState struct {
895909
Package *Package
@@ -944,6 +958,7 @@ type uiTemplateData struct {
944958
Branches []string
945959
Branch string
946960
Repo string // the repo gerrit project name. "go" if unspecified in the request.
961+
LinkToLUCI bool // whether to display links to LUCI UI
947962
}
948963

949964
// getActiveBuilds returns the builds that coordinator is currently doing.

cmd/coordinator/internal/legacydash/ui.html

+16-1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ <h1>
189189
<a {{if .HasPrev}}href="?{{with $.Package.Path}}repo={{.}}&{{end}}page={{.Prev}}{{with $.Branch}}&branch={{.}}{{end}}"{{else}}class="inactive"{{end}}>newer</a>
190190
<a {{if .Next}}href="?{{with $.Package.Path}}repo={{.}}&{{end}}page={{.Next}}{{with $.Branch}}&branch={{.}}{{end}}"{{else}}class="inactive"{{end}}>older</a>
191191
<a {{if .HasPrev}}href=".{{with $.Branch}}?branch={{.}}{{end}}"{{else}}class="inactive"{{end}}>latest</a>
192+
{{if $.LinkToLUCI}}<a href="https://ci.chromium.org/p/golang/g/go-gotip/console">more in LUCI UI</a>{{end}}
192193
</nav>
193194
</div>
194195
{{end}}
@@ -200,6 +201,7 @@ <h1>
200201
{{range $.TagState}}
201202
{{$goHash := .Tag.Hash}}
202203
{{$goBranch := .Branch}}
204+
{{$goLUCI := .LUCIBranch}}
203205
{{$builders := .Builders}}
204206
{{if .Packages}}
205207
<h2>
@@ -257,7 +259,20 @@ <h2>
257259
</tr>
258260
{{range $pkg := .Packages}}
259261
<tr class="commit">
260-
<td><a title="{{.Package.Path}}" href="?repo={{.Package.Path}}">{{.Package.Name}}</a></td>
262+
<td>
263+
<a title="{{.Package.Path}}"
264+
{{if $.LinkToLUCI}}
265+
href="https://ci.chromium.org/p/golang/g/x-{{.Package.Name}}-go{{$goLUCI}}/console"
266+
{{else}}
267+
href="?repo={{.Package.Path}}"
268+
{{end}}
269+
>{{.Package.Name}}</a>
270+
{{if $.LinkToLUCI}}
271+
<small>(<a title="View {{.Package.Path}} builds ordered by Go commit."
272+
href="https://ci.chromium.org/p/golang/g/x-{{.Package.Name}}-go{{$goLUCI}}-by-go/console"
273+
>by go</a>)</small>
274+
{{end}}
275+
</td>
261276
<td class="hash">
262277
{{$h := $pkg.Commit.Hash}}
263278
<a href="https://go-review.googlesource.com/q/{{$h}}">{{shortHash $h}}</a>

0 commit comments

Comments
 (0)