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

Change ReleaseNotes to an own struct #1423

Merged
merged 1 commit into from
Jul 21, 2020
Merged

Change ReleaseNotes to an own struct #1423

merged 1 commit into from
Jul 21, 2020

Conversation

saschagrunert
Copy link
Member

What type of PR is this?

/kind api-change

What this PR does / why we need it:

This gives us the possibility to streamline the API surface to:

releaseNotes, err := notes.GatherReleaseNotes(notesOptions)
if err != nil { … }

doc, err := document.New(
    releaseNotes, notesOptions.StartRev, notesOptions.EndRev,
)
if err != nil { … }

The ReleaseNotesHistory is mostly not used by consumers and wrapping it
in a struct makes it easier to understand for readers.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

/assign @puerco

Does this PR introduce a user-facing change?

- Changed `notes.ReleaseNotes` to be a wrapper struct which now contains the notes by PR and the history.
  Necessary API fields to retrieve and set the notes have been added as well, like `notes.NewReleaseNotes()`.

This gives us the possibility to streamline the API surface to:

```
releaseNotes, err := notes.GatherReleaseNotes(notesOptions)
if err != nil { … }

doc, err := document.New(
    releaseNotes, notesOptions.StartRev, notesOptions.EndRev,
)
if err != nil { … }
```

The ReleaseNotesHistory is mostly not used by consumers and wrapping it
in a struct makes it easier to understand for readers.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 21, 2020
@k8s-ci-robot k8s-ci-robot added sig/release Categorizes an issue or PR as relevant to SIG Release. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 21, 2020
@fejta-bot
Copy link

This PR may require API review.

If so, when the changes are ready, complete the pre-review checklist and request an API review.

Status of requested reviews is tracked in the API Review project.

Comment on lines +178 to +186
func (r *ReleaseNotes) Get(prNumber int) *ReleaseNote {
return r.byPR[prNumber]
}

// Set can be used to set a release note for the provided prNumber
func (r *ReleaseNotes) Set(prNumber int, note *ReleaseNote) {
r.byPR[prNumber] = note
r.history = append(r.history, prNumber)
}
Copy link
Member

Choose a reason for hiding this comment

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

Nice 👍

Copy link
Member

@puerco puerco left a comment

Choose a reason for hiding this comment

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

Nice @saschagrunert besides the API streamline, thanks for abstracting them behind Get/Set methods they will make handling the notes easier once we merge the rest of the maps project.
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 21, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: puerco, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit a8ab926 into kubernetes:master Jul 21, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.19 milestone Jul 21, 2020
@saschagrunert saschagrunert deleted the release-notes-struct branch July 21, 2020 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. 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. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority 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.

4 participants