-
Notifications
You must be signed in to change notification settings - Fork 505
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
Follow up to PR#1008: Lazy loading of format spec and Sorting Notes #1148
Conversation
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 Once the patch is verified, the new status will be reflected by the 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. |
/cc @saschagrunert Here's a follow up to PR#1008 that refactors template rendering and adds additional test. PTAL. |
/assign @saschagrunert |
/ok-to-test |
Not sure why this test is failing. Only thing I can think of is that this change does write more files to tempdir in order to get more end-to-end coverage. Do we need to bump up the timeout on the test config? |
Verify bazel fails, please run
|
pkg/notes/document/testdata/document_without_downloads.md.golden
Outdated
Show resolved
Hide resolved
## Changes by Kind | ||
|
||
### Other (Bug, Cleanup or Flake) | ||
- This should definitely get you promoted. | ||
|
||
### API Change | ||
- This might make people sad...or happy. | ||
|
||
### Bug | ||
- This will likely get you promoted. | ||
|
||
### Cleanup | ||
- This usually does not get you promoted but it should. | ||
|
||
### Deprecation | ||
- Delorted. | ||
|
||
### Design | ||
- Change the world. | ||
|
||
### Documentation | ||
- There was a library in Alexandria, Egypt once. | ||
|
||
### Failing Test | ||
- Please run presubmit test! | ||
|
||
### Feature | ||
- This will get you promoted. | ||
|
||
### Flake |
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.
The notes by kind should be sorted by their priority.
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 is how I thought about solving for sorting. It's kinda a challenge to sort currently since the template is given a map. We need the kind
information for rendering but to preserve order we need a slice (i.e. we loose kind information):
I thought about other ways to solve this in the template but I wanted to keep the template deadly simple and avoid putting logic (like sorting) in there.
Another way I thought of was just to have a function
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.
See my comments there :)
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.
Okay sgtm. I'll implement that PR, submit, and then submit this.
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.
/hold
For #1154
Are you saying this PR /must/ include the fix for sorting? Or are you saying that other PR needs to be merged /before/ this PR. Should I combine the sorting into this PR? |
Oh you can decide what you prefer. Since I cannot approve this PR and we cannot merge it now just do it like you want. :) |
Hey, I've added another commit in this PR. Can you PTAL and let me know :) |
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.
/lgtm
Thank you @j0n3lson 🙏
/assign @justaugustus |
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.
/approve
/lgtm
Ping @justaugustus can we merge it? |
Fixes: * Fixes new line at the end of rendered templates. Refactoring: * Moves validation and reading of template spec from Options into Document and colocate the reading of the template file with the template parsing. validating the template spec (i.e. "go-template:*") at rendering time is a bit easier than trying to parse/validate a spec that also contains go template actions. * Soft-deprecated FormatSpecMarkdown and Document.RenderMarkdown. The soft deprecation adds a deprecation notice but exludes them from golint until so linting passes (this will be removed in issue #1019). Testing: * Enhance golden file testing to simulate reading a user template. * Enhance golden file testing to cover rendering without downloads. * Enhance testing to provide line-level diffing between between expected and golden files.
Design changes: * Deprecate `Document.NotesByKind` * Introduce `NoteCollection` which is a simple list that can be passed to the template. * Introduce `NoteCategory` which is a container maping kind to a slice of notes.
Rebased. Can this be merged? I have a clean up FR pending this one. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: cpanato, j0n3lson, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@j0n3lson its in. Feel free to follow up on this one. :) |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
This is a follow up to the mentioned PR#1008.
Deprecated:
Document.NotesByKind
is deletedDocument.RenderMarkdown
which will be deleted once changelog et al are migrated to template rendering.Fixes:
RenderMarkdown()
)Design:
Options
intoDocument
andcollocating the reading of the template file with the template parsing.
Validating the template spec (i.e. "go-template:*") at rendering
time is a bit easier.
Testing
Relevant Issues:
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?: