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

Fix empty release note parsing #3764

Merged

Conversation

npolshakova
Copy link
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

Fixes the empty release note parsing when an empty or whitespace-only release note is left on the PR description.

Which issue(s) this PR fixes:

Fixes #3516

Special notes for your reviewer:

Release notes collection automation has resulted in incorrect text and markdown being collected: kubernetes/sig-release#2449 (comment)

You can see examples of this merged in sig-release for 1.30 due to past release notes collection:

Updated examples from 1.29 that are still in the repo after 1.30 was cleaned up:

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/release-eng Issues or PRs related to the Release Engineering subproject labels Sep 17, 2024
@k8s-ci-robot k8s-ci-robot added the sig/release Categorizes an issue or PR as relevant to SIG Release. label Sep 17, 2024
@npolshakova npolshakova requested review from saschagrunert and removed request for jimangel and jrsapi September 17, 2024 02:21
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 17, 2024
Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

/lgtm

/hold for extra eyes

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 17, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 17, 2024
@cpanato
Copy link
Member

cpanato commented Sep 17, 2024

Thanks!!

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 17, 2024
Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

Thanks! Do you mind looking into the failing integration tests?

@npolshakova
Copy link
Contributor Author

npolshakova commented Sep 17, 2024

Thanks! Do you mind looking into the failing integration tests?

Okay, so it's failing the integration test because now we're exiting early here if any PRs match the exclusion regex:

// If we match exclusion filter (release-note-none), we don't look further,
		// instead we return that PR. We return that PR because it might have a map,
		// which is checked after this function returns
		if MatchesExcludeFilter(prBody) {
			res := &Result{commit: commit, pullRequest: pr}
			logrus.Infof("PR #%d contains exclusion (release-note-none)", pr.GetNumber())

			return res, nil
		}

There are a couple options:

  1. Continue checking all prs, skipping the ones that contain the exclusion regex. The empty release note would still be in the exclusion regex.
  2. Treat the explicit exclusion regex separately from the empty release note. Setting the /release-notes-none or NONE/N/A in the release note section would mean all PRs don't have a release note. An empty release note is ignored only if all PRs don't have a release note. We're already kind of doing this by checking noteTextFromString is not empty. This is the approach fe7fa2e has.

Multiple PRs happen in cherry-pick cases like here:

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 17, 2024
@xmudrii
Copy link
Member

xmudrii commented Sep 18, 2024

I think this looks solid, but I'd like to bring a topic up for this discussion. We originally allowed cherry-picks to have an empty release note, in which case the release note would be inherited from the original PR. However, we had some troubles in the past with that, e.g. #2689 (this was quite a journey as can be told from the PR description).

With the risk that I lack context, I would propose that we stop doing this and explicitly forbid empty release notes, even for cherry-picks.

It has two huge benefits from my point of view:

  • We'll be able to drop this edge case, which would make our code easier to maintain and understand
  • It'll make it easier for end users to figure out what's changed in the cherry-pick PR without having to search for the original PR

I'm going to tag leads on this PR (@kubernetes/sig-release-leads) so that they can provide 2 cents on this. Please correct me if I'm wrong or if I'm lacking context about this.

About this PR, I'll go ahead and lgtm it, but I'll leave the hold for other folks to take a look. We can move this conversation to a new GitHub issue if needed.

Copy link
Member

@xmudrii xmudrii left a comment

Choose a reason for hiding this comment

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

I found a nit, but otherwise it looks good

pkg/notes/notes_gatherer_test.go Outdated Show resolved Hide resolved
@npolshakova
Copy link
Contributor Author

@kubernetes/sig-release-leads @xmudrii Can you give this another pass when you get a chance? Thanks!

Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 2, 2024
Copy link
Member

@xmudrii xmudrii left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve
/hold cancel
I think we have the lazy consensus here :)

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 2, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cpanato, npolshakova, xmudrii

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 f09e5f2 into kubernetes:master Oct 2, 2024
11 checks passed
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/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority release-note-none Denotes a PR that doesn't merit a release note. sig/release Categorizes an issue or PR as relevant to SIG Release. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release Notes Collection Picks Up Incorrect Text
5 participants