Skip to content

Commit f087b01

Browse files
committed
devapp: automatically deduce current milestone for burndown chart
Use information from maintner to figure out the current development milestone, and estimate the start of work based on the current six- month cycle. It should work well enough for now, and can be changed as needed. This way it's no longer necessary to manually update the current milestone and its date every 6 months, as was previously done in CLs 295191, 248157, 228110, and 193877. Hooray for gophers doing more of the work for us! Change-Id: I10b569da577e638a190886c7678f6da1107fdb46 Reviewed-on: https://go-review.googlesource.com/c/build/+/344089 Trust: Dmitri Shuralyov <[email protected]> Reviewed-by: Carlos Amedee <[email protected]>
1 parent 8b42ff7 commit f087b01

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

devapp/release.go

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,16 @@ import (
1818
"time"
1919

2020
"golang.org/x/build/maintner"
21+
"golang.org/x/build/maintner/maintnerd/maintapi/version"
2122
)
2223

2324
const (
2425
labelProposal = "Proposal"
2526

2627
prefixProposal = "proposal:"
2728
prefixDev = "[dev."
28-
29-
// The title of the current release milestone in GitHub.
30-
curMilestoneTitle = "Go1.17"
3129
)
3230

33-
// The start date of the current release milestone.
34-
var curMilestoneStart = time.Date(2021, 2, 22, 0, 0, 0, 0, time.UTC)
35-
3631
// titleDirs returns a slice of prefix directories contained in a title. For
3732
// devapp,maintner: my cool new change, it will return ["devapp", "maintner"].
3833
// If there is no dir prefix, it will return nil.
@@ -71,6 +66,7 @@ type releaseData struct {
7166
LastUpdated string
7267
Sections []section
7368
BurndownJSON template.JS
69+
CurMilestone string // The title of the current release milestone in GitHub. For example, "Go1.18".
7470

7571
// dirty is set if this data needs to be updated due to a corpus change.
7672
dirty bool
@@ -100,10 +96,6 @@ func (i *item) ReleaseBlocker() bool {
10096
return i.Issue.HasLabel("release-blocker")
10197
}
10298

103-
func (i *item) CurrentBlocker() bool {
104-
return i.Issue.Milestone.Title == curMilestoneTitle && i.ReleaseBlocker()
105-
}
106-
10799
func (i *item) EarlyInCycle() bool {
108100
return !i.ReleaseBlocker() && i.Issue.HasLabel("early-in-cycle")
109101
}
@@ -253,6 +245,25 @@ func (s *server) updateReleaseData() {
253245
return nil
254246
})
255247

248+
// Determine current milestone based on the highest go1.X tag.
249+
var highestGo1X int
250+
s.proj.ForeachNonChangeRef(func(ref string, _ maintner.GitHash) error {
251+
if !strings.HasPrefix(ref, "refs/tags/go1.") {
252+
return nil
253+
}
254+
tagName := ref[len("refs/tags/"):]
255+
if _, x, _, ok := version.ParseTag(tagName); ok && x > highestGo1X {
256+
highestGo1X = x
257+
}
258+
return nil
259+
})
260+
// The title of the current release milestone in GitHub. For example, "Go1.18".
261+
curMilestoneTitle := fmt.Sprintf("Go1.%d", highestGo1X+1)
262+
// The start date of the current release milestone, approximated by taking the
263+
// Go 1.17 release date, and adding 6 months for each successive major release.
264+
var monthsSinceGo117Release = time.Month(6 * (highestGo1X - 17))
265+
curMilestoneStart := time.Date(2021, time.August+monthsSinceGo117Release, 1, 0, 0, 0, 0, time.UTC)
266+
256267
dirToIssues := map[string][]*maintner.GitHubIssue{}
257268
var curMilestoneIssues []*maintner.GitHubIssue
258269
s.repo.ForeachIssue(func(issue *maintner.GitHubIssue) error {
@@ -307,6 +318,7 @@ func (s *server) updateReleaseData() {
307318
s.appendPendingCLs(dirToCLs)
308319
s.appendPendingProposals(issueToCLs)
309320
s.appendClosedIssues()
321+
s.data.release.CurMilestone = curMilestoneTitle
310322
s.data.release.LastUpdated = time.Now().UTC().Format(time.UnixDate)
311323
s.data.release.dirty = false
312324
}

devapp/server.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ type server struct {
3333

3434
cMu sync.RWMutex // Used to protect the fields below.
3535
corpus *maintner.Corpus
36-
repo *maintner.GitHubRepo
36+
repo *maintner.GitHubRepo // The golang/go repo.
37+
proj *maintner.GerritProject // The go.googlesource.com/go project.
3738
helpWantedIssues []issueData
3839
data pageData
3940

@@ -97,10 +98,14 @@ func (s *server) initCorpus(ctx context.Context) error {
9798
return fmt.Errorf("godata.Get: %v", err)
9899
}
99100
s.corpus = corpus
100-
s.repo = s.corpus.GitHub().Repo("golang", "go") // The golang/go repo.
101+
s.repo = s.corpus.GitHub().Repo("golang", "go")
101102
if s.repo == nil {
102103
return fmt.Errorf(`s.corpus.GitHub().Repo("golang", "go") = nil`)
103104
}
105+
s.proj = s.corpus.Gerrit().Project("go.googlesource.com", "go")
106+
if s.proj == nil {
107+
return fmt.Errorf(`s.corpus.Gerrit().Project("go.googlesource.com", "go") = nil`)
108+
}
104109
return nil
105110
}
106111

devapp/templates/release.tmpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ a:visited {
8080
{{range .Groups}}
8181
{{if .Dir}}<h4 class="DirTitle">{{.Dir}}</h4>{{end}}
8282
{{range .Items}}
83-
{{if .FirstPerformance}}<h5 class="Performance-separator">performance</h5>{{end}}
83+
{{if .FirstPerformance}}<h5 class="Performance-separator">performance</h5>{{end}}
8484
{{$i := .Issue}}
8585
{{if $i}}
8686
<div class="Item">
87-
{{if .CurrentBlocker}}
87+
{{$currentBlocker := and (eq .Issue.Milestone.Title $.CurMilestone) .ReleaseBlocker}}
88+
{{if $currentBlocker}}
8889
<div class="Mark" title="{{.Issue.Milestone.Title}} release blocker">★</div>
8990
{{else if .ReleaseBlocker}}
9091
<div class="Mark" title="Release blocker">✩</div>

0 commit comments

Comments
 (0)