-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hierarchical release note feature functions #435
Conversation
toolbox/relnotes/hierarchy.go
Outdated
"github.com/google/go-github/github" | ||
) | ||
|
||
func hierarchicalNoteLayout(f *os.File, dict map[string]map[string]map[int]map[int]bool, issueMap map[int]*github.Issue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dict
is crazy, you may want to split them, and create a structure for each level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yutongz Updated.
toolbox/relnotes/hierarchy.go
Outdated
for _, pr := range prs { | ||
issues := extractFixedIssues(*issueMap[pr].Body) | ||
if len(issues) == 0 { | ||
setNoteDict(dict, "nullSig", "nullArea", -1, pr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could use extractIssueSIGs(issueMap[pr]) and extractIssueArea(issueMap[pr]) instead of "nullSig" and "nullArea" to still sort these issues, since many prs don't link to an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jennybuckley In our design doc we want the automation to enforce every release-note PR linking to at least one issue. But I agree that the rule seems to be not applied yet. I pushed an update to use SIG & area labels from PRs with no issue associated.
var areas = make([]string, 0) | ||
for _, l := range i.Labels { | ||
if strings.HasPrefix(*l.Name, "area/") { | ||
areas = append(areas, (*l.Name)[5:]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does github api guarantee anything about the order of the labels returned? I am wondering because if two issues have labels "area/Alpha" and "area/Beta" and the labels can be in any order, then they might be put into different area buckets in the final document, even though they have the same areas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jennybuckley I think it guarantees alphabetical order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also TrimPrefix
here.
var areas = make([]string, 0) | ||
for _, l := range i.Labels { | ||
if strings.HasPrefix(*l.Name, "area/") { | ||
areas = append(areas, (*l.Name)[5:]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also TrimPrefix
here.
var sigs = make([]string, 0) | ||
for _, l := range i.Labels { | ||
if strings.HasPrefix(*l.Name, "sig/") { | ||
sigs = append(sigs, (*l.Name)[4:]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not using TrimPrefix here?
// with at least one issue. However it's observed that the rule is not | ||
// applied yet. Also old PRs may not link to an issue. | ||
// | ||
// To produce info-richer release note, we try to get SIG and Area label |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, most of PRs don't have either sig or area label. I once felt a bit painful when I wanted to filter PRs by sig. I was thinking we enforce sig labels on PRs as we already do on issues. Then we may get more info here. @enisoc @Bradamant3 WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enforcing sig label on PR will also be helpful for #348.
toolbox/relnotes/hierarchy.go
Outdated
// extractFixedIssues parses the fixed issues' id from PR body. | ||
func extractFixedIssues(msg string) []int { | ||
var issues = make([]int, 0) | ||
re, _ := regexp.Compile("fixes #([0-9]+)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that github not only supports fixes
but also fixed, closes, closed, etc
, though we use fixes
in PR template. That means, some guys may use other supported keywords.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and it can also fixes issue in other repo, e.g., fixes kubernetes/kubeadm#123
. do we need to respect this case?
@roycaihw #434 has been merged. Is this in working order if I patch it in locally? I'd like to be able to do a manual run as soon as possible, to start showing the relnotes lead (@Bradamant3) what the output looks like. |
@enisoc @xiangpengzhao There are some changes needed. I will do an update soon today. |
Check issue != pr in extracting fixed issues; Look for "ref" besides "fixes"
@enisoc @xiangpengzhao I've updated this PR. Now it rebases on #434 and generates layered output. One common problem I hit during testing was PRs referring to issues in other repo (e.g kubernetes/kubeadm). Currently the tool doesn't recognize those issues. Example output against v1.7.0..v1.7.2 |
@roycaihw the hierarchy of the example output looks great, but it's a bit strange to see |
@roycaihw I run cc @enisoc @Bradamant3 @nickchase
|
logs:
|
BTW, it works well for release-1.8. |
@xiangpengzhao The If you run the command without |
@roycaihw At the moment, we're trying to use the generator to make a starting point for the hand-written 1.9.0 minor release notes. It's a little different than the way anago uses it. @nickchase @xiangpengzhao @Bradamant3 I think I found a process to generate what we need. Here's the output I get: https://gist.github.com/enisoc/6389e785c7ff8b73f473a5ca5c222a78 For our purpose, maybe we can clean this up by using a couple layers of markdown headers to reduce the nesting of bulleted lists. @roycaihw Do you think that would be an easy change to make? My steps: # prereqs:
# https://github.com/golang/dep
# https://bazel.build/
# https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
# in kubernetes/release repo
git fetch upstream pull/435/head:pull-435
git checkout pull-435
dep ensure
bazel run //:gazelle
bazel build toolbox/relnotes:relnotes
# in kubernetes/kubernetes repo
export GITHUB_TOKEN=...
../release/bazel-bin/toolbox/relnotes/relnotes \
--htmlize-md --quiet \
--markdown-file=/tmp/relnotes.md \
--html-file=/tmp/relnotes.html \
--branch=master \
v1.8.0.. |
@enisoc cool ! yeah what you get are the full release notes of 1.9 since 1.8.0. That's what we want. 👍 I try my original command w/o |
agreed. another concern is that the output now including both PRs and their associated issues. It's not so clear to identify what are PRs and what are issues in the output. |
@enisoc Yes. I just made a simple change. Here is a sample output: https://gist.github.com/roycaihw/62279aa12a6d7cbcb9a9d24dd4b0bbad @xiangpengzhao Sorry I wasn't aware of your goal. Yes you need to specify the range you want to get the changelog. When you omit the range, the start point would be the last release on that branch (in your case v1.9.0-alpha.2) and the end point would be current HEAD. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
release lead role handbook: encourage global mindset
This is the second PR following #434. Please refer to #434 to review the design doc and test commands.