Skip to content
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

WIP: Pass a list of NoteCategory to template instead of map of kind t… #1154

Closed
wants to merge 2 commits into from
Closed

WIP: Pass a list of NoteCategory to template instead of map of kind t… #1154

wants to merge 2 commits into from

Conversation

j0n3lson
Copy link
Contributor

@j0n3lson j0n3lson commented Mar 6, 2020

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
/kind design

What this PR does / why we need it:
Introduces a NoteCatetory that encapsulates the notes (string slice) and kind. Also introduces the NoteCollection type which is a container that is passed into the template. These are need to support #pr1148 as the template cannot sort the NotesByKind map easily.

If we like this idea I can fully implement it.

Which issue(s) this PR fixes:
None

Special notes for your reviewer:

Just wanted to demo the idea.

Does this PR introduce a user-facing change?:

Work in progress

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 6, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @j0n3lson. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 6, 2020
@k8s-ci-robot k8s-ci-robot requested review from cpanato and jeefy March 6, 2020 09:21
@j0n3lson
Copy link
Contributor Author

j0n3lson commented Mar 6, 2020

/assign @saschagrunert

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: j0n3lson
To complete the pull request process, please assign justaugustus
You can assign the PR to them by writing /assign @justaugustus in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added area/release-eng Issues or PRs related to the Release Engineering subproject sig/release Categorizes an issue or PR as relevant to SIG Release. labels Mar 6, 2020
@saschagrunert
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 6, 2020
require.NoError(t, tt.collection.Sort(kindPriority))
require.NoError(t, tmpl.Execute(&got, tt.collection), "rendering template")

require.Empty(t, diff.Diff(tt.wantOutput, got.String()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of doing this instead of require.Equal() (should have a diff output, too)


// Sort sorts selection by sorted by priority order.
func (n *NoteCollection) Sort(kindPriority []Kind) error {
// MAYBE? Implement sorted.Interface instead?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you're referring the sort.Interface, right? What would be the benefit in implementing this interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. I left it as a place holder but I don't see a strong benefit to implementing sort.Interface to be honest. It was just a thought :)

Copy link
Member

@saschagrunert saschagrunert Mar 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with the (n *NoteCollection) Sort(kindPriority []Kind) method, it behaves in the same way like the other functions inside the sort package 👍

@saschagrunert
Copy link
Member

saschagrunert commented Mar 6, 2020

I think this appraoch goes into the right direction 👍, sorting maps in golang can be just done via slices, so I guess we're fine.

@saschagrunert
Copy link
Member

/kind design

@k8s-ci-robot k8s-ci-robot added kind/design Categorizes issue or PR as related to design. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Mar 6, 2020
There are two main changes here:

* Bug fix: Template rendering was not rendering notes for PRs with no kinds (e.g
uncategorized)

* Design change: This eliminates the need to have an explicit NotesUncategorized
field.
…o noteslice

Introduces a NoteCollection type that can be passed to the template. This is
need so that the kinds can be rendered in priority order (PR#1148). In the
current implementation the template cannot render the notes in order because
the NotesByKind map is unordered.

If we like this idea I can fully implement it.
@j0n3lson
Copy link
Contributor Author

j0n3lson commented Mar 8, 2020

I added this to the other pr#1148 so I'm deleting this PR.

@j0n3lson j0n3lson closed this Mar 8, 2020
@j0n3lson j0n3lson deleted the refactor-doc-notes branch March 8, 2020 10:14
k8s-ci-robot added a commit that referenced this pull request Jul 20, 2020
changelog: remove changelog files from other releases when we cut the first official release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/design Categorizes issue or PR as related to design. needs-priority ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants